You are not logged in.

#1 2024-12-24 14:50:59

Succulent of your garden
Member
Registered: 2024-02-29
Posts: 132

After last update of arch, pip just broke for my python [Solved]

Hi

    Since the last update, my virtual environemnts just doesn't works well. I can't run any of my python stuff that I had. The main issue is that my virt environment doesn't found the modules that i had downloaded using pip. The error is like: ModuleNotFoundError: No module named 'Then insert here the name of the module' . You can see the modules downloaded in my project folder.

Also this happend to pip installation using python with source bin/activate. The pipenv method stays forever installing the dependecies, but I'm mostly sure that it's for the same issue. Nevertheless I'm going to try to create a new virt env and see if this is far more worse than I thought, but I need to repair my virt env for my projects also.

btw, pip --version works well outside of the virt env.

Last edited by Succulent of your garden (2024-12-28 23:25:58)

Offline

#2 2024-12-24 18:56:22

phoric
Member
From: Seattle, WA
Registered: 2011-10-17
Posts: 24

Re: After last update of arch, pip just broke for my python [Solved]

Since Archlinux has moved to Python 3.13, all of the virtual envs based on 3.12 will be broken.

There's a 3.12.8 release in the AUR here that you should be able to use: https://aur.archlinux.org/packages/python312

But you'll have to recreate your virtual envs either way most likely.

Offline

#3 2024-12-24 19:27:09

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 519

Re: After last update of arch, pip just broke for my python [Solved]

Don't rely on the repos for any project dependency. Use tools meant to let you use the desired version for each project. Multiple for Python exist, such as mise, uv, …

Offline

#4 2024-12-24 22:02:55

Succulent of your garden
Member
Registered: 2024-02-29
Posts: 132

Re: After last update of arch, pip just broke for my python [Solved]

Hi thanks both for your answers. But why is the case that after python update the virt env would not work ?

also is there a way to stil be using the virt env without downgrading python in my machine ? It is possible for example to install a specific python version for the virt env ?

do you recomend using uv ?

Thanks once again

Offline

#5 2024-12-24 22:13:33

phoric
Member
From: Seattle, WA
Registered: 2011-10-17
Posts: 24

Re: After last update of arch, pip just broke for my python [Solved]

Virtual env's are typically by default tied to the specific python version your system is using. Once 3.12 was removed, that virtual env simply needs to be recreated/reinstalled using 3.13, since 3.12 no longer exists on your system. Simply delete the .venv or ENV folder (or however you have it setup in your project), and recreate it.

If you find that you have some packages that don't work with 3.13 yet, then you can install a copy of 3.12 and point your virtual envs to that instead of the system's python. uv, pyenv, etc. This may or may not be necessary.

You should never attempt to downgrade your system-wide python version, as the OS depends on it.

Last edited by phoric (2024-12-24 22:16:41)

Offline

#6 2024-12-24 22:15:14

astralc
Member
Registered: 2022-09-17
Posts: 94

Re: After last update of arch, pip just broke for my python [Solved]

virtenv doesn't copy the python executable, just symlink (or something similar?) to it. and python install module to versioned site-packages folder
so when you upgrade the system python, it will use 3.13, which the modules doesn't match.
Installing 3.12 from aur is not downgrade, as it won't change the main 'python' version, and can be installed side by side. you can also use pyenv instead aur to install older versions.
(but recreating venv on 3.13 is still recommended unless you have some dependency/code that not work on it)

Offline

#7 2024-12-24 22:18:41

seth
Member
Registered: 2012-09-03
Posts: 60,805

Re: After last update of arch, pip just broke for my python [Solved]

https://wiki.archlinux.org/title/Python … ion_update
=> https://stackoverflow.com/questions/336 … r-switchin

uv is pip bUt wRiTtEn iN RuSt tHaT MaKeS Is sAfEr
https://wiki.archlinux.org/title/Python … y_Packages

