Alv*_*ise 4 python remote-debugging pycharm tensorflow
我正在使用PyCharm进行远程调试,客户端Win10,服务器Ubuntu16。在Ubuntu计算机上,我正确安装了Cuda 8.0,以及python 2.7和tensorflow 1.0.0。Tensorflow可以在服务器上完美运行(ssh +调用python,导入tensorflow等。)。
在PyCharm中,我在服务器上设置了一个远程调试器,但是现在导入tensorflow会导致错误:
Traceback (most recent call last):
File "/home/*****/*****/********/*******.py", line 24, in <module>
import tensorflow as tf
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 60, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
Error importing tensorflow. Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.
Run Code Online (Sandbox Code Playgroud)
我试过了:
将正确的路径添加到sys.path变量
将LD_LIBRARY_PATH添加到os.environ和/或PyCharm环境变量
没有成功!
我记得很久以前,我可以毫无问题地进行调试,但是我不知道出了什么问题。有什么建议吗?
UPDATE 1 重新启动后,错误更改为
ssh://****@192.168.***.***:22/usr/bin/python -u /home/*****/.pycharm_helpers/pydev/pydevd.py --multiproc --qt-support --client '0.0.0.0' --port 35523 --file /home/*/*/*/*/test.py
warning: Debugger speedups using cython not found. Run '"/usr/bin/python" "/home/*/.pycharm_helpers/pydev/setup_cython.py" build_ext --inplace' to build.
pydev debugger: process 1913 is connecting
Connected to pydev debugger (build 163.10154.50)
Traceback (most recent call last):
File "/home/*/.pycharm_helpers/pydev/pydevd.py", line 1596, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/*/.pycharm_helpers/pydev/pydevd.py", line 974, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/*/*/*/*/test.py", line 1, in <module>
import tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)
更新2 /已解决 正如我之前尝试的那样,解决方案是在pycharm上将LD_LIBRARY_PATH添加到配置面板上的环境变量。我认为在名称(->'LD_LIBRARY_PATH')之后的空格之前,它不起作用。这里的解决方案: 解决方案
解决方案是向Pycharm环境面板添加正确的路径:
LD_LIBRARY_PATH='/usr/local/cuda/lib64'
Run Code Online (Sandbox Code Playgroud)
或适合您的配置的一种。
您收到的错误消息是“请退出tensorflow源代码树,并从那里重新启动您的python解释器。”。
通常,如果您下载tensorflow源代码,手动编译它等,安装它,然后启动python并在源文件夹中导入tensorflow,您通常会收到此错误消息。
您可以尝试阻止此错误的操作: - 检查tensorflow源是否位于您正在运行远程应用程序的文件夹中(您是否遵循类似的操作来使其正常工作?http://www.pinchofintelligence.com/faster- writing-and-testing-machine-learning-applications/) - 尝试查找并删除tensorflow源文件夹 - 重新启动你的电脑(这会清除你可能正在其中运行东西的 /tmp 文件夹)
希望其中一件事情有效,请告诉我!
| 归档时间: |
|
| 查看次数: |
2281 次 |
| 最近记录: |