Open kch382001 opened 6 years ago
I don't think this will work as Python itself is reporting the location within your home directory (there is no way for us to know the location of the Python shared library w/o asking Python, as it varies considerably depending on how Python was built).
The python built within my home directory then distributed to a different account on server box actually worked fine except that "reticulate" does not work because the paths deduced from python binary point to the build directory structure. I am wondering if it is possible to configure the build so that python binary remembers the relative path of the shared lib instead of absolute path. Then reticulate can resolve the relative path on any machine when it deduces from python binary code. First of all, I do not know if that is possible or not? Secondly it would be nice to have an API to allow user to manually set the "libpython" and "pythonhome", is that an option?
Could you use the --prefix
option to specify the alternate path when you build? (see https://www.iram.fr/IRAMFR/GILDAS/doc/html/gildas-python-html/node36.html)
The only thing that fixed this issue for me was creating a new virtual environment. RStudio seems to not like you using the same virtual environment for multiple projects.
Summary of how to create a new virtual environment: python_path = '/usr/local/bin/python3' reticulate::virtualenv_create(envname = 'VIRTUALENV_NAME', python = python_path)
List what you want installed PYTHON_DEPENDENCIES = c('pandas', 'numpy') reticulate::virtualenv_install('VIRTUALENV_NAME', packages = PYTHON_DEPENDENCIES)
I built python under my personal account, then packaged it and distributed the binary to different servers. however I keep getting error running py_config() as below: Error in initialize_python(required_module, use_environment) : Python shared library '/home/kec5478/Python-3.6.4_build/lib/libpython3.6.so' not found, Python bindings not loaded
it turned out that "reticulate" deduced the shared library path based on the built account from the python binary. See py_discover_config() below:
My question is: how to handle this situation? If there is an API to change libpython path and pythonhome, that would solve the problem.