how to fix' no module name: object_objection.box_coders'? - python

ModuleNotFoundError on object-detection
Error StackTrace
Traceback (most recent call last):
File "train.py", line 58, in <module>
from object_detection.builders import model_builder
File "C:\Program Files\Python37\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\model_builder.py", line 21, in <module>
from object_detection.builders import box_coder_builder
File "C:\Program Files\Python37\lib\site-packages\object_detection-0.1-py3.7.egg\object_detection\builders\box_coder_builder.py", line 17, in <module>
from object_detection.box_coders import faster_rcnn_box_coder
ModuleNotFoundError: No module named 'object_detection.box_coders'

Seems your package is broken. Try reinstall it:
pip install --force-reinstall object-detection
Also see the docs's requires:
Requires: Python >=3.5, !=3.7.*
It only works with Python>=3.5 but no Python 3.7.*, so it doesn't work with your current Python. Consider install Python 3.5 and it should e fine.

Related

pip : was OK for months now :ImportError: No module named 'pip._vendor.requests.adapters'

All ok until now; Using Win10, Anaconda dstribution, attempting to run pip leads to :
traceback (most recent call last):
File "C:\Users\Tim\Anaconda3\Scripts\pip-script.py",
line from pip import main
File "C:\Users\Tim\Anaconda3\lib\site-packages\pip\__init_ from pip.vcs import git, mercurial, subversion, bazaar
File "C:\Users\Tim\Anaconda3\lib\site-packages\pip\vcs\mer from pip.download import path_to_url
File "C:\Users\Tim\Anaconda3\lib\site-packages\pip\downloa from pip._vendor.requests.adapters import BaseAdapter,
H mportError: No module named 'pip._vendor.requests.adapters'
Same problem here
Traceback (most recent call last):
File "C:\Users\susen\Anaconda3\Scripts\pip-script.py", line 6, in <module>
from pip import main
File "C:\Users\susen\Anaconda3\lib\site-packages\pip\__init__.py", line 28, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "C:\Users\susen\Anaconda3\lib\site-packages\pip\vcs\mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "C:\Users\susen\Anaconda3\lib\site-packages\pip\download.py", line 41, in <module>
from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter
ModuleNotFoundError: No module named 'pip._vendor.requests.adapters'
This is happening since I upgraded some packages yesterday. Then I couldn't run pip whatsoever.
I ended up doing a clean install of anaconda. That solved the problem.
Someone suggested removing a request folder from lib/site-packages/pip/_vendor folder. github.com/ContinuumIO/anaconda-issues/issues/6317
That worked for me.
This worked for me.
conda install pip -f

No backports error while retraining Tensorflow's Inception v3 model

I have been trying to retrain Inception by following the tutorial here:
https://www.tensorflow.org/tutorials/image_retraining.
I get this error "No module named backports"
when I run this
bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir ~/marine_animal_species1
This is the full Traceback:
Traceback (most recent call last):
File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/examples/image_retraining/retrain.py", line 91, in <module>
import tensorflow as tf
File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 64, in <module>
from tensorflow.python.framework.framework_lib import *
File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/framework_lib.py", line 100, in <module>
from tensorflow.python.framework.subscribe import subscribe
File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/subscribe.py", line 26, in <module>
from tensorflow.python.ops import variables
File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/variables.py", line 26, in <module>
from tensorflow.python.ops import control_flow_ops
File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/control_flow_ops.py", line 70, in <module>
from tensorflow.python.ops import tensor_array_ops
File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/ops/tensor_array_ops.py", line 33, in <module>
from tensorflow.python.util import tf_should_use
File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/util/tf_should_use.py", line 28, in <module>
from backports import weakref # pylint: disable=g-bad-import-order
ImportError: No module named backports
I use ubuntu 16.04.
Thank you for the help.
sudo pip install backports.weakref
sudo pip3 install backports.weakref
Solved the problem for me.
Install the weakref module from the backports namespace.
You can get the wheel file from https://pypi.python.org/pypi/backports.weakref/1.0rc1 & install the downloaded wheel as such:
sudo pip install backports.weakref-1.0rc1-py2-none-any.whl # python2
sudo pip3 install backports.weakref-1.0rc1-py3-none-any.whl # python3
Then run your command
bazel-bin/tensorflow/...
This should solve your problem.

Import tensorflow error

I installed tensorflow using anaconda distribution and I am unable to use the same in python.
When I import tensorflow using import tensorflow I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File "/Users/kaxilnaik/anaconda/lib/python2.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in <module>
serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"z\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB2\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01\xf8\x01\x01\x62\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
I tried reinstalling anaconda as well as uninstalling protobuf which I found as an answer somewhere in stackoverflow.
You should uninstall tensorflow as well, and make sure protobuf is uninstalled. You can try brew uninstall protobuf as well. Then reinstall protobuf, and tensorflow. Tensorflow requires protobuf version 3.x
pip install 'protobuf>=3.0.0a3'
You can test your protobuf version:
import google.protobuf
>>> print google.protobuf.__version__

Python2.7: No module named zlib

I'm trying to use matplotlib in Python 2.7, but am encountering the following error
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 156, in <module>
File "/usr/lib/pymodules/python2.7/matplotlib/cbook.py", line 15, in <module>
File "/usr/local/lib/python2.7/gzip.py", line 9, in <module>
import zlib
ImportError: No module named zlib
I installed python with sudo apt-get install python2.7, and other required packages similarly. I installed zlib from source, with no issues.

ImportError: cannot import name ResourceError

I'm trying to install couchdb app on debian using the following command
couchapp push http://user:pass#localhost:5984/acra-appname
and I'm having the following error output:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/restkit/__init__.py", line 9, in <module>
from restkit.conn import Connection
File "/usr/local/lib/python2.6/dist-packages/restkit/conn.py", line 14, in <module>
from socketpool import Connector
ImportError: No module named socketpool
Traceback (most recent call last):
File "/usr/local/bin/couchapp", line 7, in <module>
from couchapp.dispatch import run
File "/usr/local/lib/python2.6/dist-packages/couchapp/dispatch.py", line 10, in <module>
import couchapp.commands as commands
File "/usr/local/lib/python2.6/dist-packages/couchapp/commands.py", line 15, in <module>
from couchapp import clone_app
File "/usr/local/lib/python2.6/dist-packages/couchapp/clone_app.py", line 15, in <module>
from couchapp.errors import AppError
File "/usr/local/lib/python2.6/dist-packages/couchapp/errors.py", line 7, in <module>
from restkit import ResourceError
ImportError: cannot import name ResourceError
As far as I understand the error is:
ImportError: No module named socketpool
How can I install this module or how to resolve the problem?
As Ifthikhan sugessted: Install it using a package manager such as apt-get and thereafter using pip you can install socketpool.
I had this problem when installing couchapp. I used pip to install it, and I thought it completed, but when I ran it I had the ImportError problem. Turns out the pip install didn't succeed and I first needed to:
apt-get install python-dev
Then when I did a
pip install couchapp
all of the dependencies were installed and couchapp ran without a problem.

Categories

Resources