SoFunction
Updated on 2024-11-15

Importing tensorflow:ImportError: .9.0 reports an error.

incorrect:ImportError: .9.0: cannot open shared object file: No such file or directory

Problem: I can't find a version of cuda 9.0.

The main reason for this error: cuda is not installed or there is a problem with the version of cuda.

This error often occurs when installing tensorflow, but it's not mentioned in the official FAQ. If you haven't solved it using the method below, leave a message in the comments.

For tensorflow version 1.7, only cuda 9.0 (not 9.1 either!) is accepted , and cudnn 7.0, so if you have cuda 9.1 and cudnn 7.1 or above installed, then you need to reinstall versions 9.0 and 7.0.

After installing the correct version, make sure you have added the following environment variables to your ~/.bashrc (or ~/.zshrc) file

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64
export PATH=$PATH:/usr/local/cuda-9.0/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-9.0

As shown:

Just restart your computer afterward and you will not get the ImportError: .9.0 error.

If your cuda is 8.0, then you can roll back the version of tensorflow to 1.4 using the following command.

pip install --upgrade tensorflow-gpu==1.4

This is the whole content of this article.