ChatGPT解决这个技术问题 Extra ChatGPT

TensorFlow not found using pip

I'm trying to install 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.

try this: pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.1-py2-none-any.whl
The correct way to install it would be code'$ pip install --upgrade TF_BINARY_URL # Python 2.7 $ pip3 install --upgrade TF_BINARY_URL # Python 3.Ncode`
For me this happens with python 3.7, After hours of struggle I used 3.6 and that worked.
Use Anaconda for tensorflow installation
Currently facing the same problem in Python3.9 . In python3.8 , it works fine

h
halfer

I found this to finally work.

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

Edit 1: This was tested on Windows (8, 8.1, 10), Mac and Linux. Change python3 to python according to your configuration. Change py3 to py2 in the url if you are using Python 2.x.

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

Edit 3: A list of urls for the available wheel packages is available here: https://www.tensorflow.org/install/pip#package-location


This may be the right answer, but users please note that this command is for Mac only, not linux.
That's is wierd. As the URL which u have specified mentions Mac & if you try to use this url it will install. But tensorflow will actually not work.
The windows version of the URL (for v.1.2.1) is storage.googleapis.com/tensorflow/windows/cpu/…. This only works with the AMD64 version of Python. A full list of tensorflow versions is here: storage.googleapis.com/tensorflow
tensorflow only supports python 64-bit. You might be using 32-bit installation. Install 64-bit python and it works with pip install tensorflow directly. Refer to the correct answers below before trying this approach.
You can find the respective storage link here: tensorflow.org/install/pip
P
Pikamander2

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.8.x on Windows. See the install docs to see what is currently supported

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.

From comments:

To download a different version of Python for Windows, go to python.org/downloads/windows and scroll down until you see the version you want that ends in a "64". That will be the 64 bit version that should work with tensorflow


>>> import platform;print(platform.architecture()) ('64bit', 'WindowsPE') but still I am seeing this exception
Suspicious of the "top" answer; this seems simple, intuitive, fast and safe by comparison. Tested ok with Python 3.6.4 on Windows 7.
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 type you are running.
My problem turned out to be that Tensorflow at this time does not yet support Python 3.7 (it supports up to 3.6.x). After doing more reading through Github issues where it has been requested, it seems support will probably be out soon.
Are the supported python versions documented anywhere?
N
Null

You need to use the right version of Python and pip.

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

https://i.stack.imgur.com/cABEM.jpg

If we download Python from python.org, the default installation would be 32 bit. So we have to download the 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 the Python command doesn't work for 64 bit then 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

October 2020 update:

Tensorflow now supports Python 3.5.x through Python 3.8.x, but you still have to use a 64-bit version.

If you need to run multiple versions of Python on the same machine, you can use a virtual environment to help manage them.


While providing a link that may answer the question is fine, but it will be better if you can also include the necessary explanation here in the answer itself. Link may not work in the near future for any number of reasons say author removes/changes the pages, etc.
I did not realise I had installed Python 3.6.x 32-bit version on my 64-bit machine. Need to uninstall that and follow your instruction in this post. All works now. Thank you!
Thanks. To simplify this answer 2 points helped me 1.) use 64 bit version. 2.) Only python 3.5 and 3.6 are supported. Don't try use 3.7
Thanks for the Oct 2020 update - I successfully installed tensorflow on python 3.8.5
No support for python 3.9 so if that's your version your sol atm.
B
Bang

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

$ pip3 --version pip 9.0.1 from c:\work\apps\python\lib\site-packages (python 3.6) But still I see this error.
tensorflow does not work with python 3.6. You need version 3.5
Also, I had to use python -m pip install --upgrade pip. Otherwise I would get file permission issues...
why not python 3.6 (latest version ),but python 3.5( lower version ) works It does'nt make any sense @Jodo
@guru_007 they stick to the version available on the latest Ubuntu LTS which is 3.5 at the moment (16.04) as far as I know.
C
Community

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.


S
Sujoy

