TensorFlow not found using pip

2019-01-01 03:00发布

问题:

I\'m trying to intstall TensorFlow using pip:

$ pip install tensorflow --user
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

What am I doing wrong? So far I\'ve used Python and pip with no issues.

回答1:

After searching the internet for about 3 hours, I found this to finally work.

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

Edit 1: Tested on windows(8,8.1,10) and Mac. Change python3 to python according to your configuration. Change py3 to py2 in the url if you are using Python2.x

Edit 2: A list of different versions if someone needs: https://storage.googleapis.com/tensorflow



回答2:

You need a 64-bit version of Python and in your case are using a 32-bit version. As of now Tensorflow only supports 64-bit versions of Python 3.5.x and 3.6.x on Windows.

To check which version of Python you are running, type python or python3 to start the interpreter, and then type import struct;print(struct.calcsize(\"P\") * 8) and that will print either 32 or 64 to tell you which bit version of Python you are running.



回答3:

You need to use right version of Python and pip

On Windows 10, with Python 3.6.X version I was facing same then after checking deliberately , I noticed I had Python-32 bit installation on my 64 bit machine. Remember TensorFlow is only compatible with 64bit installation of python. Not 32 bit of Python

\"Image\"

If we download Python from python.org , the default installation would be 32 bit. So we have to download 64 bit installer manually to install Python 64 bit. And then add below to PATH environment.

C:\\Users\\AppData\\Local\\Programs\\Python\\Python36
C:\\Users\\AppData\\Local\\Programs\\Python\\Python36\\Scripts

Then run gpupdate /Force on command prompt. If python command doesnt work for 64 bit restart your machine.

Then run python on command prompt. It should show 64 bit

C:\\Users\\YOURNAME>python
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.

Then run below command to install tensorflow CPU version(recommended)

pip3 install --upgrade tensorflow

Update - Python 3.7

Currently only Python 3.5 and Python 3.6 are supported officially. Tensorflow has not released binaries for Python 3.7 still officially, we might need to wait a little for it to be released. You can use Python 3.6.x alongside or Anaconda with Python<3.7 virtual environment for time being.



回答4:

If you are trying to install it on a windows machine you need to have a 64-bit version of python 3.5. This is the only way to actually install it. From the website:

TensorFlow supports only 64-bit Python 3.5 on Windows. We have tested the pip packages with the following distributions of Python:

Python 3.5 from Anaconda

Python 3.5 from python.org.

You can download the proper version of python from here (make sure you grab one of the ones that says \"Windows x86-64\")

You should now be able to install with pip install tensorflow or python -m pip install tensorflow (make sure that you are using the right pip, from python3, if you have both python2 and python3 installed)

Remember to install Anaconda 3-5.2.0 as the latest version which is 3-5.3.0 have python version 3.7 which is not supported by Tensorflow.



回答5:

From tensorflow website: \"You will need pip version 8.1 or later for the following commands to work\". Run this command to upgrade your pip, then try install tensorflow again:

pip install --upgrade pip


回答6:

I figured out that TensorFlow1.0 only works with Python version 3.5.2. I had Python 3.6 but that didn\'t work. So, I had to downgrade Python and then I could install TensorFlow.



回答7:

Updated 11/28/2016: TensorFlow is now available in PyPI, starting with release 0.12. You can type

pip install tensorflow

...or...

pip install tensorflow-gpu

...to install the CPU-only or GPU-accelerated version of TensorFlow respectively.


Previous answer: TensorFlow is not yet in the PyPI repository, so you have to specify the URL to the appropriate \"wheel file\" for your operating system and Python version.

The full list of supported configurations is listed on the TensorFlow website, but for example, to install version 0.10 for Python 2.7 on Linux, using CPU only, you would type the following command:

$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl


回答8:

I had the same problem and solved with this:

# Ubuntu/Linux 64-bit, CPU only, Python 2.7
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see \"Installing from sources\" below.

# Mac OS X, CPU only, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py2-none-any.whl

# Mac OS X, GPU enabled, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py2-none-any.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.4
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see \"Installing from sources\" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.5
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp35-cp35m-linux_x86_64.whl

# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see \"Installing from sources\" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp35-cp35m-linux_x86_64.whl

# Mac OS X, CPU only, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py3-none-any.whl

# Mac OS X, GPU enabled, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py3-none-any.whl

Plus:

# Python 2
(tensorflow)$ pip install --upgrade $TF_BINARY_URL

# Python 3
(tensorflow)$ pip3 install --upgrade $TF_BINARY_URL

Found on Docs.

UPDATE!

There are new links for new versions

For example, for installing tensorflow v1.0.0 in OSX you need to use:

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py2-none-any.whl

instead of

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py2-none-any.whl


回答9:

Install Python 3.5.x 64 bit amd version here. Make sure you add Phython to your PATH variable. Then open a command prompt and type

python -m pip install --upgrade pip

should give you the following result :

 Collecting pip
 Using cached pip-9.0.1-py2.py3-none-any.whl
 Installing collected packages: pip
 Found existing installation: pip 7.1.2
 Uninstalling pip-7.1.2:
 Successfully uninstalled pip-7.1.2
 Successfully installed pip-9.0.1

Now type

 pip3 install --upgrade tensorflow


回答10:

I had the same error when trying to install on my Mac (using Python 2.7). A similar solution to the one I\'m giving here also seemed to work for Python 3 on Windows 8.1 according to a different answer on this page by Yash Kumar Verma

Solution

Step 1: go to The URL of the TensorFlow Python package section of the TensorFlow installation page and copy the URL of the relevant link for your Python installation.

Step 2: open a terminal/command prompt and run the following command:
pip install --upgrade [paste copied url link here]

So for me it was the following:
pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.2.0-py2-none-any.whl

Update (July 21 2017): I tried this with some others who were running on Windows machines with Python 3.6 and they had to change the line in Step 2 to: python -m pip install [paste copied url link here]

Update (26 July 2018): For Python 3.6.2 (not 3.7 because it\'s in 3.6.2 in TF Documentation), you can also use pip3 install --upgrade [paste copied URL here] in Step 2.



回答11:

Try this:

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py3-none-any.whl
pip3 install --upgrade $TF_BINARY_URL

Source: https://www.tensorflow.org/get_started/os_setup (page no longer exists)

Update 2/23/17 Documentation moved to: https://www.tensorflow.org/install



回答12:

  1. Install python by checking Add Python to Path
  2. pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

This works for windows 10.0



回答13:

I had the same problem. After uninstalling the 32-bit version of python and reinstalling the 64-bit version I tried reinstalling TensorFlow and it worked.

Link to TensorFlow guide: https://www.tensorflow.org/install/install_windows



回答14:

Try this, it should work:

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


回答15:

Unfortunately my reputation is to low to command underneath @Sujoy answer.

In their docs they claim to support python 3.6. The link provided by @mayur shows that their is indeed only a python3.5 wheel package. This is my try to install tensorflow:

Microsoft Windows [Version 10.0.16299.371]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\\>python3 -m pip install --upgrade pip
Requirement already up-to-date: pip in d:\\python\\v3\\lib\\site-packages (10.0.0)

C:\\>python3 -m pip -V
pip 10.0.0 from D:\\Python\\V3\\lib\\site-packages\\pip (python 3.6)

C:\\>python3 -m pip install --upgrade tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

while python 3.5 seems to install successfully. I would love to see a python3.6 version since they claim it should also work on python3.6.

Quoted :

\"TensorFlow supports Python 3.5.x and 3.6.x on Windows. Note that Python 3 comes with the pip3 package manager, which is the program you\'ll use to install TensorFlow.\"

Source : https://www.tensorflow.org/install/install_windows

Python3.5 install :

Microsoft Windows [Version 10.0.16299.371]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\\>python3 -m pip install --upgrade pip
Requirement already up-to-date: pip in d:\\python\\v3\\lib\\site-packages (10.0.0)

C:\\>python3 -m pip -V
pip 10.0.0 from D:\\Python\\V3_5\\lib\\site-packages\\pip (python 3.5.2)

C:\\>python3 -m pip install --upgrade tensorflow
Collecting tensorflow
  Downloading 
    ....
    ....

I hope i am terrible wrong here but if not ring a alarm bell