!rWxyQqNqMUDLECdsIf:blad.is

Poetry2nix

318 Members
https://github.com/nix-community/poetry2nix62 Servers

Load older messages


SenderMessageTime
19 Jul 2024
@oven_spinout988:matrix.orgoven_spinout988
In reply to @oven_spinout988:matrix.org

I just set it at the minimum level :

          testApp = mkPoetryApplication {
            projectDir = ./.;
            overrides = p2n-overrides;

            dependencies = [
              pkgs.redis
              pkgs.ffmpeg
            ];

          };

With the package inside the pyproject.toml, I have this error :

            Traceback (most recent call last):
              File "/nix/store/lbidxwnsm93j6v79hyrl0yvjylbdjd2w-python3.12-test-0.0.0/bin/.start-wrapped", line 6, in <module>
                from bin.start import main
              File "/nix/store/lbidxwnsm93j6v79hyrl0yvjylbdjd2w-python3.12-test-0.0.0/lib/python3.12/site-packages/bin/start.py", line 5, in <module>
                from test.default import get_homedir
            ModuleNotFoundError: No module named 'test.default'

And without :

            Traceback (most recent call last):
              File "/nix/store/ghhaa833nn30ck2y7w8nlq3nx5izvypj-python3.12-test-0.0.0/bin/.start-wrapped", line 6, in <module>
                from bin.start import main
            ModuleNotFoundError: No module named 'bin'

Not sure why it is not working in my test package. But in the original package specifying the packages inside the pyproject.tom worked well.

I have now errors complaining about Flask not present.
Do you know why the packages/libraries from the pyproject.toml are not present during run time ?

Anyway thank you for your attention and idea to fix my issue.

14:41:45
@notwren:matrix.orgnotwren
In reply to @picog:matrix.org

I have some thing like

        devShells.a = pkgs.mkShell {
          packages = with pkgs; [
            (mkPoetryEnv {
              projectDir = a/.;
              python=pkgs.python39;
            })
          ];
        };

        devShells.b = pkgs.mkShell {
          packages = with pkgs; [
            (mkPoetryEnv {
              projectDir = b/.;
              python=pkgs.python39;
            })
          ];
        };
I'm not seeing any reference to b in the a devShell here or vice versa?
15:12:00
@oven_spinout988:matrix.orgoven_spinout988 Is normal the normal to use the mkPoetryApplication and use is in a flake output for packages.default ? 16:44:48
@oven_spinout988:matrix.orgoven_spinout988 * Is the normal usage of the mkPoetryApplication to use is in a flake output for packages.default ? 16:45:10
22 Jul 2024
@brokenpip3:matrix.org@brokenpip3:matrix.org left the room.07:46:10
@notwren:matrix.orgnotwrenis there a reason that bumping poetry2nix would have made it now use python3.12 instead of 3.11? the pyproject is set to "^3.11"19:27:35
@notwren:matrix.orgnotwren

for anyone else that has the same problem, you can fix with:

19:30:47
@notwren:matrix.orgnotwren *

for anyone else that has the same problem, you can fix with:

        devShells.default = let 
            envShell = mkPoetryEnv {
              projectDir = ./.;
              python = pkgs.python311;
              overrides = p2n-overrides;
              preferWheels = true;
              editablePackageSources = {
                xoulschemas = xoulschemas/.;
              };
            }; 

19:31:34
@notwren:matrix.orgnotwren *

for anyone else that has the same problem, you can fix with:

        devShells.default = let 
            envShell = mkPoetryEnv {
              projectDir = ./.;
              python = pkgs.python311;
              overrides = p2n-overrides;
              preferWheels = true;
              editablePackageSources = {
                x = x/.;
              };
            }; 

19:31:46
24 Jul 2024
@truh:matrix.orgtruhNewer nixpkgs probably. 3.12 is the default on unstable08:47:07
@lambadada:matrix.orglambadada

I'm trying to set up a python enviroment with poetry2nix. I need to override a package rpds-py to make it function correctly. It already has a override at line 3082 to 3147 in overrides/default.nix But that doesn't have the hash to the latest version. How do I force it to use the correct hash for the latest release?
I know it's a simple override, but everything I try fails to set the hash to what it should be.

