You are not logged in.
do i need to create separate virtual environments for each externally managed python package I want to install. Or can I install several packages to the same venv?
Thanks
Last edited by callmejoe (Today 04:15:51)
Offline
Are you asking about Python based applications you want to install to run? Or Python packages you want to install to develop/import into your own app etc?
The point of a venv is to completely isolate applications and have no possibility of package version clashes etc. We all tend to have huge and under-used hard disks and most of the venvs are small anyhow so you really are better off keeping installed applications isolated. Use `pipx` (or an equivalent tool) to install, update, and remove such applications. `pipx` will create an isolated venv for the app and then create a symlink to the executable in your personal PATH. Of course, you are better off sticking to system or AUR provided packages for such apps if you can and only use `pipx` for applications not available otherwise, or to get a later version.
If you are asking about packages you want to install for your own use, e.g. for developing an app, then you would typically create a single venv in your project directory and install all the required packages into that. E.g. list your required packages in a requirements.txt file (specifying explicit versions if you want) and:
python -m .venv
.venv/bin/pip install -r requirements.txt
Offline
thanks bulletmark
I needed to install a specific python package to import into a script. The one i needed was not in the repos or aur. I did try using pipx but gave me an error: "No apps associated with package wayfire or its dependencies. If you are attempting to install a library, pipx should not be used. Consider using pip or a similar tool instead."
so i set up a a virtual env with python -m venv /opt/python and installed the python package there. maybe i should have used python -m venv /opt/python/wayfire and then future projects under /opt/python/fooX to better manage them.
Seems like there are some nuances and personal preferences that go into how to manage these external packages.
I'll keep refining as I go. thanks again.
Offline
I needed to install a specific python package to import into a script. The one i needed was not in the repos or aur.
Then make a PKGBUILD for it. There's a template PKGBUILD for any package available via pip.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Then make a PKGBUILD for it. There's a template PKGBUILD for any package available via pip.
yes that is a good suggestion. i'll do just that.
Offline