And I noticed an error message (how rude, right?) saying that one of my packages didn’t meet the requirements.txt requirement. I thought, “how strange” and clicked install … well, PyCharm kindly told me I should use a virtual environment to install my packages. I told PyCharm “that’s what I’ve been doing!” … I always use a virtual environment to run all my projects.
After poking around in File > Settings > Project > Python Interpreter I realized what the problem was.
I’d upgraded Ubuntu from Impish to Jammy and with that upgrade came a new version of Python … version 3.10. My venv was pointing to “python” in /venv/bin/python which had been pointing to python version 3.9 but was now pointing to python version 3.10.
All that to say, PyCharm was confused (and who can blame it?). Thankfully the solution was an easy one. Just remember to use requirements.txt (you do use it, right?) by going to Tools > Sync Python Requirements… and following the prompts.
In PyCharm, under Project, rename venv to something else (I chose the creatively named venv.3.9
Then go to File > Settings… > Project > Python Interpreter > Add Interpreter > Add Local Interpreter (wow … that’s a long string of stuff, sorry)
Select New and use /usr/bin/python3.10 as your base interpreter (if that’s an old version, then you must be from the future, welcome to the past … just use whatever is newest) then click Ok
Update any packages that need it in the Python Interpreter screen and click Ok again. PyCharm should now give you the option of resolving missing packages using requirements.txt. Click install and this time it should work!