# Install problem on Ubuntu 20.04 LTS + GPU

**URL:** <https://discuss.ai.google.dev/t/install-problem-on-ubuntu-20-04-lts-gpu/30338>\
**Category:** General Discussion\
**Tags:** gpu, install, help\_request\
**Created:** [November 17, 2021, 4:03pm UTC](https://discuss.ai.google.dev/t/install-problem-on-ubuntu-20-04-lts-gpu/30338 "2021-11-17T16:03:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_A](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/david_a/32/9720_2.png) [@David\_A](https://discuss.ai.google.dev/u/David_A)\
**Post date:** [November 17, 2021, 4:03pm UTC](https://discuss.ai.google.dev/t/install-problem-on-ubuntu-20-04-lts-gpu/30338/1 "2021-11-17T16:03:15Z")

</div>

I am having trouble installing TensorFlow on Ubuntu 20.04 LTS with GPU:

```auto
$ 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)

```

Can anyone help please?

---

<div class="post-metadata">

**Author:** ![Bhack](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/bhack/32/6388_2.png) [@Bhack](https://discuss.ai.google.dev/u/Bhack)\
**Post date:** [November 17, 2021, 5:14pm UTC](https://discuss.ai.google.dev/t/install-problem-on-ubuntu-20-04-lts-gpu/30338/3 "2021-11-17T17:14:19Z")

</div>

Can you try to use the recommended virtual environment as in:

> **[Install TensorFlow with pip](https://www.tensorflow.org/install/pip#2.-create-a-virtual-environment-recommended)**

---

<div class="post-metadata">

**Author:** ![David\_A](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/david_a/32/9720_2.png) [@David\_A](https://discuss.ai.google.dev/u/David_A)\
**Post date:** [November 17, 2021, 5:29pm UTC](https://discuss.ai.google.dev/t/install-problem-on-ubuntu-20-04-lts-gpu/30338/4 "2021-11-17T17:29:55Z")

</div>

@Bhack Thanks for your reply.  
I followed the instructions you referred to and saw:

```auto
(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:

```auto
(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)

```

---

<div class="post-metadata">

**Author:** ![Bhack](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/bhack/32/6388_2.png) [@Bhack](https://discuss.ai.google.dev/u/Bhack)\
**Post date:** [November 17, 2021, 5:48pm UTC](https://discuss.ai.google.dev/t/install-problem-on-ubuntu-20-04-lts-gpu/30338/5 "2021-11-17T17:48:15Z")

</div>

I cannot reproduce your error with a fresh install on Ubuntu 20.04:

```bash
docker run --rm -it ubuntu/ubuntu:20.04 /bin/bash

apt-get update && apt-get -y install python3 python3.8-venv

python3 -m venv --system-site-packages ./venv
source ./venv/bin/activate # sh, bash, or zsh
pip install --upgrade pip
pip install --upgrade tensorflow
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

```

```auto
tf.Tensor(97.31439, shape=(), dtype=float32)

```

---

<div class="post-metadata">

**Author:** ![David\_A](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/david_a/32/9720_2.png) [@David\_A](https://discuss.ai.google.dev/u/David_A)\
**Post date:** [November 17, 2021, 6:26pm UTC](https://discuss.ai.google.dev/t/install-problem-on-ubuntu-20-04-lts-gpu/30338/6 "2021-11-17T18:26:03Z")

</div>

Thanks again.

I tried again and set:

`export LD_LIBRARY_PATH=/usr/lib/cuda/lib64`

and now see:

```auto
$ 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)

```

```auto
$ python3 -c 'import tensorflow as tf; print(tf. __version__ )'
2.7.0

```

So I think that is successful?

---

<div class="post-metadata">

**Author:** ![Bhack](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/bhack/32/6388_2.png) [@Bhack](https://discuss.ai.google.dev/u/Bhack)\
**Post date:** [November 17, 2021, 9:03pm UTC](https://discuss.ai.google.dev/t/install-problem-on-ubuntu-20-04-lts-gpu/30338/7 "2021-11-17T21:03:10Z")

</div>

It seems yes. Try to print the available GPU device:

> **[tf.config.list\_physical\_devices  |  TensorFlow v2.16.1](https://www.tensorflow.org/api_docs/python/tf/config/list_physical_devices)**
>
> Return a list of physical devices visible to the host runtime.
