Upgrading Python to 3.11

How do I upgrade to Python 3.11 (I have some 3.11 specific code to add) please?

I have looked at other questions on this forum, have Googled, checked StackOverflow, asked ChapGPT, have tried commenting out parts of replit.nix, have looked into how Nix & UPM & Poetry work but not found a solution. I understand venv and $PATH but do not know the solution in Replit.

All of the existing Python 3.11 templates on Replit have errors with Poetry.

Simply editing the replit.nix to 311 and the pyproject.toml to 3.11 does not work.

If I do try editing the prybar-python then the consule shows error repeatedly:

repl process died unexpectedly: exit status 1
Error: prybar-python310 not found in $PATH

If I do try editing the replit.nix PYTHONBIN to python 311 then the shell shows error:

python3-3.11.0/bin/python3.10: No such file or directory

Repl:
https://replit.com/@VetClarity/template14

Replit.nix contents:

{ pkgs }: {
  deps = [
    pkgs.python310Full
    pkgs.replitPackages.prybar-python310
    pkgs.replitPackages.stderred
  ];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      # Needed for pandas / numpy
      pkgs.stdenv.cc.cc.lib
      pkgs.zlib
      # Needed for pygame
      pkgs.glib
      # Needed for matplotlib
      pkgs.xorg.libX11
    ];
    PYTHONBIN = "${pkgs.python310Full}/bin/python3.10";
    LANG = "en_US.UTF-8";
    STDERREDBIN = "${pkgs.replitPackages.stderred}/bin/stderred";
    PRYBAR_PYTHON_BIN = "${pkgs.replitPackages.prybar-python310}/bin/prybar-python310";
  };
}

While I can’t guarantee it will work, try updating it to this:

{ pkgs }: {
  deps = [
    pkgs.python311Full
    pkgs.replitPackages.prybar-python311
    pkgs.replitPackages.stderred
  ];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      # Needed for pandas / numpy
      pkgs.stdenv.cc.cc.lib
      pkgs.zlib
      # Needed for pygame
      pkgs.glib
      # Needed for matplotlib
      pkgs.xorg.libX11
    ];
    PYTHONBIN = "${pkgs.python311Full}/bin/python3.11";
    LANG = "en_US.UTF-8";
    STDERREDBIN = "${pkgs.replitPackages.stderred}/bin/stderred";
    PRYBAR_PYTHON_BIN = "${pkgs.replitPackages.prybar-python311}/bin/prybar-python311";
  };
}

Thanks for your quick reply. Unfortunately that results in the console
error: prybar-python310 not found in $PATH

I have seen another post on this forum that there is no prybar-python311.

Check your .replit file, it probably still references the wrong python version.

3 Likes

Thanks again. You were right. I have done that. I have left all prybar references as 3.10 or 310.

The python --version is now 3.11.0, thank you.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.