You'll still have to rebuild everything that's not from the arch repos (hence rebuild and updated for you by pacman -Syu) to match the new python version.
Relying *more* on pip/uv/* just means that you'll have to rebuild more packages.

Edit: lol

Last edited by seth (2024-12-24 22:21:32)

Offline

#8 2024-12-25 08:04:16

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 519

Re: After last update of arch, pip just broke for my python [Solved]

uv is much more than pip

Offline

#9 2024-12-25 08:52:19

seth
Member
Registered: 2012-09-03
Posts: 60,805

Re: After last update of arch, pip just broke for my python [Solved]

Yes, it also covers pip-tools.
I'm not even saying it's not maybe a superior alternative to pip, but how does that help with the problem at hand?

You'll either have to update/rebuild your externally managed (whether pip or conda or aur) packages w/ python updates or maintain a completely parallel python stack (interpreter - yes, uv has internal commands to select those, but that's semantics - and the complete package list) - what will still require you to rebuild at least python bindings once in a while when the underlying library on the host gets an ABI/API incompatible update. You could of course also use docker or flatpak to then use fixed versions of those dependencies all the way down to glibc… or just not use a rolling release distro and run eg. debian stable where you don't have to worry about any of this for a couple of years because there're no version updates.

Offline

#10 2024-12-27 16:38:06

quiqueck
Member
Registered: 2013-04-15
Posts: 89

Re: After last update of arch, pip just broke for my python [Solved]

I had to install python 3.10 from AUR to create a venv with this version. When setting up the venv you can set the python version with the --python= switch:

virtualenv --python=3.10 yourvenv

Note that python versions in AUR are named like python312 for python version 3.12. I had to install python310 for creating a venv like shown above.

Offline

#11 2024-12-28 23:25:04

Succulent of your garden
Member
Registered: 2024-02-29
Posts: 132

Re: After last update of arch, pip just broke for my python [Solved]

hey everyone, just here to say many thanks to all of you in commenting in this post thread. It help me clarify how to deal with this, it's very simple in the end but nevertheless thanks.

Offline

#12 2024-12-29 00:10:55

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 681

Re: After last update of arch, pip just broke for my python [Solved]

quiqueck wrote:

I had to install python 3.10 from AUR to create a venv with this version. When setting up the venv you can set the python version with the --python= switch:

virtualenv --python=3.10 yourvenv

Note that python versions in AUR are named like python312 for python version 3.12. I had to install python310 for creating a venv like shown above.

A better way nowdays is to create your venv using `uv`:

uv venv -p 3.10

uv will install python 3.10 "on the fly" if you don't already have it, as the venv is created. No need for the AUR as uv manages it's own cache of python versions and it is all done extremely quickly.

Offline

#13 2024-12-29 11:44:30

Succulent of your garden
Member
Registered: 2024-02-29
Posts: 132

Re: After last update of arch, pip just broke for my python [Solved]

bulletmark wrote:
quiqueck wrote:

I had to install python 3.10 from AUR to create a venv with this version. When setting up the venv you can set the python version with the --python= switch:

virtualenv --python=3.10 yourvenv

Note that python versions in AUR are named like python312 for python version 3.12. I had to install python310 for creating a venv like shown above.

A better way nowdays is to create your venv using `uv`:

uv venv -p 3.10

uv will install python 3.10 "on the fly" if you don't already have it, as the venv is created. No need for the AUR as uv manages it's own cache of python versions and it is all done extremely quickly.

Oh I see. And uv downloads the package from the pip repository ?

Offline

#14 2024-12-29 17:50:56

loqs
Member
Registered: 2014-03-06
Posts: 18,227

Re: After last update of arch, pip just broke for my python [Solved]

Succulent of your garden wrote:
bulletmark wrote:

uv will install python 3.10 "on the fly" if you don't already have it, as the venv is created. No need for the AUR as uv manages it's own cache of python versions and it is all done extremely quickly.

Oh I see. And uv downloads the package from the pip repository ?

uv uses https://github.com/astral-sh/python-build-standalone/ for its python binaries (except pypy) which is another project from astral-sh.

Offline

#15 2024-12-29 19:51:03

Succulent of your garden
Member
Registered: 2024-02-29
Posts: 132

Re: After last update of arch, pip just broke for my python [Solved]

Oh i see, thanks for the reply

Offline

Board footer

Powered by FluxBB