I'm trying the following:

{rpds-py = prev.rpds-py.overridePythonAttrs (old: {
          cargoDeps = nixpkgs.rustPlatform.fetchCargoTarball {
            inherit (old) src;
            name = "${old.pname}-${old.version}";
            hash = "sha256-qIXdoCEVGCGUnTicZp4bUTJyGpFy9dwWY03lXUbxiHg=";
          };
          buildInputs = old.buildInputs or [ ] ;
          nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
            nixpkgs.rustPlatform.cargoSetupHook
            nixpkgs.rustPlatform.maturinBuildHook
          ];
        });
      }
23:07:02
@lambadada:matrix.orglambadada *

I need to override a package rpds-py for my latest project. It already has a override at line 3082 to 3147 in overrides/default.nix But that doesn't have the hash to the latest version. How do I force it to use the correct hash for the latest release?
I know it's a simple override, but everything I try fails to set the hash to what it should be.

I'm trying the following:

{rpds-py = prev.rpds-py.overridePythonAttrs (old: {
          cargoDeps = nixpkgs.rustPlatform.fetchCargoTarball {
            inherit (old) src;
            name = "${old.pname}-${old.version}";
            hash = "sha256-qIXdoCEVGCGUnTicZp4bUTJyGpFy9dwWY03lXUbxiHg=";
          };
          buildInputs = old.buildInputs or [ ] ;
          nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
            nixpkgs.rustPlatform.cargoSetupHook
            nixpkgs.rustPlatform.maturinBuildHook
          ];
        });
      }
23:07:48
25 Jul 2024
@ezzobirbezziou:matrix.orgEzzobir Bezziou joined the room.08:52:30
@tcsavage:matrix.orgTom Savage joined the room.14:30:23
@virtu:matrix.imvirtu joined the room.17:58:25
@virtu:matrix.imvirtu

Hey! I'm wondering how to correctly set up a devShell using poetry2nix. Previously, I was using:

      devShells.default = pkgs.mkShell {
        packages = with pkgs; [ poetry ];
        LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib/";
      };

together with

PYTHON_VERSION=$(python --version | awk '{print $2}' | cut -d. -f1-2 | tr -d '\n')
export PYTHONPATH=$PYTHONPATH:$(poetry env info --path)/lib/python${PYTHON_VERSION}/site-packages

in my .envrc, but I was hoping to get the same effect more gracefully using mkPoetryEnv, so I tried:

      devShells.default = mkPoetryEnv {
        projectDir = ./.;
      };

but for some reason the dependencies aren't available:

» grep pandas pyproject.toml
pandas = "2.1.3"

» python -c "import pandas"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pandas'

Any idea what I'm doing wrong?

18:02:10
26 Jul 2024
@tcsavage:matrix.orgTom Savage changed their display name from tcsavage to Tom Savage.08:22:07
@tcsavage:matrix.orgTom Savage set a profile picture.08:23:32
27 Jul 2024
@lebastr:matrix.orgAleksandr Lebedev joined the room.05:53:35
@lebastr:matrix.orgAleksandr Lebedev

Hey! Whats going on with ipympl?
I've encountered a problem with the ipympl library.

First I added ipympl as a dependency:

poetry add ipympl
Using version ^0.9.4 for ipympl

Then, when I tried to enter the development environment with the command nix develop I received the following message:

nix develop
warning: Git tree '/home/user/test-jupyter' is dirty
error: builder for '/nix/store/yn9990741wv439qncd2wpl2pdbwkjzyz-python3.12-ipympl-0.9.4.drv' failed with exit code 2;
       last 10 log lines:
       >   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
       >   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
       >   File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
       >   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
       >   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
       >   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
       >   File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
       > ModuleNotFoundError: No module named 'hatchling'

I tried to override ipympl:

myapp = mkPoetryApplication {
    projectDir = self;
    overrides = withDefaults (final: prev: {
        ipympl = prev.ipympl.overridePythonAttrs (old: {
            nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ final.hatchling ];
        });
    });
};

