Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
249 views
in Technique[技术] by (71.8m points)

python - Not able to upgrade tensorflow on mac

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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())"

For pip newer than 10.0:

$ python3.6 -c "import pip._internal as 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())"

For pip newer than 10.0:

$ python3.6 -c "import pip._internal as 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...