61

when I try to install TensorFlow by cloning from Git, I run into the error "no module named copyreg," so I tried installing using a virtualenv. However, I then run into this error:

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

tensorflow-0.5.0-py2-none-any.whl is not a supported wheel on this platform.

I don't see this under the common problems section.

I am using OS X v10.10.5 (Yosemite) and Python 3.4.3, but I also have Python 2.7 (I am unsure if pip differentiates between these or how to switch between them).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Peter Qiu
  • 932
  • 2
  • 7
  • 13
  • Which OS version and Python version do you have on your machine? – mrry Nov 10 '15 at 05:20
  • Using OS X Yosemite 10.10.5 and python 3.4.3, but I also have python 2.7 (unsure if pip differentiates between these or how to switch between them) – Peter Qiu Nov 10 '15 at 07:19
  • 1
    Same problem here: http://askubuntu.com/questions/695981/platform-not-supported-for-tensorflow-on-ubuntu-14-04-2 – alvas Nov 10 '15 at 10:44

15 Answers15

56

I too got the same problem.

I downloaded get-pip.py from https://bootstrap.pypa.io/get-pip.py and then ran python2.7 get-pip.py for installing pip2.7.

And then ran the pip install command with python2.7 as follows.

For Ubuntu/Linux:

python2.7 -m pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

For Mac OS X:

python2.7 -m pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl

This should work just fine as it did for me :)

I followed these instructions from here.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sasidhar Boddeti
  • 1,214
  • 1
  • 11
  • 22
  • 2
    Thank you! Just changed the link to https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl and it works fine (for now) – Peter Qiu Nov 11 '15 at 06:38
  • 1
    you are welcome :) and thank you for pointing out the link for mac OS edited the answer – Sasidhar Boddeti Nov 11 '15 at 15:13
  • 2
    For those who use vmware under Windows, the `get-pip.py` file downloaded in Windows will get `not a supported wheel on this platform` error in Ubuntu as well. – John Hany Mar 31 '16 at 07:24
  • This did not fix the problem for me using virtualbox instead of vmware – dtracers Apr 04 '16 at 17:08
  • I'm facing same problem on my Windows PC too, what shall I do? I didn't get any sophisticated answer of it. Is there anyone here to help me. – Ananda G Mar 02 '17 at 08:03
  • 3
    The key for me was `python -m pip`. Running pip directly didn't work, but loading it as a module did. – kris Mar 21 '17 at 16:31
25

After activating the virtualenv, be sure to upgrade pip to the latest version.

(your_virtual_env)$  pip install --upgrade pip

And now you'll be able to install TensorFlow correctly (for Linux):

(your_virtual_env)$  pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.0-py2-none-linux_x86_64.whl
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
learn2day
  • 1,566
  • 1
  • 14
  • 17
12

I was trying to do the Windows-based install and kept getting this error.

It turns out you have to have Python 3.5.2. Not 2.7, not 3.6.x-- nothing other than 3.5.2.

After installing Python 3.5.2, the pip install worked.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Micah
  • 10,295
  • 13
  • 66
  • 95
  • Hi, I encountered the same problem. I followed your instructions but it seems that it didn't help... It still writes "tensorflow... is not a supported wheel on this platform" – Eli Borodach Mar 05 '17 at 13:02
  • Yea, I bypassed the error that read `tensorflow-1.2.1-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.`. The installation went through though. Thnx – Anonymous Person Jul 02 '17 at 15:17
11

Make sure that the wheel is, well, supported by your platform. Pip uses the wheel's filename to determine compatibility. The format is:

tensorflow-{version}-{python version}-none-{your platform}.whl

I didn't realize that x86_64 refers to x64, I thought it meant either x86 or x64, so I banged my head against this futilely for some time. TensorFlow is not available for 32-bit systems, unless you want to compile it yourself.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jack M
  • 4,769
  • 6
  • 43
  • 67
7

It seems that TensorFlow only works on Python 3.5 at the moment. Try to run this command before running the pip install

conda create --name tensorflow python=3.5

After this, run the following lines:

For CPU:

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl

For GPU:

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.1.0-cp35-cp35m-win_amd64.whl

It should work like a charm.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Fitch
  • 1,084
  • 1
  • 11
  • 17
5

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

Installation requirements

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

  1. C:\Users<username>\AppData\Local\Programs\Python\Python36
  2. C:\Users<username>\AppData\Local\Programs\Python\Python36\Scripts

Then run gpupdate /Force on the command prompt. If the Python command doesn’t work for 64 bit, restart your machine.

Then run the Python interpreter on the command prompt. It should show 64 bit

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 the below command to install the TensorFlow CPU version (recommended)

pip3 install --upgrade tensorflow
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Morse
  • 8,258
  • 7
  • 39
  • 64
3

The pip wheel file contains the Python version in its name (cp34-cp34m). If you download the .whl file and rename it to say py3-none or instead, it should work. Can you try that?

