Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named 'absl' error when I import tensorflow

I have anaconda installed on my Win 7 machine with a GTX1070.

I have been trying to install tensorflow gpu version for the past hour with no luck. I followed the tutorials on the tensorflow website to no success. They ask for you to install CUDA 8.0 and Cudll 6.0 which I do. I then add the location of cudnn64_6.dll, cudart64_80.dll and the libnvvp folder to my path variables. I then set up a virtual environment in conda and run the following command:

(tensorflow)C:> pip install --ignore-installed --upgrade tensorflow-gpu 

I believe when I do this, it installs tensorflow 1.5 which seems to require CUDA tools 9.0 because I get an error saying that cudart64_80.dll cannot be found. So I update my CUDA tools to 9.0 and download the corresponding Cuda library. I then change my path variables. Now I dont get any missing dll errors however, I am now faced with the following error

ModuleNotFoundError: No module named 'absl'

Does anyone have any suggestions as to what I can do from here on?

like image 571
Ozymandias Avatar asked Jan 28 '18 19:01

Ozymandias


3 Answers

This was caused by a Python version issue for me. I had the absl package installed on my Python 2.x, but my Python 3.x didn't have it. So I just made sure that both Pythons on my machine had the package installed:

pip install absl-py
pip3 install absl-py

like image 125
Maghoumi Avatar answered Sep 20 '22 21:09

Maghoumi


Here is how I solved it in my end.

I was getting the error even though absl-py was already installed.

When I used pip install absl-py I got the following error:

Requirement already satisfied: absl-py in c:\users\stack\appdata\local\programs\python\python38\lib\site-packages (0.9.0)
Requirement already satisfied: six in c:\users\stack\appdata\local\programs\python\python38\lib\site-packages (from absl-py) (1.15.0)

I fixed it by reinstalling, i.e. by using:

pip uninstall absl-py
pip install absl-py

Then I faced a similar error with wrapt: ModuleNotFoundError: No module named 'wrapt'

Fixed wrapt as well by uninstalling and then installing it again.

pip uninstall wrapt
pip install wrapt
like image 28
Dimenein Avatar answered Sep 23 '22 21:09

Dimenein


Try:

conda install tensorflow
conda install -c anaconda absl-py

This worked for me.

For more information see: https://anaconda.org/anaconda/absl-py

like image 44
Faiez Benamar Avatar answered Sep 22 '22 21:09

Faiez Benamar