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

ImportError: cannot import name 'find_packages' from 'distutils.core' #1382

Open
3 tasks done
neektwothousand opened this issue Oct 18, 2024 · 0 comments
Open
3 tasks done

Comments

@neektwothousand
Copy link

Prerequisites

Description

can't install Pixivutil2-2024.7.3 with setup.py

Steps to Reproduce

run setup.py with Python 3.12.7 on ArchLinux

Expected behavior: Successfully installed PixivUtil2-2024.7.3

Actual behavior:

Processing /home/neek/src/PixivUtil2
  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
  ╰─> [26 lines of output]
      Traceback (most recent call last):
        File "<string>", line 8, in <module>
      ImportError: cannot import name 'convert_path' from 'setuptools' (/tmp/pip-build-env-nzzh9_q5/overlay/lib/python3.12/site-packages/setuptools/__init__.py)
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/home/neek/.venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/neek/.venv/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 "/home/neek/.venv/lib/python3.12/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-nzzh9_q5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-nzzh9_q5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-nzzh9_q5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 516, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-nzzh9_q5/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, in run_setup
          exec(code, locals())
        File "<string>", line 11, in <module>
      ImportError: cannot import name 'find_packages' from 'distutils.core' (/tmp/pip-build-env-nzzh9_q5/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.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.

I fixed it myself as workaround modifying setup.py imports with:

from setuptools import find_packages, setup
from distutils.util import convert_path
SETUPTOOLS_USED = True
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