Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS X El Capitan Tensorflow 0.6 upgrade error #500

Closed
jwnsu opened this issue Dec 13, 2015 · 21 comments
Closed

MacOS X El Capitan Tensorflow 0.6 upgrade error #500

jwnsu opened this issue Dec 13, 2015 · 21 comments

Comments

@jwnsu
Copy link

jwnsu commented Dec 13, 2015

Had a good-running 0.5 tensor flow, now upgrade to 0.6 with command line from Google instruction:
"sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py2-none-any.whl", run into following exception:
"Installing collected packages: setuptools, protobuf, wheel, tensorflow
Found existing installation: setuptools 1.1.6
Uninstalling setuptools-1.1.6:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 716, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_uninstall.py", line 125, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/utils/init.py", line 315, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
copytree(src, real_dst, symlinks=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py', '/tmp/pip-XBiBee-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py', "[Errno 1] Operation not permitted: '/tmp/pip-XBiBee-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.pyc', '/tmp/pip-XBiBee-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-XBiBee-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-XBiBee-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-XBiBee-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-XBiBee-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-XBiBee-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-XBiBee-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-XBiBee-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]

It's stock Mac python 2.7.10 (without ipython).

@jwnsu
Copy link
Author

jwnsu commented Dec 13, 2015

Seems to be caused by new feature "System Integrity Protection"(SIP) in El Capitan. What's the best way to work-around it? There is an option to disable the SIP, but seems risky. It's possible to try virtual env. But is there a way in Mac stock python? After all, 0.5 version was working fine there.

@migel
Copy link

migel commented Dec 13, 2015

As a workaround you can try using homebrew python. It works for me with 2.7.11.

@jwnsu
Copy link
Author

jwnsu commented Dec 14, 2015

Thanks. homebrew python 2.7.11 works well with 0.6 tensorflow.

@jwnsu jwnsu closed this as completed Dec 14, 2015
@dragonjohn
Copy link

After I update python 2.7.11 through homebrew, I still can't solve this problem.

@dragonjohn
Copy link

Finally I found out the root cause is that I install pip via easy_install before and then install homebrew python. The system version of pip would be called when you install tensorflow by pip.

You can uninstall easy_install and re-install python through homebrew, and then it works.

@martin-gorner
Copy link

adding "--ignore-installed six" to the "sudo pip install" command solved the problem for me

@oleksandrasaskia
Copy link

@martin-gorner Thanks!! I was able to install by adding "--ignore-installed six".
Got the message: "Successfully installed numpy-1.8.0rc1 protobuf-2.6.1 setuptools-1.1.6 six-1.10.0 tensorflow-0.6.0 wheel-0.26.0"

@zackmoy
Copy link

zackmoy commented Feb 2, 2016

Thanks, @martin-gorner!

@mgottsch1
Copy link

Hello, I am still getting the error(s) described above, which I presume means that tensorflow 0.6 is not installing, would appreciate any further help.

This is my first attempt at tf, and I have not had a successful installation, e.g. tf 0.5 as jwnsu did.

I am using:
El Capitan (10.11.2);

pip 7.1.0 (doesn’t seem to allow to upgrade further, e.g. to 7.1.2 as I’ve seen others using, or 8.0.2 as the system says is available);

python 2.7.10

I did this:
$ sudo -H pip install --ignore-installed six

and got this:

"You are using pip version 7.1.0, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting six
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.10.0"

I did this:

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

And got this (i.e. the same error messages):

"The directory '/Users/_my name_/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
You are using pip version 7.1.0, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The directory '/Users/m**my name**/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting tensorflow==0.6.0 from https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py2-none-any.whl
Downloading https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py2-none-any.whl (10.2MB)
100% |████████████████████████████████| 10.2MB 50kB/s
Requirement already up-to-date: six>=1.10.0 in /Library/Python/2.7/site-packages (from tensorflow==0.6.0)
Collecting protobuf==3.0.0a3 (from tensorflow==0.6.0)
Collecting wheel (from tensorflow==0.6.0)
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |████████████████████████████████| 69kB 1.2MB/s
Collecting numpy>=1.8.2 (from tensorflow==0.6.0)
Downloading numpy-1.10.4-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.7MB)
100% |████████████████████████████████| 3.7MB 128kB/s
Collecting setuptools (from protobuf==3.0.0a3->tensorflow==0.6.0)
Downloading setuptools-19.7-py2.py3-none-any.whl (472kB)
100% |████████████████████████████████| 475kB 713kB/s
Installing collected packages: setuptools, protobuf, wheel, numpy, tensorflow
Found existing installation: setuptools 1.1.6
Uninstalling setuptools-1.1.6:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 299, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 640, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 726, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 125, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/init.py", line 314, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
copytree(src, real_dst, symlinks=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py', '/tmp/pip-6s30U8-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py', "[Errno 1] Operation not permitted: '/tmp/pip-6s30U8-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.pyc', '/tmp/pip-6s30U8-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-6s30U8-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/init.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-6s30U8-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-6s30U8-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-6s30U8-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-6s30U8-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-6s30U8-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-6s30U8-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'”)]"

@oleksandrasaskia
Copy link

@mgottsch1 You will not be able to install directly using pip (at least, judging from my experience) because El Capitan introduced System Integrity Protection, which does not allow such things.

I was able to install tensorflow in virtual env. So far, it runs great.

Additional tip (just in case): you could use jupyter notebook (which is also impossible to install directly using pip) for writing code.

@mgottsch1
Copy link

Thank you Oleksandra28, virtualenv did the trick. Brilliant!

On Feb 7, 2016, at 9:36 PM, Oleksandra28 notifications@github.com wrote:

@mgottsch1 https://github.com/mgottsch1 You will not be able to install directly using pip (at least, judging from my experience) because El Capitan introduced System Integrity Protection, which does not allow such things.

I was able to install tensorflow in virtual env https://www.tensorflow.org/versions/0.6.0/get_started/os_setup.html#virtualenv_install. So far, it runs great.

Additional tip (just in case): you could use jupyter notebook (which is also impossible to install directly using pip) for writing code.


Reply to this email directly or view it on GitHub #500 (comment).

@1337newbee
Copy link

The command below works for me
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.1-cp27-none-any.whl --ignore-installed six

We should update the documentation here to avoid confusion.
https://www.tensorflow.org/versions/r0.7/get_started/os_setup.html

@imikay
Copy link

imikay commented Mar 18, 2016

The command above works for me too.

@sandwriter
Copy link

--ignore-installed six works for me as well. Thanks!

@hussam123
Copy link

nothing works for me !

@erwincoumans
Copy link

erwincoumans commented Apr 24, 2016

Similar, also got stuck installing tensorflow on Mac OSX El Captain.
The numpy version on El Caption is incompatible, and it is non-trivial to update numpy using pip.
"RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9"

Collecting tensorflow==0.7.1 from https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.1-cp27-none-any.whl
Downloading https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.1-cp27-none-any.whl (11.6MB)
100% |████████████████████████████████| 11.6MB 119kB/s
Collecting six
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting protobuf==3.0.0b2 (from tensorflow==0.7.1)
Downloading protobuf-3.0.0b2-py2.py3-none-any.whl (326kB)
100% |████████████████████████████████| 327kB 1.2MB/s
Collecting wheel (from tensorflow==0.7.1)
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |████████████████████████████████| 71kB 10.9MB/s
Collecting numpy>=1.10.1 (from tensorflow==0.7.1)
Downloading numpy-1.11.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.9MB)
100% |████████████████████████████████| 3.9MB 333kB/s
Collecting setuptools (from protobuf==3.0.0b2->tensorflow==0.7.1)
Downloading setuptools-20.9.0-py2.py3-none-any.whl (508kB)
100% |████████████████████████████████| 512kB 961kB/s
Installing collected packages: six, setuptools, protobuf, wheel, numpy, tensorflow
Successfully installed numpy-1.8.0rc1 protobuf-3.0.0b2 setuptools-1.1.6 six-1.10.0 tensorflow-0.8.0 wheel-0.29.0
[~]$ 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 "", line 1, in
File "/Users/erwincoumans/Library/Python/2.7/lib/python/site-packages/tensorflow/init.py", line 23, in
from tensorflow.python import *
File "/Users/erwincoumans/Library/Python/2.7/lib/python/site-packages/tensorflow/python/init.py", line 45, in
from tensorflow.python import pywrap_tensorflow
File "/Users/erwincoumans/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "/Users/erwincoumans/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import

@litstrong
Copy link

--ignore-installed six works for me too. Thanks!

@GodaiAoki
Copy link

Thank you 1337newbee, that command works for me.

@lasergoat
Copy link

lasergoat commented Jun 6, 2016

@erwincoumans and anyone else getting the error about:

"RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9"

Simple answer:

run sudo easy_install numpy to update to the correct numpy location.

Long answer:

I found some good info here, specifically here.

This error occurs when there are two versions of numpy. Removing one doesn't work either. A guy suggests running this in python:

import numpy
print numpy.__path__

To tell you which numpy path it's using and the sudo rm -rfing the directory, but operation will not be permitted. So alternatively, by running the command below, it will overwrite to the latest numpy path.

sudo easy_install numpy

Now, when you import tensorflow as tf it should find the right numpy.

@jeffreydwalter
Copy link

sudo easy_install numpy fixed the problem for me. Thanks!

@allonli
Copy link

allonli commented Nov 2, 2016

sudo easy_install --upgrade numpy fixed the problem for me.Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests