Saturday, March 24, 2018

Not able to upgrade tensorflow on mac

Leave a Comment

I am running command to upgrade tensorflow, But always getting below error.

Could not find a version that satisfies the requirement tensorflow-gpu (from versions: ) 

I have tried below commands :

pip3 install --upgrade tensorflow  pip3 install --upgrade tensorflow-gpu 

4 Answers

Answers 1

I have a checklist for Could not find a version that satisfies the requirement XYZ errors:

pip version check

What python version does the pip you're using refer to - is it the correct one? Imagine you have python3.4 and python3.5 installed and using pip3 command that is symlinked to pip3.4 while you assume it is symlinked to pip3.5. So issue first:

$ pip3 -V | grep -o "(.*)" 

and verify the correct python version is printed. If it's not, then you have to find the correct pip executable: first check if you have version-specific commands available (e.g.

$ which pip3.6 

for python3.6) and verify it is pointing to the correct python version with the command above (e.g. $ pip3.6 -V | grep -o "(.*)"). If there is no version-specific pip, start searching for the correct executable in the sys.prefix's bin subdirectory. Example on my machine:

$ python3.6 -c "import sys; print(sys.prefix)" | xargs -I {} find {}/bin -name pip* /Library/Frameworks/Python.framework/Versions/3.6/bin/pip3.6 /Library/Frameworks/Python.framework/Versions/3.6/bin/pip3 

platform check

You may have a platform mismatch on your target machine. Check what platform is recognized by pip:

$ python3.6 -c "import pip; print(pip.pep425tags.get_platform())" 

The output should be macosx_10_11_x86_64 or newer (e.g. macosx_10_13_x86_64). If you have an older OSX, you will have to build TensorFlow from source because prebuilt packages exist for MacOS 10.11 and higher only.

Other platforms supported are: manylinux1_x86_64 (so all the 64bit Linux distros with glibc>2.5 should do just fine, no 32bit distros or some exotic ones like Alpine with musl) and win_amd64 (64bit Windows).

ABI check

A less common problem is the ABI mismatch: you can check your platform's ABI with

$ python3.6 -c "import pip; print(pip.pep425tags.get_abi_tag())" 

The supported ABI tags are currently: cp27m, cp27mu, cp33m, cp34m, cp35m, cp36m. The above command should print you one of the tags listed. If not, you will have to build/install from sources.

Last notes

A rare case could be a misconfigured PyPI index: run

$ pip3 install --upgrade tensorflow --verbose Collecting tensorflow   2 location(s) to search for versions of tensorflow:   * https://pypi.python.org/simple/tensorflow/   * https://my.pypi.server/base/dev/+simple/tensorflow/ ... 

Check if https://pypi.python.org/simple/tensorflow/ is in the list. If not, try the command

$ pip3 install --upgrade tensorflow --index-url=https://pypi.python.org/simple 

If the installation succeeds, check if you have PIP_INDEX_URL environment variable set and clear it. If not, check if you have the file ~/.pip/pip.conf present and if it has index-url entry defined.

Answers 2

Use virtualenv or anaconda to install tensorflow. I did it with anaconda on Mac.

Answers 3

Give this a shot:

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl 

If installation is successful, import from bs4:

from bs4 import BeautifulSoup4 

If this does not work check your version of pip. From Tensorflow's website: "You will need pip version 8.1 or later for the following commands to work". Upgrade pip and give Tensorflow another go.

sudo pip install --upgrade pip sudo pip install tensorflow  

It also could be that Tensorflow isn't compatible with your version of Python. You need a 64-bit version of Python; it won't work with the 32-bit version.

Answers 4

if you have all of the proper libraries...

conda install tensorflow 

if it shows error then try

pip install tensorflow-gpu 

If the above pip install doesn't work, you might want to start from a clean anaconda install.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment