-
Notifications
You must be signed in to change notification settings - Fork 152
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
Guidance on best practices for using renv with python virtualenvs #537
Comments
While I'm thinking out loud (and assuming my expectations are not entirely off the mark), I could envision two possible solutions:
Hope this makes some sense! |
You're right, the current behavior of We should definitely make it possible for |
I actually still like the idea of a project-local python environment, I guess I was just selfishly hoping that Or if copying over |
Indeed that would be very helpful and avoid all the manual installation. |
I would definitely much prefer this solution-- I have a complicated Python virtualenv used by one of my R packages that eats up nearly 1 GB of disk space. I don't want to make a copy of it, or rebuild it, every time I do a new R analysis. |
FWIW this should now be possible in the development version of
and |
Hi Kevin,
I am starting to use
{renv}
more and more to make sure myR
-centric projects are truly self-contained and reproducible. But I have a specific project that also happens to also usepython
quite a bit and I'm looking for a little guidance on best practices for setting up avirtualenv
using{renv}
with the least amount of friction.As an example, I have a
virtualenv
which lives in the default location on my Mac (/Users/matt/.virtualenvs/r-reticulate
). This virtualenv is the one I generally bind to when using{reticulate}
because I have installed all of thepython
packages I need in that envrionment. So when I am ready to use python in myrenv
-initialized project, I callrenv::use_python("/Users/matt/.virtualenvs/r-reticulate/bin/python")
and point it toward the python binary found in this virtualenv. This creates avirtualenv
in therenv/
directory, but that newly created virtual environment doesn't contain any packages.I guess my expectation was that since I define my
python
dependencies in myR
scripts viaalias <- import("package")
declarations, that I maybe expected the virtualenv would be set up in a similar way to how theR
library is set up, such thatrenv
would detect myimport
s and make sure they are included in therenv/python/virtualenvs
that was created.So it seems like I have two options to get the new virtual environment up to speed, (1) start installing
python
packages withreticulate::virtualenv_install()
and they will now be installed in myrenv/python/virtualenv/renv-python...
, or (2) I can export therequirements.txt
from the/Users/matt/.virtualenvs/r-reticulate
and restore them. Both of these are a little more manual than I was hoping.Any suggestions? Is my mental model of how python is managed by
renv
completely misguided?Thanks for your help!
The text was updated successfully, but these errors were encountered: