JetPack 4.4 supported Tensorflow 2.1.0 AttributeError: module 'tensorflow' has no attribute '__version__'

Hi,

I just installed the latest supported TF version supported by JP 4.4 using the sudo pip3 command in these instructions:

and it seems to be installed correctly, i am able to import tf and keras… etc. but when i try to get the version using python3 using print(tf.__version__) i get AttributeError: module 'tensorflow' has no attribute '__version__'

i noticed that the pip3 command installs a different wheel than the wheel thats linked a few lines above in the same instructions … lmao.

wheel from wheel link: … “tensorflow-2.1.0+nv20.3-cp36-cp36m-linux_aarch64.whl”
wheel from pip3 command: … “tensorflow-2.1.0+nv20.4-cp36-cp36m-linux_aarch64.whl”
(notice the nv20.4 and nv20.3 difference)

so i tried uninstalling and installing again with the wheel file from the link, which solved the issue. BUT now i no longer had GPU support with tensorflow. Damn. So i just went back to the GPU supported one (using pip3 command) and still have the attribute error that says module 'tensorflow' has no attribute '__version__'

Using;

  • Jetson Xavier NX Dev Kit
  • JetPack 4.4
  • tensorflow 2.1.0
  • Python 3.6.9
  • Ubuntu 18.04

Can anybody help?

Try print(tf.version.VERSION)

1 Like

That worked thanks!! Its just weird to me that the same exact version but installed with a different wheel will have different results like that.

Thanks for helping, have a good weekend.

What you can do is create a “__version__”-attribute in the following file:
/usr/local/lib/python3.6/dist-packages/tensorflow/__init__.py

access the __init__.py file with sudo-rights and enter:

__version__ = “x.y.z” (= your version of tensorflow, for me 2.1.0) after the import-section of the file.

save and exit the file and run tensorboard (in my case).

In the end the __init__.py file looks like:

“”“TensorFlow root package”“”

from __future__ import absolute_import as _absolute_import
from __future__ import division as _division
from __future__ import print_function as _print_function

import sys as _sys
import importlib as _importlib
import types as _types

__version__ = “2.1.0”

It is a hack, I know, but it got tensorboard to run!

2 Likes