MrCaptain Alex
MrCaptain Alex

Reputation: 169

No module named tensorflow even after installing with pip

I'm trying to follow this guide to test this new algorithm: https://github.com/lalonderodney/SegCaps

I can't do it in my PC, so i'm using another server with Putty. Now I'm connected with the other server.

First of all I installed TensorFlow as indicates in the guide with : pip install -r requirements.txt

After I wrote this code: ./main.py segcaps.png in which segcaps.png is the image that i want to use

Finally I wrote python main.py --data_root_dir data that is the only required parameter with the directory containing imgs and masks folders.

Now it gives me an error: ModuleNotFoundError: No module named 'tensorflow.python.framework'

I searched it in the directory tensorflow/python/framework and it exists.

So, i don't know how to solve it. Ideas?

Upvotes: 0

Views: 977

Answers (2)

Berat
Berat

Reputation: 19

You can use pip show tensorflow to see if it is installed or not. As for ModuleNotFoundError try uninstalling keras and reinstalling an earlier version by pip install keras==2.1.6

Upvotes: 1

progyammer
progyammer

Reputation: 1508

If you have multiple Python versions installed, then you'll (most likely) have multiple pip versions installed too. Make sure that the pip command you use installs the package(s) into the Python version you want it to. It may so happen that the package got installed into python2 but you wanted it in python3.

Since using pip did not install the packages in python3, pip3 is most likely to the PyPI for python3. Try

pip3 install -r requirements.txt

and that should work.

In case you have an EnvironmentError you can try this (bad idea):

pip3 install -r requirements.txt --user

This solves the problem most of the times on standalone machines. I'm not sure about the server; insufficient permissions might block this.

Why is the --user flag a bad idea? Read: What is the purpose “pip install --user …”?

Upvotes: 1

Related Questions