mamba icon indicating copy to clipboard operation
mamba copied to clipboard

Issues when Installing with poetry / pip with PEP517 build system

Open hv10 opened this issue 11 months ago • 4 comments

Hi, I have encountered an issue when trying to install your package with poetry as a package manager, or when trying to install with pip while using the build system outlined in PEP517.

It would be nice if we could install the package using poetry / pep517, but I understand if this is out-of-scope for the project.

Below you will find the relevant errors:

The error encountered when installing with poetry.
$ poetry add mamba-ssm
Using version ^1.2.0.post1 for mamba-ssm

Updating dependencies
Resolving dependencies... (1.5s)

Package operations: 1 install, 0 updates, 0 removals

  - Installing mamba-ssm (1.2.0.post1): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke get_requires_for_build_wheel
  
  Traceback (most recent call last):
    File ".../pypoetry/venv/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File ".../pypoetry/venv/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File ".../pypoetry/venv/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmpnyj12g6p/.venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmpnyj12g6p/.venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "/tmp/tmpnyj12g6p/.venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 487, in run_setup
      super().run_setup(setup_script=setup_script)
    File "/tmp/tmpnyj12g6p/.venv/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 8, in <module>
  ModuleNotFoundError: No module named 'packaging'
  

  at ~/.local/share/pypoetry/venv/lib/python3.11/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with mamba-ssm (1.2.0.post1) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "mamba-ssm (==1.2.0.post1)"'.
The error encountered when installing with pip using PEP517
$ pip wheel --no-cache-dir --use-pep517 "mamba-ssm (==1.2.0.post1)"
Collecting mamba-ssm==1.2.0.post1
  Downloading mamba_ssm-1.2.0.post1.tar.gz (34 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File ".../pypoetry/virtualenvs/hugemambabyte-61Y2CVB8-py3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File ".../pypoetry/virtualenvs/hugemambabyte-61Y2CVB8-py3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File ".../pypoetry/virtualenvs/hugemambabyte-61Y2CVB8-py3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-qwek8ot3/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-qwek8ot3/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-qwek8ot3/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-qwek8ot3/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 8, in <module>
      ModuleNotFoundError: No module named 'packaging'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel 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.

Packaging is actually already installed:

$ pip install packaging
Requirement already satisfied: packaging in .../pypoetry/virtualenvs/hugemambabyte-61Y2CVB8-py3.11/lib/python3.11/site-packages (24.0)

hv10 avatar Mar 15 '24 09:03 hv10

I encountered the same issue with pip. I ran this - pip install --upgrade pip setuptools wheel to get rid of the error.

thomas-bartlett avatar Mar 16 '24 01:03 thomas-bartlett

I encountered the same issue with pip. I ran this - pip install --upgrade pip setuptools wheel to get rid of the error.

Does not work for me I still get: ModuleNotFoundError: No module named 'packaging'

HadiSDev avatar Apr 18 '24 16:04 HadiSDev