11

I am trying to install the following version of TensorFlow-GPU because the author of gitrepo has suggested it here.

[jalal@goku examples]$ pip install tensorflow-gpu~=1.14
Collecting tensorflow-gpu~=1.14
  Using cached https://files.pythonhosted.org/packages/a5/ad/933140e74973fb917a194ab814785e7c23680ca5dee6d663a509fe9579b6/tensorflow_gpu-1.15.0-cp36-cp36m-manylinux2010_x86_64.whl
Processing /home/grad3/jalal/.cache/pip/wheels/d7/de/2e/efa132238792efb6459a96e85916ef8597fcb3d2ae51590dfd/wrapt-1.11.2-cp36-cp36m-linux_x86_64.whl
Requirement already satisfied: protobuf>=3.6.1 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (3.11.0)
Requirement already satisfied: tensorflow-estimator==1.15.1 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.15.1)
Requirement already satisfied: six>=1.10.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.13.0)
Requirement already satisfied: wheel>=0.26 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (0.33.6)
Requirement already satisfied: tensorboard<1.16.0,>=1.15.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.15.0)
Requirement already satisfied: termcolor>=1.1.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.1.0)
Requirement already satisfied: opt-einsum>=2.3.2 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (3.1.0)
Collecting keras-applications>=1.0.8
  Using cached https://files.pythonhosted.org/packages/71/e3/19762fdfc62877ae9102edf6342d71b28fbfd9dea3d2f96a882ce099b03f/Keras_Applications-1.0.8-py3-none-any.whl
Requirement already satisfied: keras-preprocessing>=1.0.5 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.0.5)
Requirement already satisfied: grpcio>=1.8.6 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.25.0)
Requirement already satisfied: absl-py>=0.7.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (0.8.1)
Requirement already satisfied: google-pasta>=0.1.6 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (0.1.8)
Processing /home/grad3/jalal/.cache/pip/wheels/5c/2e/7e/a1d4d4fcebe6c381f378ce7743a3ced3699feb89bcfbdadadd/gast-0.2.2-cp36-none-any.whl
Requirement already satisfied: astor>=0.6.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (0.8.0)
Requirement already satisfied: numpy<2.0,>=1.16.0 in /home/grad3/jalal/.local/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.17.4)
Requirement already satisfied: setuptools in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from protobuf>=3.6.1->tensorflow-gpu~=1.14) (42.0.2)
Requirement already satisfied: markdown>=2.6.8 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow-gpu~=1.14) (3.1.1)
Requirement already satisfied: werkzeug>=0.11.15 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow-gpu~=1.14) (0.16.0)
Requirement already satisfied: h5py in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from keras-applications>=1.0.8->tensorflow-gpu~=1.14) (2.7.1)
Installing collected packages: wrapt, keras-applications, gast, tensorflow-gpu
  Found existing installation: wrapt 1.10.11
ERROR: Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

How do I fix this installation issue?

A little information about my system:

$ cat /proc/version
Linux version 3.10.0-1062.4.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Wed Nov 13 23:58:53 UTC 2019


$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.7.1908 (Core)
Release:    7.7.1908
Codename:   Core


$ python
Python 3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>> import deepposekit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/deepposekit/__init__.py", line 20, in <module>
    from deepposekit.io import TrainingGenerator, DataGenerator
  File "/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/deepposekit/io/__init__.py", line 18, in <module>
    from deepposekit.io.BaseGenerator import BaseGenerator
  File "/scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages/deepposekit/io/BaseGenerator.py", line 16, in <module>
    from tensorflow.keras.utils import Sequence
ModuleNotFoundError: No module named 'tensorflow'

I have the following GPUs:

$ nvidia-smi
Sat Dec  7 22:48:51 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.67       Driver Version: 418.67       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:05:00.0  On |                  N/A |
|  0%   28C    P0    61W / 250W |   1462MiB / 11178MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 108...  Off  | 00000000:06:00.0 Off |                  N/A |
|  0%   28C    P8    13W / 250W |     12MiB / 11178MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

And here's my CUDA version:

$ cat /usr/local/cuda/version.txt
CUDA Version 10.0.130

