While I run the following code in Jupyter notebook:
我在Jupyter笔记本中运行以下代码:
import tensorflow as tf
a = tf.constant("hello world!")
sess = tf.Session()
print(sess.run(a))
I got the following error messages:
我收到以下错误消息:
ImportError: Traceback (most recent call last):
File "/home/ac/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/ac/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/ac/anaconda3/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 "/home/ac/anaconda3/lib/python3.6/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/home/ac/anaconda3/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
However, the same code if I run directly through python, it works as expected.
但是,如果我直接通过python运行相同的代码,它按预期工作。
Here is my environment:
这是我的环境:
- Ubuntu 16.04
- Tensorflow 1.5
- Cuda 9.0
- Cudnn 7
- Nvidia Driver 390.12
- Python 3.6
- Anaconda 3
Nvidia Driver 390.12
The issue happens after I recently upgrade the Tensorflow. Before I was using Tensorflow 1.4 with Cuda 8 and Cudnn 6. However, I feel this is more like Jupyter notebook issue than Tensorflow installation.
我最近升级Tensorflow后问题就出现了。在我使用Tensorflow 1.4与Cuda 8和Cudnn 6之前。但是,我觉得这比Tensorflow安装更像是Jupyter笔记本问题。
I also tried other solution like export LD_LIBRARY_PATH
, no luck. I wonder if the Jupyter using the different library than the avocado environment? Or this issue is caused by some failure installation?
我也试过像导出LD_LIBRARY_PATH这样的其他解决方案,没有运气。我想知道Jupyter是否使用了不同于鳄梨环境的库?或者这个问题是由安装失败引起的?
1 个解决方案
#1
0
The solution I found is following:
我找到的解决方案如下:
First, I installed the Jupyter extension nb_conda via conda install nb_conda
, which will add the ability to view the current kernel environment in Jupyter. Then I realize the Jupyter doesn't use the correct environment I expected.
首先,我通过conda install nb_conda安装了Jupyter扩展nb_conda,这将添加查看Jupyter中当前内核环境的功能。然后我意识到Jupyter没有使用我期望的正确环境。
Second, install Jupyter under the wanted environment conda install Jupyter
.
其次,在想要的环境下安装Jupyter conda安装Jupyter。
Finally, the Jupyter is running under the environment where calls jupyter notebook
.
最后,Jupyter在调用jupyter notebook的环境下运行。
Hope this will help anyone encountered the same issue as I did.
希望这会帮助任何人遇到与我相同的问题。
#1
0
The solution I found is following:
我找到的解决方案如下:
First, I installed the Jupyter extension nb_conda via conda install nb_conda
, which will add the ability to view the current kernel environment in Jupyter. Then I realize the Jupyter doesn't use the correct environment I expected.
首先,我通过conda install nb_conda安装了Jupyter扩展nb_conda,这将添加查看Jupyter中当前内核环境的功能。然后我意识到Jupyter没有使用我期望的正确环境。
Second, install Jupyter under the wanted environment conda install Jupyter
.
其次,在想要的环境下安装Jupyter conda安装Jupyter。
Finally, the Jupyter is running under the environment where calls jupyter notebook
.
最后,Jupyter在调用jupyter notebook的环境下运行。
Hope this will help anyone encountered the same issue as I did.
希望这会帮助任何人遇到与我相同的问题。