Python stuff breaking after update

After my last system update, seems like anything to do with python broke. Has anyone else experienced this?

I got my own projects working (from what I remember, running their virtual environment and re-installing modules that should have been there already)

But ComfyUI is a bust. I made some progress with ChatGPT, but it still won’t run because it’s failing to install requirements, and under ChatGPT’s advice I installed rust using its own updater curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
and I still get the same error, this is the last part of the output after running pip install -r requirements.txt;

Collecting kornia-rs>=0.1.0 (from kornia>=0.7.1->-r requirements.txt (line 17))
  Using cached kornia_rs-0.1.7.tar.gz (71 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      error: failed to parse manifest at `/tmp/pip-install-7zq5pnpg/kornia-rs_e09f59020e334ad2967d1d1f8751b8f1/kornia-py/Cargo.toml`
      
      Caused by:
        can't find library `kornia_rs`, rename file to `src/lib.rs` or specify lib.path
      💥 maturin failed
        Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?
        Caused by: `cargo metadata` exited with an error:
      Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/tmp/pip-modern-metadata-qy71x7dw', '--interpreter', '/mnt/user/AI/ComfyUI/venv/bin/python']' returned non-zero exit status 1.
      Checking for Rust toolchain....
      Running `maturin pep517 write-dist-info --metadata-directory /tmp/pip-modern-metadata-qy71x7dw --interpreter /mnt/user/AI/ComfyUI/venv/bin/python`
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

There was a recent python update so anything coming from the AUR needs to be rebuilt.

1 Like

Ok thanks… I will take it to the ComfyUI community then.

So whats the deal with virtual envrionments then? I thought they were supposed to protect against exactly this…

Did you build a venv for this and install it into it with all it’s dependencies?

Perhaps it would be helpful if you explained how you explained how you installed ConfyUI.

Also, as mentioned above, anything you installed from AUR needs a rebuild after a python update. This is a simple process, have you tried that as well?

Lastly, be sure to never install anything with sudo pip or running pip as root in general. That can easily break your python environment completely.

python virtual environments are meant to keep dependencies separate, especially from your system python packages. Since they usually link to your system python binary when there are major version updates you have to rebuild all your virtual environments and update them to the new version. If you use something like uv to help manage things I think it will download the right python version for you if you don’t have it installed.
Ultimately if you need more isolation than virtual environments provide you’re probably better off using a docker container where you can define exactly what versions of everything you’re using.

Yes I have a virtual environment for ComfyUI, I run it with this script;

source venv/bin/activate
python main.py --preview-method auto
deactivate

That’s why I asked what’s going on, this has never been an issue till today and I’ve been running ComfyUI for about a year now.

Ok well, as I said in the first post, I got my own python projects working by simply re-installing the modules that should have already been there, but ComfyUI has many strange errors that I got ChatGPT to talk me through

I made a lot of progress with versions of torch, skipping torchaudio because it’s not really needed, but this “kornia” package needed special treatment, I had to install rust, tried from the package manager, but ended up having to reverse that and install via rustup, and then still got the same error “maturin failed” as above in my first post.

I just figured this was crazy having to step through with ChatGPT and there must be a solution by now, I can’t be the only person running ComfyUI on an Arch based system and figured if I post here someone would be able to tell me what the answer is.

Today I learned that when python is updated, all your virtual environments will break, I never expected this, I thought they would have their own local version of python.

It depends on what tools you use to build your virtual environments. If you want to avoid this in the future, try using pyenv, which can install just about any version of python. For there, you can create a new VE.

If you built your VE with the installed version of python, take a look at how the environment links its python packages. For example, in this VE (created from pyenv-installed python 3.13) my python binaries are linked like this:

python@ ⇒ python3
python3@ ⇒ /home/ajgringo619/.pyenv/versions/3.13.1/bin/python3
python3.13@ ⇒ python3

In another one, where I’m using the Arch-installed binary (and specifically enabled using system libraries), it looks like this:

python@ ⇒ python3
python3@ ⇒ /usr/bin/python3
python3.13@ ⇒ python3

The second one is obviously one I need to watch whenever a major release of python is installed, especially if I’ve installed any local modules via pip.

Ok thank you, that’s enlightening, I never realised that was something we had to take responsibility for outside of the venv.

Well for now I actually got my way through with ChatGPT, I think after that last error I just needed a system restart. Had to install rustup, had to install cmake, kept trying pip install -r requirements.txt after every fix (with the venv active of course) and finally it worked.