Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reticulate does not care about the environment #428

Open
jan-glx opened this issue Feb 5, 2019 · 4 comments
Open

reticulate does not care about the environment #428

jan-glx opened this issue Feb 5, 2019 · 4 comments

Comments

@jan-glx
Copy link

jan-glx commented Feb 5, 2019

reticulate does not care about the environment

... sorry for the hopefully click bait title ...

Several open issues, namely, #292, #311, #338, #396, satijalab/seurat#677 are caused by python loaded by reticulate from a conda environment not finding shared libraries which would be found by python started directly from that environment. (leading to e.g. ImportError: /usr/lib64/libstdc++.so.6: version 'CXXABI_1.3.9' not found)

With this issue I hope to initiate a discussion on:

How should and how can reticulate handle the process environment & shared library search paths?

Here is what I think to understand about it:

  • reticulate loads libpython => R and python live in the same process
  • when loading python, reticulate modifies the environment a bit but not as much as conda activate would
  • these modifications could cause issues for the rest of the R session (might add an incompatible gcc version etc)
  • there is this partial workaround for windows
  • changing LD_LIBRARY_PATH of a running linux process has no effect
  • the problem only surfaces if the shared library versions are not available in the R environment (= always when using a HPC cluster, almost never when using your own up-to date machine )
  • there could be silent errors
  • probably the same points apply to virtualenv

My conclusion is:

  • reticulate cannot use a different (virtual) environment than the R process it is running in 😢
  • use_condaenv cannot work (without starting a separate process which it never will) and should be removed/deprecated in favor of starting the R session in the adequate conda environment (having conda manage R as well would help to handle conflicts between R and python requirements)

What do you think?

@imoutsatsos
Copy link

Also issue #367

@kevinushey
Copy link
Collaborator

I think the answer here is that ultimately use_condaenv() requires extra orchestration by the user to ensure that R is launched with the required environment set, and AFAIK it's not possible to dynamically modify the current R environment to match what e.g. conda activate might do.

@jan-glx
Copy link
Author

jan-glx commented Mar 26, 2021

Aaron Lun's package basilisk might be a suitable work around if your are affected by this. (It runs python in a separate process if necessary.)

@carmensandoval
Copy link

I have an issue that is related to this, and I wonder why it's not possible to simply tell reticulate to look for those shared libraries in the conda env in question.

#1285

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants