Unable to import an existing module, using Ubuntu 16.04, python 3.5, Anaconda 4.2.15, tensorflow 0.12.
The TensorFlow package contains a helper module called mnist.py
. I've verified that the file exists on my machine, and manually added the directory to sys.path
. When I try to import the module, python can't seem to find it. I can import tensorflow as tf
just fine, but python seems to be looking for the module in the wrong directory although I've explicitly given it the correct location:
>>> import tensorflow.contrib.learn.python.learn.datasets.mnist
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/__init__.py", line 25, in <module>
from tensorflow.contrib import cudnn_rnn
File "/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/cudnn_rnn/__init__.py", line 21, in <module>
from tensorflow.contrib.cudnn_rnn.python.ops.cudnn_rnn_ops import CudnnGRU
File "/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py", line 28, in <module>
resource_loader.get_path_to_datafile("_cudnn_rnn_ops.so"))
File "/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/util/loader.py", line 42, in load_op_library
ret = load_library.load_op_library(path)
File "/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 64, in load_op_library
None, None, error_msg, error_code)
tensorflow.python.framework.errors_impl.NotFoundError: /home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/cudnn_rnn/python/ops/_cudnn_rnn_ops.so: cannot open shared object file: No such file or directory
Verifying the file
ls -l ~/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/datasets
total 44
-rw-rw-r-- 2 rh rh 4660 Dec 1 12:09 base.py
drwxrwxr-x 3 rh rh 4096 Jan 12 19:57 data
-rw-rw-r-- 2 rh rh 2126 Dec 1 12:09 __init__.py
-rw-rw-r-- 2 rh rh 1334 Dec 1 12:09 load_csv_test.py
-rw-rw-r-- 2 rh rh 8308 Dec 1 12:09 mnist.py
-rw-rw-r-- 2 rh rh 1317 Dec 1 12:09 produce_small_datasets.py
drwxrwxr-x 2 rh rh 4096 Jan 12 19:57 __pycache__
-rw-rw-r-- 2 rh rh 2745 Dec 1 12:09 text_datasets.py
Verifying the path
>>> sys.path
['', '/home/rh/Applications/Anaconda/anaconda3/lib/python35.zip',
'/home/rh/Applications/Anaconda/anaconda3/lib/python3.5',
'/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/plat-linux',
'/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/lib-dynload',
'/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages',
'/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/Sphinx-1.4.6-py3.5.egg',
'/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg',
'/home/rh/Applications/Anaconda/anaconda3/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/datasets']
Tensorflow Info
$ conda list | grep tensorflow
tensorflow 0.12.0rc0 py35_0 jjhelmus
Only 1 Python Environment
$ conda env list
# conda environments:
#
root * /home/rh/Applications/Anaconda/anaconda3
$ type -p python
/home/rh/Applications/Anaconda/anaconda3/bin/python
My source code comes from a tensorflow tutorial that runs perfectly on OSX, something about the Ubuntu install/environment is wonky. I've been beating on this problem for a while without success. This related question doesn't address the issue either. Any suggestions?