$ python3 -m pdm install
/usr/bin/python3: No module named pdm
$ pipx install pdm
'pdm' already seems to be installed. Not modifying existing installation in
'/home/mcc/.local/pipx/venvs/pdm'. Pass '--force' to force installation.
For heck's sake this is just going to happen every time Ubuntu upgrades python forever, isn't it.
I thought the entire point of pipx was to prevent this.
The quickfixes I used last time to fix this problem are not fixing it :(
pipx force-reinstall did not work. pipx install --force pdm did not work. rm -r ~/.local/pipx/ && pipx install pdm did not work. any of the above followed by opening a new bash shell did not work. starting to get worried. maybe ubuntu has simply decided i should not be using pipx to install apps anymore.
Wait.
I can't access my pipx-installed pdm by running `python3 -m pdm`, but I can access it by just running `pdm`.
?? ??? ?why ??? would that ??? change ?????!
@mcc anything pipx-installed would not be accessible as `python -m ...`
@whitequark Oh.
Then why… was it… before
@mcc you had pdm installed in some other way that was competing
@whitequark sincerely not sure how that could have happened since ubuntu bans the use of pip
@whitequark @glyph another thing confusing me is what this means and why i haven't seen it before. i assume that in moving from whatever broken pdm i had to whatever pdm i've got now, i did a big version jump??
also when i try to install i get a failure on numpy with no error message :(
@whitequark @glyph update, pdm fix and changing my pyproject.toml to require a more recent version of python have resolved my issues??? i'm just gonna chalk this up to user error and move on, thank you for the help
@whitequark @mcc okay I think I have a forensic reconstruction of a possible scenario:
If you made a --system-site-packages virtualenv and THEN did a pip install --user, it would silently stick things into ~/.local/lib/python3.$X in a way that would be importable by the system python and that would never warn you in any way.
This might be a bug in something
@glyph @whitequark it's probably impossible to figure out what I did D: I didn't actually understand how to use pipx when I first set up this machine
@mcc @whitequark no need to stress about figuring it out precisely, this is a legit bug either way :)
@glyph @whitequark well what i fear is there might have been a point when i was trying to figure out how pipx worked that i just tried every thing i could think of and one of them might have resulted in something Weird
what's mostly weird to me is the LAST time python updated and blew away my pipxes, i just said "pipx install --force pdm" and THAT fixed it. so that's weird in a way "i fucked my system and it worked in a configuration it shouldn't have" isn't. the fucked->unfucked->fucked cycle
@mcc @whitequark as I am attempting to validate my discovery the upgrade is going great and also incredibly thematically appropriately for this particular conversation
@mcc @whitequark update: the VM no longer even boots. Just starts up to BIOS, I think it corrupted something so badly that the boot … sector? EFI configuration? … is no longer even recognizable
@glyph @whitequark Yup this sounds like python package management to me
@mcc @whitequark going to start calling Apple’s System Integrity Protection subsystem the Safely Install Python subsystem
@mcc @whitequark okay just for posterity I do want to point out that this is a joke, and that the thing that destroyed my ubuntu install was an Ubuntu installer bug, nothing to do with Python
@glyph @mcc @whitequark they did a glyph edition just for you! Quite the dedication to user experience!
@glyph @mcc @whitequark That's fair, but I have seen people render their systems unbootable just by accidentally trying to install a different version of Python as /usr/bin/python on Ubuntu.
@glyph @mcc @whitequark
It's frustrating that there's no good way I can just point people to to install versions of Python that they can use for pipx and PDM managed venvs. System python is bad because it will break your venvs when you update. deadsnakes works OK but cumbersome to set up and ensure you have everything you need installed (you need to explicitly install the `python3.x-venv` package, and I think that), pyenv requires building Python from scratch, etc.
@unlambda @mcc @whitequark yeah, tell me about it. I view OS pluralism as important and I don't want to promote a monoculture but whenever anyone asks me for advice on a *personal* level "if you do development, buy a mac" is all I've got, and I hate it.
@glyph @mcc @whitequark Does "buy a Mac" help all that well with this? You still have to deal with system python vs homebrew or whatever, if you accidentally use a system python for a venv it could break on upgrade.
@unlambda @glyph @whitequark yeah uh honestly my python environment troubles were greater on my mac than they are on my linux machine
@unlambda @mcc @whitequark No, you don't. There's no such thing as "system" Python. Just install Python from Python.org. There's still an ocean of confusing stuff out there (not least of which is Xcode python and Xcode CLT python, which can masquerade as "system" for some purposes) but the presence of a first-party build addresses almost all of these problems.
@glyph @unlambda @whitequark Until you install homebrew, as most command line mac users do, and homebrew installs its own python, and then you have to decide between installing the python.org python and having two pythons or just using the homebrew python and now having all the problems caused by a package-manager-managed python.
@mcc @unlambda @whitequark While I certainly wish I could convince Homebrew to stop putting `python` and `python3` on $PATH, homebrew is itself effectively an application and can be blown away and reprovisioned if you mess it up bad enough. Force-installing a python module on your mac cannot render your system unbootable or make any first-party or system-provided applications impossible to launch.
@mcc @unlambda @whitequark like, you can absolutely have a really bad time with Python nearly anywhere (why not install MacPorts and Homebrew at the same time, for double the fun!), there are outer bounds on the badness on the mac that don't exist on Linux and are wafer-thin guard rails on Windows.
@mcc @unlambda @whitequark Ooh, I went to go open a discussion for this, and found that apparently there has been some movement in the right direction: https://github.com/orgs/Homebrew/discussions/3404#discussioncomment-8549228
@glyph @mcc @whitequark Oh right, deadsnakes also doesn't provide versions of python that overlap with the system python, so if you happen to use the system python version you still have issues when you upgrade your distro
@unlambda @mcc @whitequark "do everything in docker" lolsob
@unlambda @glyph @mcc there's python-build-standalone which pdm will install automatically for you if you do `pdm python use 3.12`
I haven't had trouble with them other than the arguably upstream issue of them switching to libedit and breaking all my history files (which is being handled upstream now)