$ pip list | grep tensorflow
tensorflow-estimator               1.15.1  




[jalal@goku examples]$ yum search wrapt
Loaded plugins: aliases, changelog, copr, fastestmirror, kabi, langpacks, priorities, tmprepo, verify, versionlock
Loading support for Red Hat kernel ABI
Loading mirror speeds from cached hostfile
 * centos-sclo-rh: mirrors.seas.harvard.edu
 * centos-sclo-sclo: mirrors.seas.harvard.edu
 * remi-php70: mirror.pit.teraswitch.com
 * remi-php71: mirror.pit.teraswitch.com
 * remi-php73: mirror.pit.teraswitch.com
 * remi-safe: mirror.pit.teraswitch.com
 * ulyaoth: repos.ulyaoth.com
 * webtatic: us-east.repo.webtatic.com
Atom                                                                                                                                                                                                       140/140
1075 packages excluded due to repository priority protections
=============================================================================================== N/S matched: wrapt ================================================================================================
python-wrapt.x86_64 : A Python module for decorators, wrappers and monkey patching
python36-wrapt.x86_64 : A Python module for decorators, wrappers and monkey patching

  Name and summary matches only, use "search all" for everything.
[jalal@goku examples]$ sudo yum remove python-wrapt.x86_64 
Loaded plugins: aliases, changelog, copr, fastestmirror, kabi, langpacks, priorities, tmprepo, verify, versionlock
Loading support for Red Hat kernel ABI
No Match for argument: python-wrapt.x86_64
No Packages marked for removal
[jalal@goku examples]$ sudo yum remove python36-wrapt.x86_64 
Loaded plugins: aliases, changelog, copr, fastestmirror, kabi, langpacks, priorities, tmprepo, verify, versionlock
Loading support for Red Hat kernel ABI
No Match for argument: python36-wrapt.x86_64
No Packages marked for removal
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
  • you need to `yum remove wrapt`, since it was not installed with pip, it can not be upgraded with pip. – William D. Irons Dec 08 '19 at 03:53
  • Thanks William but I got this error: `$ sudo yum remove wrapt [sudo] password for jalal: Loaded plugins: aliases, changelog, copr, fastestmirror, kabi, langpacks, priorities, tmprepo, verify, versionlock Loading support for Red Hat kernel ABI No Match for argument: wrapt No Packages marked for removal` – Mona Jalal Dec 08 '19 at 03:55
  • 1
    I'm not on my work computer, so I can't check the correct package name. It might be `yum remove python-wrapt`. (And then after you remove it you would need to retry the pip install tensorflow-gpu) – William D. Irons Dec 08 '19 at 04:01
  • please check the updated question. I searched for the wrapt but could not find it installed. – Mona Jalal Dec 08 '19 at 04:04
  • it is in the pip list though should I pip uninstall it? `$ pip list | grep wrapt wrapt 1.10.11` – Mona Jalal Dec 08 '19 at 04:05
  • 2
    ok, your using conda. I didn't notice that. `conda update wrapt` or `conda update --all` For more info: https://github.com/tensorflow/tensorflow/issues/30191 – William D. Irons Dec 08 '19 at 04:09
  • $ pip uninstall wrapt ERROR: Cannot uninstall 'wrapt'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall. – Mona Jalal Dec 08 '19 at 04:09
  • @WilliamD.Irons it is funny but my `conda update --all` has been stuck for the past 30 minutes here: https://unix.stackexchange.com/questions/556133/conda-update-all-gets-stuck-at-hypothesis-3-38-5-in-centos7 – Mona Jalal Dec 08 '19 at 04:10
  • Not sure about that. pip won't uninstall something it didn't install. Which is why you need to use conda to update or remove it if that is how wrapt got installed. – William D. Irons Dec 08 '19 at 04:13

7 Answers7

22

Try to use the following commands:

pip install wrapt --upgrade --ignore-installed
pip install tensorflow-gpu

Good luck.

Haozhe Xie
  • 3,438
  • 7
  • 27
  • 53
9

First, do the following:

$ conda update wrapt

And then,