I figured out that TensorFlow 1.12.0 only works with Python version 3.5.2. I had Python 3.7 but that didn't work. So, I had to downgrade Python and then I could install TensorFlow to make it work.

To downgrade your python version from 3.7 to 3.6

conda install python=3.6.8

how to downgrade v3.6 to v3.5.2 ?
Install 3.5.2 and update your classpath to point to 3.5.2. You can change back to 3.6 for other python stuff.
RuntimeWarning: compile time version 3.6 of module 'tensorflow.python.framework.fast_tensor_u til' does not match runtime version 3.7.... It is due to this error it is unable to fetch
At time of writing this comment, python 3.7 was compatible with tensorflow, but python 3.8 was not.
You can (and should) also use multiple virtual environments for that purpose instead of downgrading like here: stackoverflow.com/a/45750900/4575793
m
mrry

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

will it work or will I need to setup other things also according to what tensorflow.org/versions/r0.10/get_started/os_setup.html says?
I still get the same error on OSX, is it working for everyone else?
@lemonzi, I also had an error in OSX, just posted a solution that worked for me (solution was to make sure I had Python 3.6 installed)
@JuliaSchwarz This was not the issue; I'm using Python 2.7, and I also tried with a fresh install of Python 3.6. I ended up specifying the URL manually for the 1.0.0 alpha and it worked.
After trying every other solution, this worked for me. I'm using Python 2.7 on linux.
a
ascripter

Install Python 3.5.x 64 bit amd version here. Make sure you add Python 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

Fatal error in launcher: Unable to create process using '"'
A
Andres

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

Consider having a look at this: github.com/fo40225/tensorflow-windows-wheel
I
Infinite Loops

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.


This solution installs, but when I import tensorflow I get an error:
I've only used Keras with Tensorflow as a backend and it works fine. What error message do you get?
Just tested and tensorflow imports fine for me.
My problem was the version of Python I was using. I didn't know Python 3.5 was a requirement. Now it works. Thanks for the tip.
Great to hear that it worked in the end. If you had to do something different it would be worth you posting a separate answer. Otherwise, if you could give my answer an upvote that would be great. I struggled for a while to find a solution that worked so doing either one of the two will hopefully help others
D
David

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


D
Dinesh Karn

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

This works for windows 10.0


H
HISI

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

S
Stephen

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


yes, the 64-bit version fixed it. The install from the main download page is a 32-bit. The link above provides a URL to the 64 bit version.
z
zinc

If you run into this issue recently (say, after Python 3.7 release in 2018), most likely this is caused by the lack of Python 3.7 support (yet) from the tensorflow side. Try using Python 3.6 instead if you don't mind. There are some tricks you can find from https://github.com/tensorflow/tensorflow/issues/20444, but use them at your own risk. I used the one harpone suggested - first downloaded the tensorflow wheel for Python 3.6 and then renamed it manually...

cp tensorflow-1.11.0-cp36-cp36m-linux_x86_64.whl tensorflow-1.11.0-cp37-cp37m-linux_x86_64.whl
pip install tensorflow-1.11.0-cp37-cp37m-linux_x86_64.whl

The good news is that there is a pull request for 3.7 support already. Hope it will be released soon.


c
craq

There are multiple groups of answers to this question. This answer aims to generalize one group of answers:

There may not be a version of TensorFlow that is compatible with your version of Python. This is particularly true if you're using a new release of Python. For example, there may be a delay between the release of a new version of Python and the release of TensorFlow for that version of Python.

In this case, I believe your options are to:

Upgrade or downgrade to a different version of Python. (Virtual environments are good for this, e.g. conda install python=3.6) Select a specific version of tensorflow that is compatible with your version of python, e.g. if you're still using python3.4: pip install tensorflow==2.0 Compile TensorFlow from the source code. Wait for a new release of TensorFlow which is compatible with your version of Python.


This page will show you which versions of tensorflow are compatible with which versions of python and CUDA: tensorflow.org/install/source#gpu
A
Ahmed

as of today, if anyone else is wondering, python >= 3.9 will cause the same issue uninstall python 3.9, and install 3.8 , it should resolve it


