Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named easydict [closed]

I'm trying to run the demo of py-faster-rcnn based on this github page. I have done all the previous steps. But When I try to run the deo with python ./tools/demo.py --gpu 0 --net vgg16 I get this error:

Traceback (most recent call last):
File "./tools/demo.py", line 17, in
from fast_rcnn.config import cfg
File "/home/hadi/Software/py-faster-rcnn/tools/../lib/fast_rcnn/config.py", line 23, in
from easydict import EasyDict as edict
ImportError: No module named easydict

I have installed easydict with both these commands:

sudo pip install easydict

pip install easydict

Is this related to python path? I have installed both python 2.7 and 3.5. Since then I get all these python related errors. For example I have installed tensorflow for both python 2 and 3. But with python 2 it always says:

No module named tensorflow

How can I fix this?

OS: Ubuntu 16.04

like image 934
Hadi GhahremanNezhad Avatar asked May 02 '17 07:05

Hadi GhahremanNezhad


People also ask

How to install easydict on Ubuntu?

Install it using the following command $ pip install easydict or $ sudo pip install easydict

How to fix'importerror-no module named xxxxxx'occurs in PyCharm?

This is the real reason of 'ImportError: No module named xxxxxx' occurred in PyCharm. To resolve this issue, you must add libraries to your project custom env by these steps: Then, all you needed package will be installed in you project custom 'venv' folder. Enjoy. Show activity on this post.

How do I run a Python module from my current directory?

So it doesn't just look in your current directory, but in all the directories that are in your current directory). After you've set your PYTHONPATH in the step above, run your module from your current directory (the toolkit directory). Python should now find and load the modules you specified. Hope this helps.


1 Answers

I would suggest trying the following:

First, check if easydict is installed or not On your terminal run:

python

from easydict import EasyDict

If this doesn't give an error then you have easydict installed. I had installed easydict using Anaconda:

conda install -c https://conda.binstar.org/auto easydict

Next, if this is working check if you have pip installed (It should have come installed with Anaconda):

which pip

This command should give output as /data/username/anaconda2/bin/pip

If this is the output then pip was installed with anaconda and not apt-get. In this case you should not use sudo while using pip and while running the code.

So, you should try running the code the following way:

bash build/demo.py

after that, if still the issue occurs add this following line to your demo.py file

import sys
sys.path.append('/usr/local/lib/python2.7/dist-packages/')
like image 115
orvi Avatar answered Sep 19 '22 10:09

orvi