Score:0

python virtual environment on rolling distro (Arch)

gb flag

I am a big fan of the rolling distribution model. I do need help with one hiccup. when I create a virtual environment in python to isolate a project all works great until my rolling distro upgrades python versions.

When this happens my python project no longer works, so I destroy my venv and create a new one. It seems like I shouldn't have to be this drastic in my approach. It takes a while and as the number of projects grows this doesn't scale well.

Here's how I'm creating my venvs:

$ python -m venv venv
$ source venv/bin/activate
$ command -v python
$ python -m pip install --upgrade pip
$ python -m pip install django     # or whatever
$ python --version && python -m django --version
  1. am I creating my venv wrong?
  2. if upgrading the system's python breaks my venvs, is there an elegant way to fix rather than just recreating the venv?
in flag
That's the reason why rolling distributions are a no go for stable business environments.
djdomi avatar
za flag
use a container or similar to Archiv the goal imho
Score:2
cn flag

Let's assume a venv was created with python3.9, right before python3.10 was released. venv will create a bin directory symlinked to the system python, as in venv/bin/python3 -> /usr/bin/python3 This unversioned python binary itself might not a problem. However, the site-packages directories are major version specific, which makes your python3.9 projects no longer work.

I consider venvs an immutable set of a given python version and installed libraries. When major changes happen, destroy and recreate seems reasonable. They are lightweight. Of course I have not had to do this repeatedly like you have. Consider improving your automation such that you can rebuild all of these at once on demand.

Arch is not interested in maintaining a python for a very long time, based on their rolling distro concept. Maybe you can find and are comfortable with a user contributed package maintaining say python39 on AUR, but maybe not. Consider switching to a long term support distro so you have more time on a given major version of Python. Could be confined to containers or whatever, doesn't need to replace all you like about Arch.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.