Importing Tensorflow on Python 3.6, 3.7, 3.8

Viewed 159

I have a problem with importing TensorFlow. I have tried multiple versions of Numpy, Python, and TensorFlow and I still get the following error:

struct_pb2.TypeSpecProto.NDARRAY_SPEC

AttributeError: NDARRAY_SPEC

I have tried using conda and pip for installation and neither one works. I have no idea what might be the cause of this problem and it started happening about a week ago before that TensorFlow was working fine!

1 Answers

I believe you are using windows, and you have an incompatible version of tensorflow installed or you are missing a dependency. First make sure you have the following installed correct version of Visual C++ installed for your version of windows.

https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0

https://aka.ms/vs/16/release/vc_redist.x64.exe here is the direct link.

If it still doesn't work, enable longpaths,

https://superuser.com/questions/1119883/windows-10-enable-ntfs-long-paths-policy-option-missing

If you are having a clash with other packages, create a new conda environment first if you haven't already, and install tensorflow like this.

conda create -n tfenv

conda activate tfenv

conda install tensorflow

Then try to import tensorflow as tf again.

Related