I have just reinstalled latest tensorflow on ubuntu:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl [sudo] password for ubuntu: The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting tensorflow==0.7.1 from https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl Downloading https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl (13.8MB) 100% |████████████████████████████████| 13.8MB 32kB/s Requirement already up-to-date: six>=1.10.0 in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.7.1) Requirement already up-to-date: protobuf==3.0.0b2 in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.7.1) Requirement already up-to-date: wheel in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.7.1) Requirement already up-to-date: numpy>=1.8.2 in /usr/local/lib/python2.7/dist-packages (from tensorflow==0.7.1) Requirement already up-to-date: setuptools in /usr/local/lib/python2.7/dist-packages (from protobuf==3.0.0b2->tensorflow==0.7.1) Installing collected packages: tensorflow Found existing installation: tensorflow 0.7.1 Uninstalling tensorflow-0.7.1: Successfully uninstalled tensorflow-0.7.1 Successfully installed tensorflow-0.7.1
When following the directions to test it fails with cannot import name pywrap_tensorflow:
$ ipython /git/tensorflow/tensorflow/__init__.py in <module>() 21 from __future__ import print_function 22 ---> 23 from tensorflow.python import * /git/tensorflow/tensorflow/python/__init__.py in <module>() 43 _default_dlopen_flags = sys.getdlopenflags() 44 sys.setdlopenflags(_default_dlopen_flags | ctypes.RTLD_GLOBAL) ---> 45 from tensorflow.python import pywrap_tensorflow 46 sys.setdlopenflags(_default_dlopen_flags) 47 ImportError: cannot import name pywrap_tensorflow
Is there an additional change needed to my python or ubuntu/bash environment?
Run all the notebook code cells: Select Runtime > Run all. If you are following along in your own development environment, rather than Colab, see the install guide for setting up TensorFlow for development. Note: Make sure you have upgraded to the latest pip to install the TensorFlow 2 package if you are using your own development environment.
This guide provides a quick overview of TensorFlow basics. Each section of this doc is an overview of a larger topic—you can find links to full guides at the end of each section. TensorFlow is an end-to-end platform for machine learning.
The two most common types of Tensorflow errors are AttributeError and ImportError. Whenever we are working with Tensorflow and we try to give an incorrect assignment or a wrong reference, the program would return what we call AttributeError.
A Tensorflow import error is recognized as the base for what developers call the ModuleNotFoundError. When the import statement cannot load a requested module (because it doesn’t exist on the installed version) or when the line of code from…import cannot find a name that has been requested, the result is an error importing Tensorflow.
From the path in your stack trace (/git/tensorflow/tensorflow/…
), it looks like your Python path may be loading the tensorflow libraries from the source directory, rather than the version that you have installed. As a result, it is unable to find the (compiled) pywrap_tensorflow
library, which is installed in a different directory.
A common solution is to cd
out of the /git/tensorflow
directory before starting python
or ipython
.
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