python - 设置 PyCharm 远程 conda 解释器

标签 python amazon-ec2 pycharm anaconda conda

我正在尝试在 MacOS Mojave 上设置远程 conda 解释器 PyCharm for Anaconda 2019.1.2 Pro,无法运行。我现有的远程 conda 环境 (v4.5.12) 正在 Ubuntu 16 EC2 机器上运行,实例化自 Amazon's Deep Learning AMI

我试过了 setting up an ssh-interpreter ,并将其定向到:/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/python 这是我的 conda 环境。然后我尝试在这个解释器上运行一个简单的 Tensorflow GPU 测试并得到以下消息,强烈建议环境未激活:(服务器的 IP 地址和公司名称被故意混淆)

ssh://ubuntu@xx.xx.xx.xx:22/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/python -u /home/ubuntu/company/DeepLearning_copy/apps/test_gpu.py
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/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/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/company/DeepLearning_copy/apps/test_gpu.py", line 1, in <module>
    import tensorflow as tf
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/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/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

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

当 SSH 连接到服务器时,代码运行完美,运行 conda activate tensorflow_p36 然后 python gpu_test.py

如果有任何允许使用现有远程 conda 环境进行远程调试的解决方法,我将不胜感激。 同时我打开了an issue with JetBrains , 和 Anaconda community group .

编辑:请参阅 the JetBrains issue page 中的潜在解决方法

最佳答案

你可以做的是:

  1. 转到“运行/调试配置”
  2. 在“环境”下你可以看到“环境变量”
  3. 您必须设置正确的 cuda 路径。在我的例子中是:“LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64”

我也很失望,JetBrains 团队没有默认完成它。

关于python - 设置 PyCharm 远程 conda 解释器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56098247/

相关文章:

python - 在 Python 中获取最高的字符串版本号

amazon-ec2 - 更改 EC2 Windows server 8 R2 上的屏幕分辨率?

python - 在 Pandas 中使用循环重命名列

node.js - 我正在尝试使用 .ebextension 配置在弹性 bean 堆栈上安装 pdftk 服务器,但无法安装

python - 如何让 Python 应用程序在 EC2 实例中运行?

python - 在 Python 3.6 上安装 MySqlDB

python - 在 PyCharm 中使用 Vue.js 时出现 "Unidentified character <"错误

python - 如何使用python命令执行python脚本

python - Lambda 数据框引用另一列中的值

python - 重复字符串匹配 Leetcode