actions / setup-python

Set up your GitHub Actions workflow with a specific version of Python
MIT License
1.68k stars 538 forks source link

Custom setuptools version #872

Closed davidofwatkins closed 3 months ago

davidofwatkins commented 4 months ago

Description: I'm working with a dependency which is incompatible with the v70 release of setuptools for reasons described in https://github.com/pypa/setuptools/issues/3201#issuecomment-2070715819. As such, I need to downgrade the version of setuptools used by actions/python, which I can't seem to do.

Action version: 5.1.0

Platform:

Runner type:

Tools version:

Repro steps:

My actions config is pretty simple:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11.5
  uses: actions/setup-python@v5
  with:
    python-version: 3.11.5
- name: Install Dependencies
  run: |
    python -m pip install setuptools==69.5.1
    python -m pip install django-allauth==0.44.0

Expected behavior:

The install of django-allauth==0.44.0 is successful.

Actual behavior:

I receive the following error message:

Collecting django-allauth==0.44.0
  Downloading django-allauth-0.44.0.tar.gz (572 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 572.5/572.5 kB 15.0 MB/s eta 0:00:00
  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 "/opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/hostedtoolcache/Python/3.11.5/x64/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 "/opt/hostedtoolcache/Python/3.11.5/x64/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-tby66xhk/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-tby66xhk/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-tby66xhk/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-tby66xhk/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 9, in <module>
      ImportError: cannot import name 'convert_path' from 'setuptools' (/tmp/pip-build-env-tby66xhk/overlay/lib/python3.11/site-packages/setuptools/__init__.py)
      [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.

If I run pip show setuptools, it shows that I have the correct (old) version of it installed:

Name: setuptools
Version: 69.5.1
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License:
Location: /opt/hostedtoolcache/Python/3.11.5/x64/lib/python3.11/site-packages
Requires:
Required-by:

And if I try to import convert_path removed in v70 of setuptools, it works as expected:

$ python -c 'from setuptools import convert_path; print("success")'
success

But this doesn't seem to work when pip is installing dependencies 🫤

Any advice or suggestions would be very appreciated! 🙏

sdas41395 commented 4 months ago

bump

WilmaK1 commented 4 months ago

bump

aparnajyothi-y commented 4 months ago

Hello @davidofwatkins, Thank you for creating this issue and we will look into it :)

izdnur commented 4 months ago

bump

sdas41395 commented 4 months ago

updating to allauth 0.50.0 solved the issue for us

Sharpek commented 4 months ago

updating to allauth 0.50.0 solved the issue for us

I managed to fix this issue without updating allauth. I install wheel and this fix problem with building (pip install allauth from wheel version).

jerinpetergeorge commented 4 months ago

updating to allauth 0.50.0 solved the issue for us

I managed to fix this issue without updating allauth. I install wheel and this fix problem with building (pip install allauth from wheel version).

How did you install the wheel? Can you give us more insight? @Sharpek

Sharpek commented 4 months ago

updating to allauth 0.50.0 solved the issue for us

I managed to fix this issue without updating allauth. I install wheel and this fix problem with building (pip install allauth from wheel version).

How did you install the wheel? Can you give us more insight? @Sharpek

Sure. I just type pip install wheel and after that pip install django-allauth==0.45.0 works. As I wrote before, it works because was installed django_allauth-0.45.0-py3-none-any.whl wheel version.

jerinpetergeorge commented 4 months ago

That did the trick @Sharpek Thanks

priya-kinthali commented 3 months ago

Hello @davidofwatkins 👋, It seems the issue may be due to an incompatibility between setuptools v70 and certain dependencies. As recommended by @Sharpek, a feasible solution is to install the 'wheel' package before proceeding with the installation of 'django-allauth'. This seems like a suitable workaround given the current issue with setuptools. To implement it, you would run:

pip install wheel
pip install django-allauth==0.45.0

Could you kindly confirm if this workaround has solved the problem you were encountering? If you're still experiencing difficulties, please do not hesitate to let us know. We're here to help!

davidofwatkins commented 3 months ago

@priya-kinthali Thanks. I ended up upgrading django-allauth to work around this issue, but it sounds like installing wheel would have worked. It's a good trick to know for next time! Thanks @Sharpek!

priya-kinthali commented 3 months ago

Hello @davidofwatkins 👋 Thanks for your confirmation😊 I'm glad that fixed your problem. I am going to close this issue, since it has been resolved, but feel free to reach us out and open a new one in case of any future problems or questions regarding our action. Thank you!

wishwa-50 commented 1 month ago

updating to allauth 0.50.0 solved the issue