install tensorflow 2 problematic

Viewed 627

I would like practicing tensorflow 2, but my tries to install it in an anaconda environment failed.

My question is: how do you install tensorflow 2 ? If it can be done in an anaconda environment it seems to me more convenient. I don't need to understand the error message below as long as I can use tensorflow 2.

  • First, I found an installation with pip, not conda

  • Second, pip gives me a lot of errors: each time I have the feeling I turned around one, another shows up... The best I did, I think is (in a py36 environment): pip install --upgrade --ignore-installed wrapt tensorflow==2.0.0-beta1. Indeed, after having uninstalled tb-nightly, notebook & jupyter, this command runs without apparent error/warning. However, an import tensorflow in python gives me this error:

Traceback (most recent call last):
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: dlopen(/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _SecKeyCopyExternalRepresentation
  Referenced from: /Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/../libtensorflow_framework.2.dylib
  Expected in: /System/Library/Frameworks/Security.framework/Versions/A/Security
 in /Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/../libtensorflow_framework.2.dylib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/Users/steph/anaconda/envs/py36/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: dlopen(/Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so, 6): Symbol not found: _SecKeyCopyExternalRepresentation
  Referenced from: /Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/../libtensorflow_framework.2.dylib
  Expected in: /System/Library/Frameworks/Security.framework/Versions/A/Security
 in /Users/steph/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/../libtensorflow_framework.2.dylib


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.```

2 Answers

Probably you have the same problem issued here.. you can try to solve this upgrading your MacOS system o trying to install the tensorflow inside the virtualenv that you will use for your code

Edit:

to install the package inside you virtual environment (anaconda in this case) you need to activate the env you already create (refer to anaconda docs to make it) and use

$ conda activate myenv
(myenv) $ pip install tensorflow

The beta is pre-release, not stable yet, so you have to use the --pre flag

pip install --pre tensorflow==2.0.0-beta1
Related