Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can python-poetry2nix be used for "nix develop"? #9

Open
das-g opened this issue Dec 10, 2021 · 0 comments
Open

Can python-poetry2nix be used for "nix develop"? #9

das-g opened this issue Dec 10, 2021 · 0 comments

Comments

@das-g
Copy link

das-g commented Dec 10, 2021

I tried this:

mkdir pyfoo
cd pyfoo

nix run nixpkgs#poetry -- init -n
nix run nixpkgs#poetry -- lock

nix flake init -t github:serokell/templates#python-poetry2nix
sed 's/throw "put your package name here"/"pyfoo"/' -i flake.nix

git init
git add -A
git commit -am'initial commit'

nix develop

and got:

warning: creating lock file '/home/das-g/tmp/pyfoo/flake.lock'
warning: Git tree '/home/das-g/tmp/pyfoo' is dirty
Executing pipShellHook
ERROR: File "setup.py" not found. Directory cannot be installed in editable mode: /home/das-g/tmp/pyfoo
(A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)
WARNING: You are using pip version 20.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/bin/python3.9 -m pip install --upgrade pip' command.
Finished executing pipShellHook

So I tried anew:

exit
cd ..
rm -rf pyfoo
mkdir pyfoo
cd pyfoo

nix run nixpkgs#poetry -- init -n
nix run nixpkgs#poetry -- lock

nix flake init -t github:serokell/templates#python-poetry2nix
sed 's/throw "put your package name here"/"pyfoo"/' -i flake.nix

echo "import setuptools; setuptools.setup()" > setup.py

git init
git add -A
git commit -am'initial commit'

nix develop

and got:

warning: creating lock file '/home/das-g/pyfoo/flake.lock'
warning: Git tree '/home/das-g/pyfoo' is dirty
Executing pipShellHook
Obtaining file:///home/das-g/pyfoo
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/bin/python3.9 /nix/store/rv469jybm3f553s1aawr68zn8slr8rl9-python3.9-pip-20.2.4/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/nix-shell.CY2Doj/tmpl0xl7qmj
         cwd: /home/das-g/pyfoo
    Complete output (16 lines):
    Traceback (most recent call last):
      File "/nix/store/rv469jybm3f553s1aawr68zn8slr8rl9-python3.9-pip-20.2.4/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
        main()
      File "/nix/store/rv469jybm3f553s1aawr68zn8slr8rl9-python3.9-pip-20.2.4/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/nix/store/rv469jybm3f553s1aawr68zn8slr8rl9-python3.9-pip-20.2.4/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/tmp/nix-shell.CY2Doj/pip-build-env-pw6kwjmk/overlay/lib/python3.9/site-packages/poetry/core/masonry/api.py", line 44, in prepare_metadata_for_build_wheel
        builder = WheelBuilder(poetry)
      File "/tmp/nix-shell.CY2Doj/pip-build-env-pw6kwjmk/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 57, in __init__
        super(WheelBuilder, self).__init__(poetry, executable=executable)
      File "/tmp/nix-shell.CY2Doj/pip-build-env-pw6kwjmk/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/builder.py", line 85, in __init__
        self._module = Module(
      File "/tmp/nix-shell.CY2Doj/pip-build-env-pw6kwjmk/overlay/lib/python3.9/site-packages/poetry/core/masonry/utils/module.py", line 63, in __init__
        raise ModuleOrPackageNotFound(
    poetry.core.masonry.utils.module.ModuleOrPackageNotFound: No file/folder found for package pyfoo
    ----------------------------------------
ERROR: Command errored out with exit status 1: /nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/bin/python3.9 /nix/store/rv469jybm3f553s1aawr68zn8slr8rl9-python3.9-pip-20.2.4/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/nix-shell.CY2Doj/tmpl0xl7qmj Check the logs for full command output.
WARNING: You are using pip version 20.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/nix/store/k0z9n599k02hab8qjjp3ljw065iwjcvg-python3-3.9.6/bin/python3.9 -m pip install --upgrade pip' command.
Finished executing pipShellHook

Am I doing something wrong?

output of nix-shell -p nix-info --run "nix-info -m"

  • system: "x86_64-linux"
  • host os: Linux 5.10.81, NixOS, 22.05 (Quokka)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.4
  • channels(root): "nixos-22.05pre335501.c71f061c68b"
  • channels(das-g): ""
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant