On 2024-12-31 15:00:10 -0900, Tim Johnson via Python-list wrote: > being retired for ten years, I get my butt kicked by python dependencies > every time I upgrade ubuntu. (I'm newly on 24.04) now. > > Now, after three weeks on using the following code correctly: > > from mutagen import mp3, id3, File as mutaFile > from mutagen.id3 import ID3, TIT2, TPE1 > > I am as of today, getting an import error for mutagen.
So what changed between the last time it worked and today? Did you upgrade anything, install anything, delete anything, change permissions, etc.? Or maybe just invoke your scripts in a different context (different user, different environment) than before? > Mutagen package is > installed at /root/.local/share/pipx/shared/lib/python3.12/site-packages As Michael already noted, /root is not normally accessible by normal users. So installing stuff into /root/.local is a bad idea unless you only ever want to use it as root (which in the case of an audio metadata library seems unlikely). > Must I be using a virtual environment? I use virtual environments a lot, but that may not be the best option for you. Especially if you mostly writing command line tools and having difficulties with upgrades, it might be a good idea to stick with packages supplied by Ubuntu (I'm guessing that “24.04” above refers to “Ubuntu 24.04 LTS”). There are over 5000 of them, so it is very likely that you don't need anything else. This way Ubuntu's package management will take care of all the dependencies. Good reasons to use virtual enviroments (on Linux) include: * You have many different products[1] with different requirements running on several computers and you want to decouple upgrades of your products from upgrades to the hosts' OS. * You need either a package or a specific version not supplied by your distribution. * You can't install packages on the target host. A not so good reason is: * You are not familiar with your distribution's package manager. hp [1] By "product" I mean a collection of software for a common purpose. That might be a collection of scripts, it might be web site, etc. -- _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | h...@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
-- https://mail.python.org/mailman/listinfo/python-list