PySide2 Compatibility Issues in Python 3.11

After recently updating my flake configuration, I have been running into an error when trying to rebuild the system over the past few days:

error: pyside2 not supported for interpreter python3.11

A contributor did submit a pull request with a fix for this issue on GitHub about a week ago. However, none of the maintainers with write access have merged the pull request yet.

So currently, I’m stuck waiting until that pull request gets merged in order to resolve the rebuild failure. I’m not sure if there is anything else I can try on my end in the meantime.

The best option seems to be continuing to wait patiently for the maintainers to merge the existing pull request. That being said, I’m open to any other suggestions if you have ideas on how to go about this issue.

In this specific case, you could do something like this:

pkgs.renderdoc.override {
  python3 = pkgs.python310;
  python3Packages = pkgs.python310Packages;
}

A more general strategy, for pulling in changes from any PR while you wait for it to be merged, is to apply the PR as a patch like this:

nixpkgsPatched = pkgs.applyPatches {
  src = pkgs.path;
  patches = [
    (pkgs.fetchpatch {
      url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/263547.diff";
      hash = "sha256-187XugULSYEVYyysDoA4yLh1eZg10RHwSGHg/MjuK0E=";
    })
  ];
};

You can get a patch URL for any github PR by sticking .diff on the end of the URL.

1 Like

After following your instructions, I found that the issue was not related to the renderdoc package as I initially thought. The error message I saw was indicating a problem with the pyside2 package, but in a totally different place.

This is where the –show-trace takes me to:

… while calling 'disabled'

         at /nix/store/a56i1y5js340dn1w9r767a8jp34k31n4-source/pkgs/development/interpreters/python/python-packages-base.nix:90:14:

           89|
           90|   disabled = drv: throw "${removePythonPrefix (drv.pname or drv.name)} not supported for interpreter ${python.executable}";
             |              ^
           91|

       error: pyside2 not supported for interpreter python3.11

I’m unable to determine the specific package that’s causing this issue. Also, I’m uncertain about the purpose of the folder, but the error message indicates that the issue originates from the python-packages-base package:

pkgs/development/interpreters/python/python-packages-base.nix

{ pkgs
, stdenv
, lib
, python
}:

self:

let
inherit (self) callPackage;

namePrefix = python.libPrefix + “-”;

Derivations built with buildPythonPackage can already be overridden with override, overrideAttrs, and overrideDerivation.

This function introduces overridePythonAttrs and it overrides the call to buildPythonPackage.

makeOverridablePythonPackage = f: origArgs:
let
args = lib.fix (lib.extends
(: previousAttrs: {
passthru = (previousAttrs.passthru or { }) // {
overridePythonAttrs = newArgs: makeOverridablePythonPackage f (overrideWith newArgs);
};
})
(
: origArgs));
result = f args;
overrideWith = newArgs: args // (if pkgs.lib.isFunction newArgs then newArgs args else newArgs);
in
if builtins.isAttrs result then result
else if builtins.isFunction result then {
overridePythonAttrs = newArgs: makeOverridablePythonPackage f (overrideWith newArgs);
__functor = self: result;
}
else result;

mkPythonDerivation = if python.isPy3k then
./mk-python-derivation.nix
else
./python2/mk-python-derivation.nix;

buildPythonPackage = makeOverridablePythonPackage (lib.makeOverridable (callPackage mkPythonDerivation {
inherit namePrefix; # We want Python libraries to be named like e.g. “python3.6-${name}”
inherit toPythonModule; # Libraries provide modules
}));

buildPythonApplication = makeOverridablePythonPackage (lib.makeOverridable (callPackage mkPythonDerivation {
namePrefix = “”; # Python applications should not have any prefix
toPythonModule = x: x; # Application does not provide modules.
}));

See build-setupcfg/default.nix for documentation.

buildSetupcfg = import …/…/…/build-support/build-setupcfg lib self;

Check whether a derivation provides a Python module.

hasPythonModule = drv: drv?pythonModule && drv.pythonModule == python;

Get list of required Python modules given a list of derivations.

requiredPythonModules = drvs: let
modules = lib.filter hasPythonModule drvs;
in lib.unique ([python] ++ modules ++ lib.concatLists (lib.catAttrs “requiredPythonModules” modules));

Create a PYTHONPATH from a list of derivations. This function recurses into the items to find derivations

providing Python modules.

makePythonPath = drvs: lib.makeSearchPath python.sitePackages (requiredPythonModules drvs);

removePythonPrefix = lib.removePrefix namePrefix;

Convert derivation to a Python module.

toPythonModule = drv:
drv.overrideAttrs( oldAttrs: {
# Use passthru in order to prevent rebuilds when possible.
passthru = (oldAttrs.passthru or {})// {
pythonModule = python;
pythonPath = ; # Deprecated, for compatibility.
requiredPythonModules = requiredPythonModules drv.propagatedBuildInputs;
};
});

Convert a Python library to an application.

toPythonApplication = drv:
drv.overrideAttrs( oldAttrs: {
passthru = (oldAttrs.passthru or {}) // {
# Remove Python prefix from name so we have a “normal” name.
# While the prefix shows up in the store path, it won’t be
# used by nix-env.
name = removePythonPrefix oldAttrs.name;
pythonModule = false;
};
});

disabled = drv: throw “${removePythonPrefix (drv.pname or drv.name)} not supported for interpreter ${python.executable}”;

disabledIf = x: drv: if x then disabled drv else drv;

in {

inherit lib pkgs stdenv;
inherit (python.passthru) isPy27 isPy37 isPy38 isPy39 isPy310 isPy311 isPy3k isPyPy pythonAtLeast pythonOlder;
inherit buildPythonPackage buildPythonApplication;
inherit hasPythonModule requiredPythonModules makePythonPath disabled disabledIf;
inherit toPythonModule toPythonApplication;
inherit buildSetupcfg;

python = toPythonModule python;

Dont take pythonPackages from “global” pkgs scope to avoid mixing python versions

pythonPackages = self;

Remove?

recursivePthLoader = toPythonModule (callPackage …/…/…/development/python-modules/recursive-pth-loader { });

}

The root cause of the problem was the package natron. By removing it, I was able to resolve the issue and rebuild successfully.