I am having trouble installing TensorFlow on Ubuntu 20.04 LTS with GPU:
$ export LD_LIBRARY_PATH=/usr/local/lib/python3.8/dist-packages/numpy.libs/
$ source /opt/tensorflow/bin/activate
$ python3 -c 'import tensorflow as tf; print(tf.__version__)'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/usr/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 41, in <module>
from tensorflow.python.eager import context
File "/usr/lib/python3.8/site-packages/tensorflow/python/eager/context.py", line 30, in <module>
import numpy as np
File "/home/daldrich/.local/lib/python3.8/site-packages/numpy/__init__.py", line 163, in <module>
from . import ma
ImportError: cannot import name 'ma' from partially initialized module 'numpy' (most likely due to a circular import) (/home/<snip>/.local/lib/python3.8/site-packages/numpy/__init__.py)
@Bhack Thanks for your reply.
I followed the instructions you referred to and saw:
(venv) $ python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
<snip>
ImportError: libopenblasp-r0-2d23e62b.3.17.so: cannot open shared object file: No such file or directory
I then set:
$ export LD_LIBRARY_PATH=/usr/local/lib/python3.8/dist-packages/numpy.libs/
and now see the same error I reported above:
(venv) daldrich@ubuntusim11:/data/daldrich$ python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "/usr/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 41, in <module>
from tensorflow.python.eager import context
File "/usr/lib/python3.8/site-packages/tensorflow/python/eager/context.py", line 30, in <module>
import numpy as np
File "/home/daldrich/.local/lib/python3.8/site-packages/numpy/__init__.py", line 163, in <module>
from . import ma
ImportError: cannot import name 'ma' from partially initialized module 'numpy' (most likely due to a circular import) (/home/daldrich/.local/lib/python3.8/site-packages/numpy/__init__.py)
$ python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
2021-11-17 18:25:24.770863: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-11-17 18:25:25.271273: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 30985 MB memory: -> device: 0, name: Tesla V100S-PCIE-32GB, pci bus id: 0000:d8:00.0, compute capability: 7.0
tf.Tensor(1303.674, shape=(), dtype=float32)
$ python3 -c 'import tensorflow as tf; print(tf.__version__)'
2.7.0