But it was unsuccessful:

nix develop
warning: Git tree '/home/user/test-jupyter' is dirty
error: builder for '/nix/store/3siq2h2ggxhs4cs2bqr4caczq4vcl15r-python3.12-ipympl-0.9.4.drv' failed with exit code 1;
       last 10 log lines:
       >   full command: /nix/store/z7xxy35k7620hs6fn6la5fg2lgklv72l-python3-3.12.4/bin/python3.12 /nix/store/9gd8kj409msfv599456ywbyi97izlbr4-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /build/tmpwmmwvne3
       >   cwd: /build/ipympl-0.9.4
       >   Preparing metadata (pyproject.toml) ... 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/3siq2h2ggxhs4cs2bqr4caczq4vcl15r-python3.12-ipympl-0.9.4.drv'.
error: 1 dependencies of derivation '/nix/store/26zp4sb66agpjwhw7y4pdr5rl9cwwgh1-nix-shell-env.drv' failed to build
06:10:32
@k900:0upti.meK900There should be logs above that06:12:00
@k900:0upti.meK900 Run the nix log command 06:12:06
@k900:0upti.meK900That it tells you to run06:12:12
@k900:0upti.meK900And post the full output06:12:15
@lebastr:matrix.orgAleksandr LebedevI see the problem here: hatchling.plugin.exceptions.UnknownPluginError: Unknown build hook: jupyter-builder06:18:57
@lebastr:matrix.orgAleksandr LebedevDownload log06:19:54
@k900:0upti.meK900That implies you need another dependency06:21:27
@k900:0upti.meK900That provides said hook06:21:30
@lebastr:matrix.orgAleksandr Lebedev

I found https://github.com/tweag/jupyenv/blob/0c86802aaa3ffd3e48c6f0e7403031c9168a8be2/lib/overrides.nix#L34C74-L34C95 that there is a hatch-jupyter-builder.

This led to the following error:
ValueError: Aborting. Could not find cmd (jlpm) in path. If command is not expected to be in user's path, use an absolute path.

06:28:45
@lebastr:matrix.orgAleksandr Lebedev
In reply to @lebastr:matrix.org

Hey! Whats going on with ipympl?
I've encountered a problem with the ipympl library.

First I added ipympl as a dependency:

poetry add ipympl
Using version ^0.9.4 for ipympl

Then, when I tried to enter the development environment with the command nix develop I received the following message:

nix develop
warning: Git tree '/home/user/test-jupyter' is dirty
error: builder for '/nix/store/yn9990741wv439qncd2wpl2pdbwkjzyz-python3.12-ipympl-0.9.4.drv' failed with exit code 2;
       last 10 log lines:
       >   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
       >   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
       >   File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
       >   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
       >   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
       >   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
       >   File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
       > ModuleNotFoundError: No module named 'hatchling'

I tried to override ipympl:

myapp = mkPoetryApplication {
    projectDir = self;
    overrides = withDefaults (final: prev: {
        ipympl = prev.ipympl.overridePythonAttrs (old: {
            nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ final.hatchling ];
        });
    });
};

But it was unsuccessful:

nix develop
warning: Git tree '/home/user/test-jupyter' is dirty
error: builder for '/nix/store/3siq2h2ggxhs4cs2bqr4caczq4vcl15r-python3.12-ipympl-0.9.4.drv' failed with exit code 1;
       last 10 log lines:
       >   full command: /nix/store/z7xxy35k7620hs6fn6la5fg2lgklv72l-python3-3.12.4/bin/python3.12 /nix/store/9gd8kj409msfv599456ywbyi97izlbr4-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py prepare_metadata_for_build_wheel /build/tmpwmmwvne3
       >   cwd: /build/ipympl-0.9.4
       >   Preparing metadata (pyproject.toml) ... 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/3siq2h2ggxhs4cs2bqr4caczq4vcl15r-python3.12-ipympl-0.9.4.drv'.
