No module named tensorflow even after installing with pip - tensorflow

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?

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 …”?

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

Related

Install TensorFlow addons

I have a venv with the following details:
python 3.6
TensorFlow 2.0.0
I tried to install tensorflow-addons using the following:
pip install -q --no-deps tensorflow-addons~=0.6
But then I keep receiving the following error:
Could not find a version that satisfies the requirement tensorflow-addons~=0.6 (from versions: )
No matching distribution found for tensorflow-addons~=0.6
You are using pip version 18.0, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
I also tried other versions of tensorflow-addons, e. g., 0.4.0, 0.5.0, ..., but it did not work out.
I came across this problem two times and each time I had to solve the problem with a different solution.
1. Solution:
Upgrade pip/pip3 by using the following command.
python3 -m pip install --upgrade pip
Select appropriate version of the tensorflow-addons using the
following link
https://github.com/tensorflow/addons#python-op-compatibility-matrix
Install using the following command
pip install tensorflow-addons==version
2. Solution:
go to https://pypi.org/project/tensorflow-addons/#history
click on appropriate version
click on "Download files" on menu to the left
click on a .whl file that matches your system
requirements/specifications
go to the directory where you download the .whl file and run the
following
pip install tensorflow_addons-name.whl
The problem appears to have been related to installing on Windows platforms in the earlier versions of tensorflow-addons. As of time of updating this comment this issue should disappear completely.
In fact the developers state it has been solved, as it is shown here:
FYI stable release for windows is out. pip install tensorflow-addons
https://github.com/tensorflow/addons/issues/173#issuecomment-573106184
At your command prompt, simply specify the version you want to install.
For me, my python version is 3.7.4 and Tensorflow version is 2.2.0
Therefore, the tensorflow-addons version that matches my python and tensorflow version is 0.10.0
pip install tensorflow-addons==0.10.0

Can't install Rasa on Ubuntu 18.04 + Python 3.7.5?

I have succeed to install Rasa NLU on my Win 10 with python 3.7 but couldn't do this on Ubuntu 18.04.
Please help.
Here is the error I get:
pip3 install rasa-x --extra-index-url https://pypi.rasa.com/simple
Could not find a version that satisfies the requirement
tensorflow~=1.15.0 (from rasa~=1.5.1->rasa-x) (from versions:
1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 2.0.0a0, 2.0.0b0, 2.0.0b1) No matching distribution found for tensorflow~=1.15.0 (from rasa~=1.5.1->rasa-x)
Please advise what is the difference to my Win10 machine?
Please advise how can I install it.
I had followed these following steps and it's working fine for me for ubuntu 18.04 + Python3
Firstly create directory name of your choice and get inside of it
mkdir rasaprojects #directory name of your choice in place of rasaprojects
cd rasaprojects #get inside that directory
Now create virtual environment of python3
virtualenv rasaenv -p python3 #write your environment name instead of rasaenv
Now activate the environment
source rasaenv/bin/activate
Now you are good to go with rasa installation
pip3 install rasa
Updating your pip version should solve the issue. I believe TensorFlow and your current pip version don't go well together.
Do this:
Download pip installer python script from here.
Run it using python get-pip.py
Another thing is that TensorFlow was not supported by python3.7 untill recently. So if the first solution doesn't work you can try downgrading python to python3.6
Upgrade pip before instaling rasa.
pip3 install --upgrade pip

Downloading PostgreSQL Mac Download Error

could you please advise me of a solution you may know for downloading PostgreSQL. I am trying to install 9.6.5 version, but also tried the 10.0, same error.
I am using an installation option for Mac operating system OS Sierra from website: https://www.openscg.com/bigsql/postgresql/installers.jsp/
I am getting an error:
Have tried to run the instruction sudo easy_install pip in the command line and it installs the pip file successfully. However I am still unable to install the PostgreSQL.
Please could you advise what the issue may be?
I have also installed Homebrew (it did not help).
I do already have anaconda and Python installed, as well as latest versions of R and RStudio.
I have now found a solution to the above problem (on Mac). Execute the following command in your terminal:
sudo easy_install-2.6 pip
If that does not work execute:
sudo easy_install-2.7 pip
This allows the PostgreSQL to be downloaded correctly.
I followed the instructions suggesting using easy_install-2.7 but still got an error very similar to that from the OP. I had to specifically install pip 9.0.0 with
sudo easy_install-2.7 pip=9.0.0
after which the PostgreSQL install worked.
The default pip is now v10, so it's probably a string compare issue in the installer.
Here is the solution that worked for me on Mac High Sierra 10.13.4:
Clear out the brew cache $ rm -rf ~/Library/Caches/Homebrew
Clear out the site-packages $ sudo rm -rf /usr/local/lib/python2.7/site-packages
Reinstall Python $ brew reinstall python This pulls down python-3.5.6.high_sierra and put it in /usr/local/bin/python3
But which python still shows /usr/bin/python
The solution is to run $ brew install python#2 which pulls down python#2-2.7.14_3.high_sierra
Now which python shows the correct path /usr/local/bin/python which is also where all your pip stuff is installed, so now pip will work.
Ensure the latest version of pip is installed with $ sudo pip install --upgrade pip

PIP install pandas not working

I am trying to install pandas with .whl file in a work computer but I get " cannot fetch URL" error. I have up to date version of PIP installed.How can I get this to work.I'm using Python 3.5.Any help will be appreciated.
I just used the following which was quite simple. First open a console then cd to where you've downloaded your file like some-package.whl and use
pip install some-package.whl
python -m pip install some-package.whl also works if pip is not found in PATH
Note: if pip.exe is not recognized, you may find it in the "Scripts" directory from where python has been installed. If pip is not installed, this page can help:
How do I install pip on Windows?
Note: for clarification
If you copy the *.whl file to your local drive (ex. C:\some-dir\some-file.whl) use the following command line parameters --
pip install C:/some-dir/some-file.whl
I guess since you are on a work computer
try this
sudo pip --proxy=http://username:password#proxyURL:portNumber install yolk
for example:
sudo pip --proxy=http://202.194.64.89:8000 install elasticsearch
202.194.64.89:8000 is my PROXY,

Pillow installed but not identified (Mac OS Yosemite)

I Installed pillow using brew, and when I try to repeat the isntallation I see it's there:
brew install Homebrew/python/pillow
Warning: pillow-2.7.0 already installed
But when I try to load it into a script I get an error:
ImportError: No module named Image
Any suggestions?
python usually looks for Pillow under normal site package installs. Here's what I would do to get a minimal Pillow setup where python should be guaranteed to see it:
sudo easy_install pip
pip install Pillow
I think it may also be possible to just do:
sudo easy_install Pillow
but pip is a bit more user friendly if you're planning on using more python scripts that might have dependencies.
Note: another issue you might be running into is if you're trying to use the Homebrew python but are ending up using the base OSX install of it instead. Make sure which python is showing you what you expect it to be.