Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'resource' has no attribute 'getpagesize'

I am trying to use Tensorflow Object Detection API and I follow the steps mentioned in the given link -

https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html#tf-models-install

When I try to access the Object Detection Jupyter Notebook through jupyter notebook

I am facing the below exception

Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/home/dinesh/.local/lib/python3.6/site- 
packages/notebook/notebookapp.py", line 79, in <module>
    from .base.handlers import Template404, RedirectWithParams
  File "/home/dinesh/.local/lib/python3.6/site- 
packages/notebook/base/handlers.py", line 32, in <module>
    import prometheus_client
  File "/home/dinesh/.local/lib/python3.6/site-
packages/prometheus_client/__init__.py", line 7, in <module>
    from . import process_collector
  File "/home/dinesh/.local/lib/python3.6/site- 
packages/prometheus_client/process_collector.py", line 12, in <module>
_PAGESIZE = resource.getpagesize()
AttributeError: module 'resource' has no attribute 'getpagesize'

I am using

Python - 3.6.3

Jupyter - 1.0.0

How can I overcome this exception?

like image 271
Dinesh Avatar asked Sep 18 '25 01:09

Dinesh


2 Answers

Got a similar error. My project contained modules (folders)

  • model
  • resource (replaced with resources)
  • service

So I changed the name of the resource module to resources (change name to any appropriate module name)

like image 148
Pramod Kumar Sharma Avatar answered Sep 19 '25 16:09

Pramod Kumar Sharma


I have the same error ,after rename my resource module in the PYTHONPATH , it works right. check your PYTHONPATH, is there a resource module?

like image 21
Lee Lee Lee Avatar answered Sep 19 '25 16:09

Lee Lee Lee