hamelsmu
(Hamel Husain)
October 31, 2017, 1:37am
1
When trying to import Keras, I get the following errors:
ImportError: Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/opt/conda/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/opt/conda/lib/python3.6/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/opt/conda/lib/python3.6/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory
Has anyone else seen this or experienced this? I’ve installed this on Ubuntu 16.04 using Cuda 9.0 and CudaNN 7.0
vikram
(Vikram Kalabi)
October 31, 2017, 1:41am
2
Can you do sudo find /usr/local/ -n libcusolver.so.8.0
? Add the successful search path to LD_LIBRARY_PATH and then try again.
radek
October 31, 2017, 1:56am
3
I saw this error myself but I don’t remember exactly what was the issue. Did you install tensorflow via conda?
This is part of the installation that I am running now and I am no longer seeing the issue:
# install cudnn libraries
wget "http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.0.3.11-1+cuda9.0_amd64.deb"
sudo dpkg -i libcudnn7_7.0.3.11-1+cuda9.0_amd64.deb
# install tensorflow
conda install tensorflow
# install and configure keras
pip install git+git://github.com/fchollet/keras.git
mkdir ~/.keras
echo '{
"image_dim_ordering": "tf",
"epsilon": 1e-07,
"floatx": "float32",
"backend": "tensorflow"
}' > ~/.keras/keras.json
hamelsmu
(Hamel Husain)
October 31, 2017, 3:18am
4
I figured it out. I’m using Nvidia Docker. What was tripping me up is that I needed to use Cuda 8.0 with CudaNN v6.0
Here is my DockerFile:
FROM nvidia/cuda:8.0-cudnn6-devel-ubuntu16.04
MAINTAINER Hamel Husain <hamelsmu@github.com>
# Add this to the path for TensorFlow
ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
# Add External Dependencies for TensorFlow and DS
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
byobu \
curl \
htop \
libcupti-dev \
libfreetype6-dev \
libpng12-dev \
libzmq3-dev \
pkg-config \
python3-pip \
python3-dev \
python-virtualenv \
rsync \
software-properties-common \
unzip \
wget \
git-core \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
#################### Install Anaconda
# Why Anaconda? Its recommended Package Manager For PyTorch
# The following section is from https://hub.docker.com/r/continuumio/anaconda3/~/dockerfile/
# You may have to check this periodically and update
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
RUN apt-get update --fix-missing && apt-get install -y wget bzip2 ca-certificates \
libglib2.0-0 libxext6 libsm6 libxrender1 \
git mercurial subversion
RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \
wget --quiet https://repo.continuum.io/archive/Anaconda3-5.0.0.1-Linux-x86_64.sh -O ~/anaconda.sh && \
/bin/bash ~/anaconda.sh -b -p /opt/conda && \
rm ~/anaconda.sh
RUN apt-get install -y curl grep sed dpkg && \
TINI_VERSION=`curl https://github.com/krallin/tini/releases/latest | grep -o "/v.*\"" | sed 's:^..\(.*\).$:\1:'` && \
curl -L "https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini_${TINI_VERSION}.deb" > tini.deb && \
dpkg -i tini.deb && \
rm tini.deb && \
apt-get clean
ENV PATH /opt/conda/bin:$PATH
##################
# Install TensorFlow GPU Support
RUN pip --no-cache-dir install --upgrade \
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp36-cp36m-linux_x86_64.whl \
keras \
Pillow \
h5py \
bcolz \
altair \
dask
# Install Pytorch Instructions at http://pytorch.org/
RUN conda install -y pytorch torchvision cuda80 -c soumith
# Open Ports for TensorBoard, Jupyter, and SSH
EXPOSE 6006
EXPOSE 8888
EXPOSE 22
# Run the shell
CMD ["/bin/bash"]
1 Like