Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pip install tensorflow on El Capitan?

It appears that El Capitan's system integrity protection is preventing me from following the instructions for getting Tensorflow running on OSX.

I've followed the installation guide but the final install step fails:

sudo pip install --upgrade $TF_BINARY_URL

fails with:

Uninstalling numpy-1.8.0rc1:
...
OSError: [Errno 1] Operation not permitted

I've managed to get past that by ignoring the installation of six:

sudo pip install --upgrade $TF_BINARY_URL --ignore-installed six

But now testing my installation does not work:

$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
....
ImportError: numpy.core.multiarray failed to import
like image 377
Mark McDonald Avatar asked Jun 14 '16 11:06

Mark McDonald


People also ask

Can you install TensorFlow with pip?

TensorFlow requires a recent version of pip, so upgrade your pip installation to be sure you're running the latest version. Then, install TensorFlow with pip. Note: Do not install TensorFlow with conda. It may not have the latest stable version.

Does Python 3.7 support TensorFlow?

TensorFlow is tested and supported on the following 64-bit systems: Python 3.7–3.10. Ubuntu 16.04 or later. Windows 7 or later (with C++ redistributable)

Does Python 3.8 supports TensorFlow?

Tensorflow does not support Python 3.8 at the moment. The latest supported Python version is 3.7.


1 Answers

I managed to get it working by using easy_install to upgrade numpy. This seems like a nasty mess so I'd love to either hear a better solution, or have someone explain to me why this is fine.

The command, for those playing along:

sudo easy_install numpy
like image 123
Mark McDonald Avatar answered Oct 18 '22 18:10

Mark McDonald