3

我无法让reticulateR 中的包正常工作。

LIBPYTHON无论我通过哪个版本的 Python 加载module load,或者我告诉使用哪个版本,它都找不到它需要的共享文件reticulate,直接在 R 中。

我正在研究大学的集群,它安装了多个版本的 Python,并通过模块加载。

谢谢您的帮助。

a) 使用 2.7.9 版本(默认版本来自module load CBC):

> reticulate::py_discover_config()

python:         /opt/Python/Python-2.7.9/bin/python
libpython:      /opt/Python/Python-2.7.9/lib/libpython2.7.so[NOT FOUND]
pythonhome:     /opt/Python/Python-2.7.9:/opt/Python/Python-2.7.9
version:        2.7.9 (default, Apr 23 2015, 22:07:47)  [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
numpy:          /opt/Python/Python-2.7.9/lib/python2.7/site-packages/numpy
numpy_version:  1.9.2

b) 通过在 R 中指定来使用 2.7.10 版reticulate

> reticulate::use_python("/opt/Python/Python-2.7.10/bin/python2")
> reticulate::py_discover_config()

/opt/Python/Python-2.7.10/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
Error in system2(command = python, args = paste0("\"", config_script,  :
  error in running command

module load CBC python/2.7.10c)在开始 R / 加载之前运行,使用 2.7.10 版本reticulate


> system("which python")

/opt/Python/Python-2.7.10/bin/python

> library(reticulate)
> py_discover_config()
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/home/csandoval/R/x86_64-pc-linux-gnu-library/3.5/reticulate/config/config.py", line 3, in <module>
    import os
  File "/opt/Python/Python-2.7.10/lib/python2.7/os.py", line 400, in <module>
    import UserDict
  File "/opt/Python/Python-2.7.10/lib/python2.7/UserDict.py", line 84, in <module>
    _abcoll.MutableMapping.register(IterableUserDict)
  File "/opt/Python/Python-2.7.10/lib/python2.7/abc.py", line 109, in register
    if issubclass(subclass, cls):
  File "/opt/Python/Python-2.7.10/lib/python2.7/abc.py", line 184, in __subclasscheck__
    cls._abc_negative_cache.add(subclass)
  File "/opt/Python/Python-2.7.10/lib/python2.7/_weakrefset.py", line 86, in add
    self.data.add(ref(item, self._remove))
TypeError: cannot create weak reference to 'classobj' object
Error in python_config(python_version, required_module, python_versions) :
  Error 1 occurred running /usr/bin/python
In addition: Warning message:
In system2(command = python, args = paste0("\"", config_script,  :
  running command ''/usr/bin/python' "/home/csandoval/R/x86_64-pc-linux-gnu-library/3.5/reticulate/config/config.py"' had status 1

共享库 ( .so) 文件似乎确实存在,至少对于 2.7.10 而言,所以我完全不知道接下来要尝试什么:

> locate 'libpython2'

/opt/Python/Python-2.7.10/lib/libpython2.7.so
/opt/Python/Python-2.7.10/lib/libpython2.7.so.1.0
/opt/Python/Python-2.7.10/lib/python2.7/config/libpython2.7.a
/opt/Python/Python-2.7.3/lib/libpython2.7.a
/opt/Python/Python-2.7.3/lib/python2.7/config/libpython2.7.a
/opt/Python/Python-2.7.4/lib/libpython2.7.a
/opt/Python/Python-2.7.4/lib/python2.7/config/libpython2.7.a
/opt/Python/Python-2.7.9/lib/libpython2.7.a
/opt/Python/Python-2.7.9/lib/python2.7/config/libpython2.7.a
/opt/local/lib/libpython2.6.a
/opt/local/lib/libpython2.6.a.old
/opt/local/lib/python2.6/config/libpython2.6.a
/opt/local/lib/python2.6.old/config/libpython2.6.a
/opt/scyld/python/2.6.5/lib/libpython2.6.so
/opt/scyld/python/2.6.5/lib/libpython2.6.so.0.1
/opt/scyld/python/2.6.5/lib/python2.6/config/libpython2.6.a
/usr/cellprofiler/lib/libpython2.7.so
/usr/cellprofiler/lib/libpython2.7.so.1.0
/usr/cellprofiler/lib/python2.7/config/libpython2.7.a
/usr/lib64/libpython2.6.so
/usr/lib64/libpython2.6.so.1.0
/usr/lib64/python2.6/config/libpython2.6.so
/usr/share/systemtap/tapset/libpython2.6-64.stp
4

0 回答 0