f-dangel / curvlinops

scipy linear operators for the Hessian, Fisher/GGN, and more in PyTorch
https://curvlinops.readthedocs.io/en/latest/
MIT License
17 stars 5 forks source link

Error when installing `curvlinops` as dependency #122

Closed wiseodd closed 2 months ago

wiseodd commented 3 months ago

From laplace-torch Github actions:

Collecting curvlinops-for-pytorch@ git+https://github.com/f-dangel/curvlinops (from laplace-torch==0.1a2)
  Cloning https://github.com/f-dangel/curvlinops to /tmp/pip-install-c9oemcf1/curvlinops-for-pytorch_8092676930d443ea8493f3627b08db31
  Running command git clone --filter=blob:none --quiet https://github.com/f-dangel/curvlinops /tmp/pip-install-c9oemcf1/curvlinops-for-pytorch_8092676930d443ea8493f3627b08db31
  Resolved https://github.com/f-dangel/curvlinops to commit 84c2ce[75](https://github.com/aleximmer/Laplace/actions/runs/9799308281/job/27059312114?pr=202#step:4:76)5c2c5325330e115a0d46f13ef15cfd2e
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/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-oh_[92](https://github.com/aleximmer/Laplace/actions/runs/9799308281/job/27059312114?pr=202#step:4:93)17v/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
        File "/tmp/pip-build-env-oh_9217v/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-oh_9217v/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 497, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-oh_9217v/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
          exec(code, locals())
        File "<string>", line 9, 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
f-dangel commented 3 months ago

Try installing wheel in your Github action before installing curvlinops. See here.

wiseodd commented 3 months ago

Will try tomorrow.

Btw, nowadays I use pdm it's super nice---just a couple lines in pyproject.toml. Example here.

It's lightweight, unlike the heavy-handed poetry.

wiseodd commented 3 months ago

Solved by

python -m pip install --upgrade pip wheel packaging
wiseodd commented 2 months ago

The issue with this is that laplace-torch and other libraries depending on curvlinops will require to add python -m pip install --upgrade pip wheel packaging in their READMEs.

I think this is not ergonomic.

I will work on a PR to migrate to pdm.