How do I update Python to 3.12?

I tried a few different things and they were all dead ends. It’s hard to get python 3.12 to work with the package manager, so you have two options:

  • Use python 3.12 without any packages
  • Use python 3.11

For the first option, remove all dependencies, delete .pythonlibs folder, and don’t touch poetry again.
For the second option, delete replit.nix file, then open .replit file and set the string in the modules variable to "python-3.11:v16-20231229-5b1e996", then reload.

I’d also recommend making a feature request for python 3.12 so that staff or other community members on ask might get it working.

I managed to get the dependencies working, so that you can use python 3.12.0 without any downsides fairly easily.
First, you can set the nix channel in .replit to be "unstable" to get 3.12.0 instead of 3.12.0b2 (optional but nice).
Now, make sure that you do not have the python312 System dependency yet, it will be installed last.
Open .replit file and change the modules string to "python-3.11:v16-20231229-5b1e996" .
At the end of the file, add:

PYTHONPATH = "$REPL_HOME/.pythonlibs/lib/python3.11/site-packages:$PYTHONPATH"

In your pyproject.toml file, change the python versions to ">=3.11.0,<4.0". Then delete .pythonlibs folder. Then type kill 1 in the Shell, and then poetry update .

It should install your packages without error. Now, add the python312 system dependency, and type kill 1 in the Shell again.