damonlynch / rapid-photo-downloader

Rapid Photo Downloader is the leading photo and video downloader for the Linux desktop.
https://damonlynch.net/rapid
GNU General Public License v3.0
114 stars 30 forks source link

setuptools >= 60.0 failing due to "assert '_distutils' in core.__file__, core.__file__" error #61

Closed fiepfiep closed 2 years ago

fiepfiep commented 2 years ago

I created and activated a virutal environment. Then I run the install script.

 philippe  (e) rapid-photo-downloader  ~  rapid-photo-downloader  python install.py --virtual-env                       1   main 
Using virtual environment for installation using pip.
Detected Linux distribution Fedora Linux 35 (Workstation Edition) 
Traceback (most recent call last):
  File "/home/philippe/rapid-photo-downloader/install.py", line 14637, in <module>
    main()
  File "/home/philippe/rapid-photo-downloader/install.py", line 4148, in main
    packages, local_pip = pip_packages_required(distro_details.distro)
  File "/home/philippe/rapid-photo-downloader/install.py", line 665, in pip_packages_required
    import setuptools
  File "/home/philippe/rapid-photo-downloader/venv/lib64/python3.10/site-packages/setuptools/__init__.py", line 8, in <module>
    import _distutils_hack.override  # noqa: F401
  File "/home/philippe/rapid-photo-downloader/venv/lib64/python3.10/site-packages/_distutils_hack/override.py", line 1, in <module>
    __import__('_distutils_hack').do_override()
  File "/home/philippe/rapid-photo-downloader/venv/lib64/python3.10/site-packages/_distutils_hack/__init__.py", line 71, in do_override
    ensure_local_distutils()
  File "/home/philippe/rapid-photo-downloader/venv/lib64/python3.10/site-packages/_distutils_hack/__init__.py", line 59, in ensure_local_distutils
    assert '_distutils' in core.__file__, core.__file__
AssertionError: /usr/lib64/python3.10/distutils/core.py

Honestly, I would prefer to get rid of distutils and use setuptools instead.

the rpm package in fedora repo is also broken and does not even launch.

damonlynch commented 2 years ago

The install.py script does not import distutils. I do believe you're seeing a bug in setuptools. It would be extremely helpful if you could determine the most recent version of setuptools that is not broken. Try the recent releases until you determine the most recent one that works. Then I will adjust the setup script accordingly. I would be truly grateful if you can do this.

The update package request for Fedora has been languishing for some time. If you know someone in Fedora who can look into it that would also be helpful.

fiepfiep commented 2 years ago

Thanks. I will investigate. Probably indeed a setuptools issue, but adding a pyproject.toml might help...

Philippe

Op zo 6 feb. 2022 15:31 schreef Damon Lynch @.***>:

The install.py script does not import distutils. I do believe you're seeing a bug in setuptools. It would be extremely helpful if you could determine the most recent version of setuptools that is not broken. Try the recent releases until you determine the most recent one that works. Then I will adjust the setup script accordingly. I would be truly grateful if you can do this.

The update package request for Fedora https://bugzilla.redhat.com/show_bug.cgi?id=2031866 has been languishing for some time. If you know someone in Fedora who can look into it that would also be helpful.

— Reply to this email directly, view it on GitHub https://github.com/damonlynch/rapid-photo-downloader/issues/61#issuecomment-1030844114, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDG2CO2MN2ENZDDUDQVBYDUZ2A3PANCNFSM5NVKAEOQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

damonlynch commented 2 years ago

If recent setuptools now require a pyproject.toml then please let me know about that too. Perhaps the backwards compatibility of setuptools is not ideal? I haven't looked into it.

fiepfiep commented 2 years ago

problem is: even in a virutalenv, setuptools still uses my system's setuptools version. pyproject.toml seems to be the future, we might want do adopt. link to pep518 There you can specify your build setup requirements, such as setuptools, wheel and pip. For me, removing this seems to solve the issue:

    try:
        import setuptools
    except ImportError:
        packages.append(pip_package("setuptools", local_pip, distro))
fiepfiep commented 2 years ago

system setuptools version: setuptools 57.4.0 (July 2021)

If I revert my venv setuptools version to 57.4, the installer works fine!! however, in order to do this I had to use --do-not-upgrade-pip" argument when running the installer. Otherwise, 'update_pip_setuptools_wheel' will decide to update it. probably because of function is_recent_pypi_package. using version.

version 59.7 also works. version 60+ does not.

damonlynch commented 2 years ago

Thanks, that's very helpful. Either setuptools is deliberately making a backwards incompatible change (which is somewhat annoying), or else, it has a bug. Probably the former.

My other project uses pyproject.toml, which was easy because it is a much simpler project: https://github.com/damonlynch/showinfilemanager

However, bringing the setup.py in Rapid Photo Downloader up-to-date with pyproject.toml is not trivial. Python packaging can be difficult.

damonlynch commented 2 years ago

There was in fact a change that breaks things in setuptools v60.0.0.