error: 1 dependencies of derivation '/nix/store/26zp4sb66agpjwhw7y4pdr5rl9cwwgh1-nix-shell-env.drv' failed to build

It's really weird!

I ended up with this config:

myapp = mkPoetryApplication {
            projectDir = self;
            overrides = withDefaults (final: prev: {
              ipympl = prev.ipympl.overridePythonAttrs (old: {
                  nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
                  final.hatchling
                  final.hatch-jupyter-builder
                  final.jupyterlab
                  pkgs.nodejs
                ];
              });

            });
          };

And I've got a crazy error message:

Internal Error: EACCES: permission denied, mkdir '/homeless-shelter'
  Error: EACCES: permission denied, mkdir '/homeless-shelter'
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. >
Processing /build/ipympl-0.9.4
  Running command Preparing metadata (pyproject.toml)
  INFO:hatch_jupyter_builder.utils:Running jupyter-builder
  INFO:hatch_jupyter_builder.utils:Building with hatch_jupyter_builder.npm_builder
  INFO:hatch_jupyter_builder.utils:With kwargs: {'path': '.', 'build_cmd': 'build:prod', 'npm': ['jlpm']}
  INFO:hatch_jupyter_builder.utils:Installing build dependencies with npm.  This may take a while...
  INFO:hatch_jupyter_builder.utils:> /nix/store/3ah78dwwli5k9zxwfw7nhdpycm82lp8g-python3.12-jupyterlab-4.2.4/bin/jlpm install
  Internal Error: EACCES: permission denied, mkdir '/homeless-shelter'
  Error: EACCES: permission denied, mkdir '/homeless-shelter'
  Traceback (most recent call last):
    File "/nix/store/9gd8kj409msfv599456ywbyi97izlbr4-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/nix/store/9gd8kj409msfv599456ywbyi97izlbr4-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/nix/store/9gd8kj409msfv599456ywbyi97izlbr4-python3.12-pip-24.0/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
      whl_basename = backend.build_wheel(metadata_directory, config_settings)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/nix/store/nrwbrccny1ycgs0lhv7x4agic3ncxsyn-python3.12-hatchling-1.25.0/lib/python3.12/site-packages/hatchling/build.py", line 58, in build_wheel
      return os.path.basename(next(builder.build(directory=wheel_directory, versions=['standard'])))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/nix/store/nrwbrccny1ycgs0lhv7x4agic3ncxsyn-python3.12-hatchling-1.25.0/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 147, in build
      build_hook.initialize(version, build_data)
    File "/nix/store/qhp7ahvskg59nj49sr99gz78qfqsic34-python3.12-hatch-jupyter-builder-0.9.1/lib/python3.12/site-packages/hatch_jupyter_builder/plugin.py", line 94, in initialize
      raise e
    File "/nix/store/qhp7ahvskg59nj49sr99gz78qfqsic34-python3.12-hatch-jupyter-builder-0.9.1/lib/python3.12/site-packages/hatch_jupyter_builder/plugin.py", line 89, in initialize
      build_func(self.target_name, version, **build_kwargs)
    File "/nix/store/qhp7ahvskg59nj49sr99gz78qfqsic34-python3.12-hatch-jupyter-builder-0.9.1/lib/python3.12/site-packages/hatch_jupyter_builder/utils.py", line 115, in npm_builder
      run([*npm_cmd, "install"], cwd=str(abs_path))
    File "/nix/store/qhp7ahvskg59nj49sr99gz78qfqsic34-python3.12-hatch-jupyter-builder-0.9.1/lib/python3.12/site-packages/hatch_jupyter_builder/utils.py", line 231, in run
      return subprocess.check_call(cmd, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/nix/store/z7xxy35k7620hs6fn6la5fg2lgklv72l-python3-3.12.4/lib/python3.12/subprocess.py", line 413, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/nix/store/3ah78dwwli5k9zxwfw7nhdpycm82lp8g-python3.12-jupyterlab-4.2.4/bin/jlpm', 'install']' returned non-zero exit status 1.
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
07:19:30

Show newer messages


Back to Room ListRoom Version: 6