38

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?

sophros
  • 14,672
  • 11
  • 46
  • 75
Ozymandias
  • 839
  • 1
  • 8
  • 13
  • 1
    in fact, the pip package descriptor of tensorflow explicitly requires `absl-py >= 0.1.6` (see [this link](https://github.com/tensorflow/tensorflow/blob/a12e9f4425018ffae403a0ee8ec24187b4d52897/tensorflow/tools/pip_package/setup.py#L34-L43) at least on the current master. Can you start an interactive python session and try `import absl` ? If that does not work, can you try to manually install `py-absl` with pip the same way you installed tensorflow ? – Andre Holzner Jan 28 '18 at 21:37
  • 26
    `pip install absl-py` works for me – Krishna Feb 21 '18 at 21:14
  • did you find a solution? – Charlie Parker Apr 18 '18 at 21:02
  • @CharlieParker add the following path to your environment variables; c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64 – Ozymandias Jun 16 '18 at 16:33
  • `pip install absl-py` also worked for me. – Chetan Ambi Jan 27 '21 at 05:28

12 Answers12

46

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

Melvin
  • 3,421
  • 2
  • 37
  • 41
Maghoumi
  • 3,295
  • 3
  • 33
  • 49
14

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
Dimenein
  • 281
  • 2
  • 5
  • I was having this issue. Uninstalling and reinstalling was not helping. Eventually I noticed my $PATH had was pointing to 2 different versions of python. I guess this was leading to the module not being found even though it was installed. I uninstalled one version and removed it from my PATH and everything worked after that. Hope this helps someone! – James Hollyer Jan 10 '22 at 23:59
5

Try:

conda install tensorflow
conda install -c anaconda absl-py

This worked for me.

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

Hayden Eastwood
  • 928
  • 2
  • 10
  • 20
Faiez Benamar
  • 51
  • 1
  • 1
2

I was facing the same issues and pip (or pip3) install absl-py was not working.

python --version showed I was using the wrong python version (2.7). So I changed the python version to 3.5 (https://askubuntu.com/questions/320996/how-to-make-python-program-command-execute-python-3)

This worked for me.

Saiful
  • 61
  • 5
1

You can use the Anaconda GUI to install absl-py pack to solve the problem:

Select the uninstall columnand search absl-py to apply it.

Rence
  • 2,900
  • 2
  • 23
  • 40
1

Try another version of absl-py. My default absl version is 0.8.1 and python is 3.6:

$pip install absl-py==0.8.0

works for me.

Or change my environment python version to 3.7 also works.

Alexey S. Larionov
  • 6,555
  • 1
  • 18
  • 37
WindStreet
  • 11
  • 1
0

This is quite late but still worth posting. What they don't tell you on the NVidia website is that there is one more path you need to add to your environment variables. The path is;

c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64

It may not be exactly the same on your installation as it depends on where you installed your CUDA tools.

You could also just use pip to install TF GPU version but pip installs TF 1.1 which is fairly old.

Ozymandias
  • 839
  • 1
  • 8
  • 13
0

For me, "pip3 install absl-py" don't work:

I received: "ModuleNotFoundError: No module named 'absl' ", when I was trying import tensorflow:

import tensorflow Traceback (most recent call last): File "", line 1, in File "/opt/anaconda3/lib/python3.6/site-packages/tensorflow/init.py", line 22, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "/opt/anaconda3/lib/python3.6/site-packages/tensorflow/python/init.py", line 63, in from tensorflow.python.framework.framework_lib import * # pylint: disable=redefined-builtin File "/opt/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/framework_lib.py", line 25, in from tensorflow.python.framework.ops import Graph File "/opt/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 55, in from tensorflow.python.platform import app File "/opt/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 24, in from tensorflow.python.platform import flags File "/opt/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/flags.py", line 25, in from absl.flags import * # pylint: disable=wildcard-import ModuleNotFoundError: No module named 'absl'

But if I compile absl-py from scratch, all goes right:

jk@D17:~/py/004/abseil-py-master$ python setup.py install

running install

running bdist_egg running egg_info

.......

Using /opt/anaconda3/lib/python3.6/site-packages

Finished processing dependencies for absl-py==0.4.0

and then:

import tensorflow

is OK

Jerry
  • 1
  • 1
0

Find the absl-py related folder in your site-packages folder and delete it. Try reinstalling pip3 install absl-py. I solved this way, I hope to be useful to you.

0

If you are using Anaconda make sure you install jupyter notebook from Home. if not you can import it from python CLI but it will give "No module named 'absl' error when importing TensorFlow"

0

In hopes that this might help someone in the future. I had similar issues installing/using tensorflow and by extension the absl python package. There were some issues relating to a pure pip installation so I had to find an alternate route.

This is the process I followed.

Download and install miniconda:

wget https://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/miniconda

add conda to PATH (Optional):

export PATH="$HOME/miniconda/bin:$PATH"

activate the conda environment:

source $HOME/miniconda/bin/activate

At this point you should have (base) as your sourced condo environment. From this environment perform the following:

conda create -n tensorflow python=3.7
activate tensorflow

Just to note, at this point you should be working in the (tensorflow) environment. It would have replaced the base environment. It is also the env where you would run your tensorflow related job (that failed and brought you here).


pip install --ignore-installed --upgrade tensorflow
pip install absl-py

At this point you might need to install additional dependencies such as numpy.

My goal was to be able to run tensorflow tools and this worked for my ends. Hope it may be useful to someone else in the future.

Kevin Smith
  • 581
  • 2
  • 6
  • 13
0

I got the No module named absl error when I tried to install tf-nightly 2.9.0.dev20220203 on my Ubuntu 20.04.3 machine.

Reinstalling absl-py did not directly worked. While reinstalling absl, I got this error: ERROR: tf-nightly 2.9.0.dev20220203 has requirement gast<=0.4.0,>=0.2.1, but you'll have gast 0.5.3 which is incompatible.

So I uninstalled absl-py:

pip uninstall absl-py

Then downgraded gast:

pip uninstall gast

pip install gast==0.4.0

Finally, pip install absl-py

Maria
  • 171
  • 1
  • 4