ImportError: No module named tensorflow -> but Requirement already satisfied

Hy,

I want to run a yolo v3 tutorial on my jetson nano (jetpack 4.3) and created a virtual environment where i want to save and run the code, install the needed packages and so on…

When I try to install tensorflow (following this guide https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html#install) I got this information

Requirement already satisfied

This is what I did in detail:

python3 -m virtualenv -p python3 aiguyyolotest1
source aiguyyolotest1/bin/activate
sudo apt-get update
sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran

After the last command i got the information that I already use the newest versions. 0 updated, 0 new installed, 0 to delete and 3 not updated.
The next steps:

pip3 install --upgrade pip
(Successfully installed pip-20.2.3)

sudo apt-get install python3-pip
After that command again i got the information that I already use the newest version. 0 updated, 0 new installed, 0 to delete and 3 not updated.
The next steps:

sudo pip3 install -U pip testresources setuptools

WARNING: The directory ‘/home/christopher/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Requirement already up-to-date: pip in /usr/local/lib/python3.6/dist-packages (20.2.3)
Requirement already up-to-date: testresources in /usr/local/lib/python3.6/dist-packages (2.0.1)
Requirement already up-to-date: setuptools in /usr/local/lib/python3.6/dist-packages (50.3.0)
Requirement already satisfied, skipping upgrade: pbr>=1.8 in /usr/local/lib/python3.6/dist-packages (from testresources) (5.4.4)

sudo pip3 install -U numpy==1.16.1 future==0.18.2 mock==3.0.5 h5py==2.10.0 keras_preprocessing==1.1.1 keras_applications==1.0.8 gast==0.2.2 futures protobuf pybind11

WARNING: The directory ‘/home/christopher/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Requirement already up-to-date: numpy==1.16.1 in /usr/local/lib/python3.6/dist-packages (1.16.1)
Requirement already up-to-date: future==0.18.2 in /usr/local/lib/python3.6/dist-packages (0.18.2)
Requirement already up-to-date: mock==3.0.5 in /usr/local/lib/python3.6/dist-packages (3.0.5)
Requirement already up-to-date: h5py==2.10.0 in /usr/local/lib/python3.6/dist-packages (2.10.0)
Requirement already up-to-date: keras_preprocessing==1.1.1 in /usr/local/lib/python3.6/dist-packages (1.1.1)
Requirement already up-to-date: keras_applications==1.0.8 in /usr/local/lib/python3.6/dist-packages (1.0.8)
Requirement already up-to-date: gast==0.2.2 in /usr/local/lib/python3.6/dist-packages (0.2.2)
Requirement already up-to-date: futures in /usr/local/lib/python3.6/dist-packages (3.1.1)
Requirement already up-to-date: protobuf in /usr/local/lib/python3.6/dist-packages (3.13.0)
Requirement already up-to-date: pybind11 in /usr/local/lib/python3.6/dist-packages (2.5.0)
Requirement already satisfied, skipping upgrade: six in /usr/local/lib/python3.6/dist-packages (from mock==3.0.5) (1.14.0)
Requirement already satisfied, skipping upgrade: setuptools in /usr/local/lib/python3.6/dist-packages (from protobuf) (50.3.0)

sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v43 tensorflow

WARNING: The directory ‘/home/christopher/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Looking in indexes: https://pypi.org/simple, https://developer.download.nvidia.com/compute/redist/jp/v43
Requirement already satisfied: tensorflow in /usr/local/lib/python3.6/dist-packages (2.1.0+nv20.3.tf2)
Requirement already satisfied: protobuf>=3.8.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (3.13.0)
Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.1.0)
Requirement already satisfied: keras-applications>=1.0.8 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.0.8)
Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.14.0)
Requirement already satisfied: google-pasta>=0.1.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (0.2.0)
Requirement already satisfied: gast==0.2.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (0.2.2)
Requirement already satisfied: absl-py>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (0.9.0)
Requirement already satisfied: numpy<2.0,>=1.16.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.16.1)
Requirement already satisfied: tensorflow-estimator<2.2.0,>=2.1.0rc0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (2.1.0)
Requirement already satisfied: scipy==1.4.1; python_version >= “3” in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.4.1)
Requirement already satisfied: tensorboard<2.2.0,>=2.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (2.1.1)
Requirement already satisfied: wrapt>=1.11.1 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.12.1)
Requirement already satisfied: wheel>=0.26; python_version >= “3” in /usr/lib/python3/dist-packages (from tensorflow) (0.30.0)
Requirement already satisfied: opt-einsum>=2.3.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (3.2.0)
Requirement already satisfied: astor>=0.6.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (0.8.1)
Requirement already satisfied: keras-preprocessing>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.1.1)
Requirement already satisfied: grpcio>=1.8.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow) (1.28.1)
Requirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from protobuf>=3.8.0->tensorflow) (50.3.0)
Requirement already satisfied: h5py in /usr/local/lib/python3.6/dist-packages (from keras-applications>=1.0.8->tensorflow) (2.10.0)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (0.4.1)
Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (1.0.1)
Requirement already satisfied: google-auth<2,>=1.6.3 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (1.13.1)
Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (3.2.1)
Requirement already satisfied: requests<3,>=2.21.0 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (2.23.0)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.2.0,>=2.1.0->tensorflow) (1.3.0)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow) (4.0.0)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow) (0.2.8)
Requirement already satisfied: rsa<4.1,>=3.1.4 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow) (4.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/lib/python3/dist-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow) (1.22)
Requirement already satisfied: idna<3,>=2.5 in /usr/lib/python3/dist-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow) (2.6)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow) (2018.1.18)
Requirement already satisfied: chardet<4,>=3.0.2 in /usr/lib/python3/dist-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow) (3.0.4)
Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.6/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.2.0,>=2.1.0->tensorflow) (3.1.0)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.6/dist-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow) (0.4.8)

Now I tried to run tensorflow in different python versions:

First try:

python

Python 3.6.9 (default, Jul 17 2020, 12:50:27)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import tensorflow
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘tensorflow’

Second try:

python2.7

Python 2.7.17 (default, Jul 20 2020, 15:37:01)
[GCC 7.5.0] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import numpy
import tensorflow
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named tensorflow

Third try:

python3.7

Python 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import tensorflow
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘tensorflow’

When I run tensorflow within python 3.6.9 in my home directory (not inside a virtual environment) everthing works fine.

Can somebody help me with this?
I have no idea what to do.

BR chris

check if TF is installed in your virtualenv or system directory.

Hi,

The package is for python v3.6.9 only.

We don’t provide TensorFlow python2 package for a while since it is end of life.
And we only provide the default python3 version in standard Ubuntu (v3.6.9) so v3.7 is not supported either.

Thanks.

I’m not really sure about that, because I have little experience with linux, python, tensorflow and so on.
Sometimes I install things a little headless I have to admit ;)
I think tensorflow is installed in my system directory as it works properly when I start python outside the virtual environment and import tensorflow.
Colud you please tell me how to check it?

Ok thanks. So the problem with python2.7 and python3.7 is solved.

But do you have an idea why it is not working with python 3.6.9?
Maybe the problem refers to the directory where I installed tensorflow?

[MtHiker]
check if TF is installed in your virtualenv or system directory.

Hi,

Please remember to add --system-site-packages flag to get access of the host modules.
You can find the detail information here:

Thanks.

1 Like

Thanks for that!

TensorFlow is running now :)