You don't have to uninstall python. You can have multiple versions! Just invoke the correct pip with python3.8 -m pip install tensorflow
True. but for someone doing generic python, only using it occasionally , without a clear need to a specific version, I would prefer having a single version. just an opinion :)
t
tallamjr

If you are using the Anaconda Python installation, pip install tensorflow will give the error stated above, shown below:

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

According to the TensorFlow installation page, you will need to use the --ignore-installed flag when running pip install.

However, before this can be done see this link to ensure the TF_BINARY_URL variable is set correctly in relation to the desired version of TensorFlow that you wish to install.


A
ACV

If you're trying to install tensorflow in anaconda and it isn't working, then you may need to downgrade python version because only 3.6.x is currently supported while anaconda has the latest version.

check python version: python --version if version > 3.6.x then follow step 3, otherwise stop, the problem may be somewhere else conda search python conda install python=3.6.6 Check version again: python --version If version is correct, install tensorflow (step 7) pip install tensorflow


C
Christopher Moore

Following these steps allows you to install tensorflow and keras:

Download Anaconda3-5.2.0 which comes with python 3.6 from https://repo.anaconda.com/archive/ Install Anaconda and open Anaconda Prompt and execute below commands conda install jupyter conda install scipy pip install sklearn pip install msgpack pip install pandas pip install pandas-datareader pip install matplotlib pip install pillow pip install requests pip install h5py pip install tensorflow pip install keras


The question is about standard Python and just tensorflow.
C
Cadoiz

For pyCharm users:

Check pip version: pip3 -V If pip is older than 9.0.1: py -3 -m pip install --upgrade pip Then: py -3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl


Be aware, that the given link is just for one single legacy version. For the different possible versions of python and tensorflow, you can refer to my answer here: stackoverflow.com/a/62855139/4575793 A huge list of different wheels/compatibilities can be found here: github.com/fo40225/tensorflow-windows-wheel
0
0x78f1935

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 😛

Edit: A couple of posts below someone pointed out that the following command would work and it did.

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

Strange pip is not working 🤔


M
Mof

Tensorflow DOES NOT support python versions after 3.8 as of when I'm writing this at least (December 2020). Use this: https://www.tensorflow.org/install to check what python versions it supports, I just spent hours looking through these answers, took me way too long to realise that.


F
Floern

This worked for me with Python 2.7 on Mac OS X Yosemite 10.10.5:

sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl

C
Croko

Start Command Prompt with Administrative Permission Enter following command python -m pip install --upgrade pip Next Enter command pip install tensorflow


error: Fatal error in launcher: Unable to create process using '"'
C
Cadoiz

update 2019: for install the preview version of TensorFlow 2 in Google Colab you can use:

!wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64 -O cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
!dpkg -i cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
!apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub
!apt-get update
!apt-get install cuda
!pip install tf-nightly-gpu-2.0-preview

and for install the TensorFlow 2 bye pip you can use: pip install tf-nightly-gpu-2.0-preview for GPU and pip install tf-nightly-2.0-preview for CPU.


Thank you for the reminder to try the nightly tensorflow (unstable) version. That worked for me.
s
sauravjoshi23

I installed tensorflow on conda but didnt seem to work on windows but finally this command here works fine on cmd.

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

b
barismanco

if you tried the solutions above and didin't solve the problem, it can be because of version inconsistency.

I installed python 3.9 and i couldn't install tensorflow with pip.

And then I uninstalled 3.9, then installed 3.8.7 and success... the max version that tensorflow is supported by is 3.8.x (in 2021) so, check your python version is compatible or not with current tensorflow.


k
kavini

I was facing the same issue. I tried the following and it worked. installing for Mac OS X, anaconda python 2.7

pip uninstall tensorflow export TF_BINARY_URL=<get the correct url from http://tflearn.org/installation/> pip install --upgrade $TF_BINARY_URL

Installed tensorflow-1.0.0


N
NEELAMADHAB

The URL to install TensorFlow in Windows, below is the URL. It worked fine for me.

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