After successfully pip install
, importing the tensorflow library fails.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/tensorflow/__init__.py", line 4, in <module>
from tensorflow.python import *
File "/Library/Python/2.7/site-packages/tensorflow/python/__init__.py", line 13, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/Library/Python/2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 8, in <module>
from google.protobuf import reflection as _reflection
File "/Library/Python/2.7/site-packages/google/protobuf/reflection.py", line 58, in <module>
from google.protobuf.internal import python_message as message_impl
File "/Library/Python/2.7/site-packages/google/protobuf/internal/python_message.py", line 59, in <module>
import six.moves.copyreg as copyreg
ImportError: No module named copyreg
You can upgrade to six-1.10.x using
easy_install -U six
This will upgrade the current version of six from 1.4 to 1.10.x, that is required by tensorflow.
Solution: TensorFlow depends on protobuf which require six-1.10.0. Apple's default python environment has six-1.4.1 and may be difficult to upgrade. So we recommend either installing a separate copy of python via homebrew:
brew install python
or building / using TensorFlow within virtualenv as described above.
copyreg
is a python3
function that is available in the six
module in python2.x
, see https://docs.python.org/2/library/copy_reg.html#module-copy_reg
To get copyreg
, you have to install six
:
pip install -U six
(Note: In python2
, you access can either access the function with (i) six.copy_reg
or when a module is imported with six.moves.*
, it keeps the python3
syntax, i.e. six.moves.copyreg
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With