The installation won't work for Anaconda users that choose Python 3 support, because the installation procedure is asking to create a Python 3.5 environment and the file is currently called cp34-cp34m. So renaming it would do the job for now.

sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.7.0-cp34-cp34m-linux_x86_64.whl

This will produce the exact error message you got above. However, when you will download the file yourself and rename it to "tensorflow-0.7.0-py3-none-linux_x86_64.whl", then execute the command again with the changed filename, it should work fine.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Abhishek Kumar
  • 191
  • 2
  • 6
2

For Windows 10 64 bit:

I have tried all the suggestions here, but finally I got it running as follows:

  1. Uninstall all current versions of Python
  2. Remove all Python references in the PATH system and user environment variables
  3. Download the latest 64-bit version of Python 3.8: Python 3.8.7 currently, not the latest 3.9.x version which is the one I was using, and not 32 bit.
  4. Install with all options selected, including pip, and including the PATH environment variable
  5. pip install tensorflow (in an administrator CMD prompt)
  6. Upgrade pip if prompted (optional)
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Inksaver
  • 41
  • 3
  • This worked for me with Python 3.8.10. pip downloaded the following: tensorflow-2.6.0-cp38-cp38-win_amd64.whl Looks like this may have worked for 3.9 now, as I see a URL for 3.9 support in the tensorflow install instructions. I was initially trying with python 3.10 – vimal-k Oct 16 '21 at 07:45
1

Actually, you can use Python 3.5.*.

I successfully solved this problem with Python 3.5.3. Modify the Python version to 3.5.* in Conda. See Managing Python.

Then go to https://www.tensorflow.org/install/install_windows, and repeat from "Create a Conda environment named tensorflow by invoking the following command" bla, bla...

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
dan
  • 119
  • 1
  • 5
0

I was trying to install from source and got that error. (Why would a wheel built on this machine not be compatible with it?)

For me, the tag --ignore-installed made all the difference.

pip install --ignore-installed /tmp/tensorflow_pkg/tensorflow-1.8.0-cp36-cp36m-linux_x86_64.whl

worked, while

pip install /tmp/tensorflow_pkg/tensorflow-1.8.0-cp36-cp36m-linux_x86_64.whl

threw the abovementioned error.

Context: Conda environment; it might have been a problem specific to this

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
dasWesen
  • 579
  • 2
  • 11
  • 28
0

Maybe you are installing the wrong pre-build binary?

Check on https://github.com/lakshayg/tensorflow-build

For my Coffee Lake processor on Ubuntu 18.04 (Bionic Beaver) the download URL was:

https://github.com/lakshayg/tensorflow-build/releases/download/tf1.12.0-ubuntu18.04-py2-py3/tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl

pip install --ignore-installed --upgrade <PATH>

resolved the issue for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

I faced the same issue and tried all the solutions that folks suggested here and other links (like Platform not supported for TensorFlow on Ubuntu 14.04.2).

It was so frustrating because using print(wheel.pep425tags.get_supported()) I could see that my Ubuntu supported ('cp37', 'cp37m', 'linux_x86_64') and that was exactly what I was trying to install (from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.14.0-cp37-cp37m-linux_x86_64.whl).

What at the end fixed it was to simply download the package first and then

pip install tensorflow-1.14.0-cp37-cp37m-linux_x86_64.whl
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
pedram bashiri
  • 1,286
  • 15
  • 21
0

I was trying to install CPU TensorFlow on Ubuntu 18.04 (Bionic Beaver), and the best way (for me...) I found for it was using it on top of Conda, for that:

  1. To create a Conda ‘tensorflow’ environment. Follow How to Install Anaconda on Ubuntu 18.04

  2. After all is installed, see Getting started with conda. And use it according to Managing environments

  3. conda create --name tensorflow

  4. source activate tensorflow

  5. pip install --upgrade pip

  6. pip uninstall tensorflow

  7. For CPU: pip install tensorflow-cpu, for GPU: pip install tensorflow

  8. pip install --ignore-installed --upgrade tensorflow

  9. Test TF E.g. on 'Where' with:

python

import tensorflow as tf

>>> tf.where([[True, False], [False, True]])

Expected result:

<tf.Tensor: shape=(2, 2), dtype=int64, numpy=
array([[0, 0],
       [1, 1]])>
  • After the Conda upgrade, I got:

    DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.
    

So you should use:

‘conda activate tensorflow’ / ‘conda deactivate’
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
GM1
  • 380
  • 3
  • 14
0

It means that the version of your default Python interpreter (python -V) and the version of your default pip (pip -V) do not match. You have built TensorFlow with your default Python interpreter and trying to use a different pip version to install it.

In Mac, delete /usr/local/bin/pip and rename (copy) pipx.y (whatever x.y version that matches your Python version) to pip in that folder.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sohrab
  • 181
  • 2
  • 4
0

This worked for me.

system requirement Python 3.7–3.10

macOS 10.12.6 (Sierra) or later (no GPU support)

pip install tensorflow-macos
shakthydoss
  • 2,551
  • 6
  • 27
  • 36