I’ve got the following flake in my python / poetry project:
{
description = "Yaht; Yet another hyperparameter tuner";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
poetry2nix.url = "github:nix-community/poetry2nix";
};
outputs = { self, nixpkgs, poetry2nix }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; })
mkPoetryApplication;
yaht = mkPoetryApplication {
projectDir = ./.;
};
in {
apps.${system}.default = {
type = "app";
# replace <script> with the name in the [tool.poetry.scripts]
# section of your pyproject.toml
program = "${yaht}/bin/yaht";
};
};
}
In an attempt to make it nix-compatible etc. But even though this is basically the default flake from the github page it fails with the following error:
error: builder for '/nix/store/jbx516ravp5536nmg4aq152hm0m8qrxk-python3.12-python-jsonrpc-server-0.4.0.drv' failed with exit code 1;
last 10 log lines:
> '"'"''"'"''"'"' % ('"'"'/build/python-jsonrpc-server-0.4.0/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' egg_info --egg-base /build/pip-pip-egg-info-lpa_sgjy
> cwd: /build/python-jsonrpc-server-0.4.0/
> Preparing metadata (setup.py) ... error
> error: metadata-generation-failed
>
> × Encountered error while generating package metadata.
> ╰─> See above for output.
>
> note: This is an issue with the package mentioned above, not pip.
> hint: See above for details.
For full logs, run 'nix log /nix/store/jbx516ravp5536nmg4aq152hm0m8qrxk-python3.12-python-jsonrpc-server-0.4.0.drv'.
error: 1 dependencies of derivation '/nix/store/b1yhyzclv7swxsbi0xyrr2dvfrpbyp10-python3.12-yaht-0.1.0.drv' failed to build
The longer nix log is as follows:
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing pypa-install-hook
Using pypaInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing python-namespaces-hook
Sourcing pip-build-hook
Using pipBuildPhase
Using pipShellHook
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/lh5xhk9clfsj26i6kr965qralra35y6f-python-jsonrpc-server-0.4.0.tar.gz
source root is python-jsonrpc-server-0.4.0
setting SOURCE_DATE_EPOCH to timestamp 1599592966 of file python-jsonrpc-server-0.4.0/setup.cfg
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
no configure script, doing nothing
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
Executing pipBuildPhase
Creating a wheel...
WARNING: The directory '/homeless-shelter/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If e>
Processing /build/python-jsonrpc-server-0.4.0
Running command python setup.py egg_info
/build/python-jsonrpc-server-0.4.0/versioneer.py:421: SyntaxWarning: invalid escape sequence '\s'
LONG_VERSION_PY['git'] = '''
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/build/python-jsonrpc-server-0.4.0/setup.py", line 25, in <module>
version=versioneer.get_version(),
^^^^^^^^^^^^^^^^^^^^^^^^
File "/build/python-jsonrpc-server-0.4.0/versioneer.py", line 1480, in get_version
return get_versions()["version"]
^^^^^^^^^^^^^^
File "/build/python-jsonrpc-server-0.4.0/versioneer.py", line 1412, in get_versions
cfg = get_config_from_root(root)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/build/python-jsonrpc-server-0.4.0/versioneer.py", line 342, in get_config_from_root
parser = configparser.SafeConfigParser()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /nix/store/h3i0acpmr8mrjx07519xxmidv8mpax4y-python3-3.12.5/bin/python3.12 -c '
exec(compile('"'"''"'"''"'"'
# This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
#
# - It imports setuptools before invoking setup.py, to enable projects that directly
# import from `distutils.core` to work with newer packaging standards.
# - It provides a clear error message when setuptools is not installed.
# - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
# setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
# manifest_maker: standard file '"'"'-c'"'"' not found".
# - It generates a shim setup.py, for handling setup.cfg-only projects.
import os, sys, tokenize
try:
import setuptools
except ImportError as error:
print(
"ERROR: Can not execute `setup.py` since setuptools is not available in "
"the build environment.",
file=sys.stderr,
)
sys.exit(1)
__file__ = %r
sys.argv[0] = __file__
if os.path.exists(__file__):
filename = __file__
with tokenize.open(__file__) as f:
setup_py_code = f.read()
else:
filename = "<auto-generated setuptools caller>"
setup_py_code = "from setuptools import setup; setup()"
exec(compile(setup_py_code, filename, "exec"))
'"'"''"'"''"'"' % ('"'"'/build/python-jsonrpc-server-0.4.0/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' egg_info --egg-base /build/pip-pip-egg-info-lpa_sgjy
cwd: /build/python-jsonrpc-server-0.4.0/
Preparing metadata (setup.py) ... error
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I am completely lost about how to do the overrides I need to, I just can’t untangle the poetry2nix documentation. It feels like there’s 5 different ways to override a package in this context, and none of them are correct.