How do I update to Python 3.11

I know there’s a lot of topics on this, but none of them work for me. I’ve just been infinitely getting this nix error:

nix error: building nix env: os.Readlink() channel: readlink /home/runner/.nix-defexpr/channels/nixpkgs-stable-22_10: no such file or directory
Error: prybar-python310 not found in $PATH
repl process died unexpectedly: exit status 1

Even after fixing my replit.nix to this (Ik forking will prob fix it, but that’s not really what I care about here):

{ 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
    ];
    PYTHONHOME = "${pkgs.python310Full}";
    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";
  };
}

So here’s what I set it to in the first place:

{ 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
    ];
    PYTHONHOME = "${pkgs.python311Full}";
    PYTHONBIN = "${pkgs.python311Full}/bin/python3.10";
    LANG = "en_US.UTF-8";
    STDERREDBIN = "${pkgs.replitPackages.stderred}/bin/stderred";
    PRYBAR_PYTHON_BIN = "${pkgs.replitPackages.prybar-python311}/bin/prybar-python311";
  };
}

I’ve also tried using a blank Repl and just using run = "python3 main.py" but I wasn’t able to install packages

Oh and btw I need 3.11 so I can use tomllib

1 Like

See also this post of mine where I got enough help to make my 3.11 Repl barely usable.

1 Like

Thank you. Do you know how to install 3rd party libraries?

Unfortunately, I don’t know. I’m also waiting for an enlightenment by NixOS wizards.

Maybe python3.10 should be python3.11. Although iirc, these folders are ‘hardcoded’, you can’t actually make them yourself, they have to pre-exist. Maybe setting everything to 3.11 but then having the folders as 3.10 will fix it. :man_shrugging:

2 Likes

I must’ve missed that. Still error:

nix error: building nix env: exit status 1
Error: prybar-python310 not found in $PATH
repl process died unexpectedly: exit status 1
nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/stdenv/linux/default.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/top-level/stage.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/stdenv/adapters.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/build-support/trivial-builders.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/top-level/splice.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/top-level/all-packages.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/top-level/aliases.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/stdenv/generic/default.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/lib/customisation.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/tools/text/gawk/default.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/servers/x11/xorg/default.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/servers/x11/xorg/overrides.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/stdenv/generic/make-derivation.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/build-support/mkshell/default.nix'
evaluating file '/home/runner/Forum-Template/replit.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/stdenv/generic/check-meta.nix'
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/lib/systems/doubles.nix'
error: attribute 'prybar-python311' missing, at /home/runner/Forum-Template/replit.nix:21:28
(use '--show-trace' to show detailed location information)

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

Use stable-22_11, stable-22_10 isn’t a valid version :slight_smile:

3 Likes

The default Python template uses stable-22_11

I’ve made like 5 Repls trying to figure this out and it’s so unorganized lol

1 Like

You mean like this one?

https://replit.com/@WindLother/Python-311#main.py

I can’t use install packages with that.

For anyone too impatient to wait for a 3.11 template, here’s some steps for
converting a repl to python 3.11(.3), including a working packages tab:

In replit.nix file

From deps, remove:

  • pkgs.replitPackages.prybar-python310,
  • pkgs.replitPackages.stderred

From env, remove:

  • PRYBAR_PYTHON_BIN
  • STDERREDBIN

Then, update all 4 occurrences of python versions (11 instead of 10)

In .replit file

Delete the entire [interpreter] block, possibly lines 15-27
Change channel, possibly on line 13, from "stable-22_11" to "stable-23_05"
In PYTHONPATH, possibly on line 18, update the 2 occurrences of 3.10 to 3.11

In venv folder

In venv/lib folder, rename folder python3.10 to python3.11. This may take a while
In venv/include, if there is one, rename folder python3.10 to python3.11

Refresh

Refresh, or reload the shell, and now your repl runs python 3.11, with a working packages tab

2 Likes

Doesn’t seem to work, not sure what I’ve done wrong…

Just fork this one. The Packages tool does work, albeit not automatically.

2 Likes

Python 3.11 works with all IDE features except Debugger, which gives debugpy-1.6.7 not supported for interpreter python3.11 (btw Packager search doesn’t seem to work on a normal (non-beta) python repl at the moment). See the description for setting 3.11 (or 3.12!) up on your own repl

1 Like

On that template, it is easy to get the debugger working.
Open pyproject.toml file.
Replace:
[tool.poetry.dev-dependencies]
with:

[tool.poetry.group.dev.dependencies]
debugpy = "^1.6.7"

Then run poetry update in the shell.

2 Likes

true but note the reason that Nix doesn’t yet allow debugpy on 3.11

(On replit, it’ll continue disallowing until the nix channels are updated)

3 Likes

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