python shared library not found in R reticulate

2019-08-21 00:59发布

I am having trouble getting the reticulate package in R to work.

It cannot find the shared LIBPYTHON file it needs, no matter which version of Python I have loaded via module load, or which version I tell reticulate to use, directly within R.

I'm working on the universty's cluster, which has several versions of Python installed and are loaded via modules.

Thank you for your help.

a) Using version 2.7.9 (default version from 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) Using version 2.7.10 by specifying within R to 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

c) Using version 2.7.10 by running module load CBC python/2.7.10 prior to starting R / loading 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

The shared libraries (.so) files do seem to exist, at least for 2.7.10, so I am at a complete loss as to what to try next:

> 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

0条回答
登录 后发表回答