[jalal@goku examples]$ pip install tensorflow-gpu~=1.14
Collecting tensorflow-gpu~=1.14
  Using cached https://files.pythonhosted.org/packages/a5/ad/933140e74973fb917a194ab814785e7c23680ca5dee6d663a509fe9579b6/tensorflow_gpu-1.15.0-cp36-cp36m-manylinux2010_x86_64.whl
Requirement already satisfied: numpy<2.0,>=1.16.0 in /home/grad3/jalal/.local/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.17.4)
Requirement already satisfied: google-pasta>=0.1.6 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (0.1.8)
Requirement already satisfied: wrapt>=1.11.1 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.11.2)
Requirement already satisfied: absl-py>=0.7.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (0.8.1)
Collecting keras-applications>=1.0.8
  Using cached https://files.pythonhosted.org/packages/71/e3/19762fdfc62877ae9102edf6342d71b28fbfd9dea3d2f96a882ce099b03f/Keras_Applications-1.0.8-py3-none-any.whl
Requirement already satisfied: six>=1.10.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.13.0)
Requirement already satisfied: keras-preprocessing>=1.0.5 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.0.5)
Requirement already satisfied: opt-einsum>=2.3.2 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (3.1.0)
Requirement already satisfied: protobuf>=3.6.1 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (3.11.0)
Requirement already satisfied: tensorboard<1.16.0,>=1.15.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.15.0)
Requirement already satisfied: wheel>=0.26 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (0.33.6)
Requirement already satisfied: termcolor>=1.1.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.1.0)
Collecting tensorflow-estimator==1.15.1
  Using cached https://files.pythonhosted.org/packages/de/62/2ee9cd74c9fa2fa450877847ba560b260f5d0fb70ee0595203082dafcc9d/tensorflow_estimator-1.15.1-py2.py3-none-any.whl
Processing /home/grad3/jalal/.cache/pip/wheels/5c/2e/7e/a1d4d4fcebe6c381f378ce7743a3ced3699feb89bcfbdadadd/gast-0.2.2-cp36-none-any.whl
Requirement already satisfied: astor>=0.6.0 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (0.8.0)
Requirement already satisfied: grpcio>=1.8.6 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorflow-gpu~=1.14) (1.25.0)
Requirement already satisfied: h5py in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from keras-applications>=1.0.8->tensorflow-gpu~=1.14) (2.7.1)
Requirement already satisfied: setuptools in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from protobuf>=3.6.1->tensorflow-gpu~=1.14) (42.0.2.post20191201)
Requirement already satisfied: werkzeug>=0.11.15 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow-gpu~=1.14) (0.16.0)
Requirement already satisfied: markdown>=2.6.8 in /scratch/sjn-p3/anaconda/anaconda3/lib/python3.6/site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow-gpu~=1.14) (3.1.1)
Installing collected packages: keras-applications, tensorflow-estimator, gast, tensorflow-gpu
  Found existing installation: Keras-Applications 1.0.6
    Uninstalling Keras-Applications-1.0.6:
      Successfully uninstalled Keras-Applications-1.0.6
  Found existing installation: gast 0.3.2
    Uninstalling gast-0.3.2:
      Successfully uninstalled gast-0.3.2
Successfully installed gast-0.2.2 keras-applications-1.0.8 tensorflow-estimator-1.15.1 tensorflow-gpu-1.15.0
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
8

You can try the followings in sequence:

pip install -U --ignore-installed wrapt
pip install tensorflow
Simas Joneliunas
  • 2,890
  • 20
  • 28
  • 35
user14056790
  • 81
  • 1
  • 1
0

Find that cache .whl file in your like /home/grad3/jalal/.cache/pip/wheels/... Remove it.

Then re-do as the normal installation procedure. It works for me.

sakura
  • 1
0

Updating Conda and trying to install Tensorflow again worked for me:

conda update --all
pip install tensorflow
Tshilidzi Mudau
  • 7,373
  • 6
  • 36
  • 49
0
pip install --upgrade pip
conda update --all
pip install tensorflow

zpvk
  • 124
  • 1
  • 10
0

Remove file wrapt-1.10.11.egg-info by command sudo rm /usr/lib/python3/dist-packages/wrapt-1.10.11.egg-info

Then install tensorflow again

user16181
  • 126
  • 4