[Python] tensorflow cannot import name container_types

Discussão em 'Python' iniciado por Stack, Março 31, 2025.

  1. Stack

    Stack Membro Participativo

    I've just compiled tensorflow from source code with GPU support on OSX. This was with a few hick-ups and hacks along the way:

    • based on this issue I've checkout commit 49dcb6c769d60206eb845eb249fa3ef6bc333457 from the 24th of August 2017 (to get past the XLA namespace related error)
    • I've also manually taken out the -lgomp flag as well

    Finally I've compiled the .whl file and installed in a virtual environment, however, when I try to import tensorflow, I get these errors:

    import tensorflow
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/Volumes/GP_2T/tensorflow_tutorials/tf_src/venv/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
    File "/Volumes/GP_2T/tensorflow_tutorials/tf_src/venv/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 63, in <module>
    from tensorflow.python.framework.framework_lib import *
    File "/Volumes/GP_2T/tensorflow_tutorials/tf_src/venv/lib/python2.7/site-packages/tensorflow/python/framework/framework_lib.py", line 102, in <module>
    from tensorflow.python.framework.importer import import_graph_def
    File "/Volumes/GP_2T/tensorflow_tutorials/tf_src/venv/lib/python2.7/site-packages/tensorflow/python/framework/importer.py", line 30, in <module>
    from tensorflow.python.framework import function
    File "/Volumes/GP_2T/tensorflow_tutorials/tf_src/venv/lib/python2.7/site-packages/tensorflow/python/framework/function.py", line 33, in <module>
    from tensorflow.python.ops import resource_variable_ops
    File "/Volumes/GP_2T/tensorflow_tutorials/tf_src/venv/lib/python2.7/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 25, in <module>
    from tensorflow.python.eager import custom_gradient
    File "/Volumes/GP_2T/tensorflow_tutorials/tf_src/venv/lib/python2.7/site-packages/tensorflow/python/eager/custom_gradient.py", line 23, in <module>
    from tensorflow.python.eager import tape
    File "/Volumes/GP_2T/tensorflow_tutorials/tf_src/venv/lib/python2.7/site-packages/tensorflow/python/eager/tape.py", line 23, in <module>
    from autograd import container_types
    ImportError: cannot import name container_types


    My setup is OSX 10.11.5 with bazel 0.5.4, CUDA 8.0, cudnn 5.1 and XCode 7.0

    Has anyone else bumped into this issue ? Any clues on how I could get myself unstuck / what should I double check ?

    Continue reading...

Compartilhe esta Página