rye
rye copied to clipboard
Creating empty virtual envs
Hi!,
I'm looking for a way to set a standalone virtualenv, which will be use as default python by apps like vscode or pycharm or nvim. Is there an existing way to do this?
Can you provide more details about this request? Is this about having some sort of throwaway virtualenv?
yeah!, something like what pyenv-virtualenv does
I'm not entirely sure I understand what the point of this is in the context of rye. Can you elaborate how you would use this?
A use example is python neovim, which requires pynvim to be installed. As I don't want to install pynvim globally, I need a virtual environment to install it. It is also not a tool, so it does not quite fit using the install command of Rye.
Another use example is pycharm, which requires a python installation for running its tools I think.
In general, the use case is where another program uses python, but you don't use python or tools directly.
As Rye manages python versions and virtual environments, I think it would be a good thing to have
Would pipx be a solution? It is what you should use to install python applications globally for your user. Unlike pip
it ensures your local installations do not conflict with each other when they have the same dependency but not necessarily at the same version. It does this by creating separate virtual environments for each application.
python3 -m pip install --user pipx
python3 -m pipx ensurepath
python3 -m pipx install pynvim
pipx is aimed for end-user apps. pynvim is just a package, not an end user app, so I think that wouldn't be a solution
Closing this as out of scope for Rye.
@mitsuhiko Not sure if this was the OP's intent, but here's a use case: I usually work on multiple projects with a general theme (in my case scientific computing) that share many dependencies. What I used to do (and wanted to replicate with rye
, but couldn't find a clear-cut solution) was to create a shared conda
virtual environment (e.g., called dev
or sci
), which would host all shared and non-shared dependencies of these projects, so every time I wanted to work on one, everything would just work right out of the box without having to constantly switching virtualenvs.
I'm very new to rye
, but so far, it seems that one way to achieve this in rye
is to install all those dependencies in the global scope, which doesn't seem like a good idea (?).
In that case you can probably use a virtual project: https://rye-up.com/guide/virtual/
Would that work for you?
Thanks for the pointer, I'm experimenting with it atm; I think it'll do the job.