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

use_virtualenv can't find venv/bin? #453

Closed
zkurtz opened this issue Mar 13, 2019 · 2 comments
Closed

use_virtualenv can't find venv/bin? #453

zkurtz opened this issue Mar 13, 2019 · 2 comments

Comments

@zkurtz
Copy link

zkurtz commented Mar 13, 2019

Context: On OSX with a virtualenv named "venv" and an anaconda installation in the background (outside of venv)

Problem: Importing my python module as reticulate::import("mymodule") was complaining about not being able to find matplotlib even after running use_virtualenv("/Users/me/mypackage/venv"). This problem occurred in Rstudio but did not occur from a terminal R session initiated inside of the activate virtual environment.

Temporary solution: Basically the same as suggested in #367, which is to tell reticulate to look inside of venv/bin by updating the system PATH before loading the library:

vbin = "/Users/me/mypackage/venv/bin"
Sys.setenv(PATH= paste(vbin,Sys.getenv()["PATH"],sep=":"))
library(reticulate) 
@kevinushey
Copy link
Collaborator

Can you run py_config() to confirm that reticulate was indeed using the virtual environment as you expected?

@zkurtz
Copy link
Author

zkurtz commented Mar 13, 2019

Running py_config() showed that it was pointing to a random conda environment. I don't see how my virtualenv could have become associated with that conda env. Anyway, I removed that conda env and now my virtualenv works again with use_virtualenv.

@zkurtz zkurtz closed this as completed Mar 13, 2019
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

2 participants