I am using tensorflow with python 2.7. However, after updating python 2.7.10 to 2.7.13, I get an import error with tensorflow
File "", line 1, in File "/Users/usrname/Library/Python/2.7/lib/python/site- packages/tensorflow/__init__.py", line 24, in from tensorflow.python import * File "/Users/usrname/Library/Python/2.7/lib/python/site- packages/tensorflow/python/__init__.py", line 63, in from tensorflow.core.framework.graph_pb2 import * File "/Users/usrname/Library/Python/2.7/lib/python/site- packages/tensorflow/core/framework/graph_pb2.py", line 6, in from google.protobuf import descriptor as _descriptor ImportError: No module named google.protobuf
Output from pip install protobuf
Requirement already satisfied: protobuf in /usr/local/lib/python2.7/site-packages Requirement already satisfied: setuptools in /Users/usrname/Library/Python/2.7/lib/ python/site-packages (from protobuf) Requirement already satisfied: six>=1.9 in /Library/Python/2.7/site-packages/ six-1.10.0-py2.7.egg (from protobuf) Requirement already satisfied: appdirs>=1.4.0 in /usr/local/lib/python2.7/site-packages (from setuptools->protobuf) Requirement already satisfied: packaging>=16.8 in /usr/local/lib/python2.7/site-packages (from setuptools->protobuf) Requirement already satisfied: pyparsing in /usr/local/lib/python2.7/site-packages (from packaging>=16.8->setuptools->protobuf)
Output from which python
:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
I believe this path changed after the python update, but not sure. A solution could possibly be to downgrade python, but this seems like a bad solution? As I work in a team, I would like to avoid reinstalling Tensorflow due to end up with different versions, but this is perhaps the way to go? Any advice?
Update: I tired to install tensorflow all over, but the same error keeps popping up. Maybe the problem is the environment variables as which pip
returns /usr/local/bin/pip
(which is different from which python)?
virtualenv
. The "nuclear" option is to usedocker
and do everything in a container. – drpng/usr/local/bin/python -c "import tensorflow"
? – Mikael Rousson