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

v1.26.1 seems broken in python 3.8 #380

Closed
anis-campos opened this issue May 4, 2021 · 8 comments · Fixed by #401
Closed

v1.26.1 seems broken in python 3.8 #380

anis-campos opened this issue May 4, 2021 · 8 comments · Fixed by #401

Comments

@anis-campos
Copy link

env

bash-5.0# uname -a
Linux 85d67c49b379 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64 GNU/Linux
bash-5.0# python --version
Python 3.8.2

issue

At install there is a error:

bash-5.0# pip install yamllint==1.26.1
Collecting yamllint==1.26.1
  Using cached yamllint-1.26.1.tar.gz (126 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k2ragw37/yamllint/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k2ragw37/yamllint/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-k2ragw37/yamllint/pip-egg-info
         cwd: /tmp/pip-install-k2ragw37/yamllint/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-k2ragw37/yamllint/setup.py", line 17, in <module>
        from setuptools import setup
    ImportError: cannot import name 'setup' from 'setuptools' (unknown location)
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Seems related to the #358

@adrienverge
Copy link
Owner

Hello @anis-campos, thanks for the report.

@polyzen I've re-read our conversation at #358, and from my understanding setuptools wasn't supposed to be needed for pip install. Do you know what's wrong?

@polyzen
Copy link
Contributor

polyzen commented May 6, 2021

Looked into it: you can get pip with vendored deps, where it includes just the pkg_resources module from setuptools. Alpine, Arch, and Debian provide devendored packages of pip, pulling in setuptools as a dependency. I am not familiar with LinuxKit. A comment in Fedora's pip package sums it up well:

# But pip doesn't actually require setuptools.
# It can install wheels without them and it can build wheels in isolation mode
# (using setuptools/flit/poetry/... installed from PyPI).

@adrienverge
Copy link
Owner

So it looks like #358 does induce problems on some systems. I am not eager to add yet another new file to the repo, as proposed in #381. The best choice is probably to keep setuptools in [install_requires], like before yamllint 1.26.1. @polyzen can you do a PR to revert #358?

@polyzen
Copy link
Contributor

polyzen commented May 6, 2021

pyproject.toml is meant to replace setup.py:
https://www.python.org/dev/peps/pep-0517/
https://python-poetry.org/docs/pyproject/
https://github.com/pypa/build

Perhaps it would be a good time to make the full replacement.

@adrienverge
Copy link
Owner

Thanks, I didn't know.

  • Is pyproject.toml supported by all Python versions ≥ 3.5? By all pip (and its dependencies, if relevant) versions that are in use on "up-to-date" systems?
  • Are there any risks associated with removing setup.py? (e.g. the kind of problem this issue describes)

@polyzen
Copy link
Contributor

polyzen commented Aug 3, 2021

Thanks, I didn't know.

  • Is pyproject.toml supported by all Python versions ≥ 3.5? By all pip (and its dependencies, if relevant) versions that are in use on "up-to-date" systems?

Supported since pip 10 (released Apr 14, 2018):
pypa/pip@7c4353e

Alpine, Arch, Debian >=Stable, and Fedora >=29 have pip >=10:
https://repology.org/project/python:pip/versions

  • Are there any risks associated with removing setup.py? (e.g. the kind of problem this issue describes)

Looks like poetry and flit, but not python-build, generate a setup.py when building a source distribution, which could then be used when sourcing from PyPI. Alternatively you could keep a simple setup.py in the repo for compatibility and/or distribute wheels.

@jpramos123
Copy link

I faced this error inside a docker container using python 3.8.6:


pkg_resources.VersionConflict: (setuptools 41.6.0 (/opt/app-root/lib/python3.8/site-packages),
Requirement.parse('setuptools>=45'))

My package installation fail, and my container fails to start.

Using version ==1.26.0 solved my issue

Thanks

@adrienverge
Copy link
Owner

Hello, as of today the best option seems to revert #358 and restore setuptools as a requirement in all cases. I'll do a PR for that.

adrienverge added a commit that referenced this issue Aug 21, 2021
This reverts commit 8f68248 "Remove runtime dep 'setuptools' for Python
< 3.8".	It looks like removing setuptools induces problems on some
systems, see for example the linked discussion.

Fixes #380.
adrienverge added a commit that referenced this issue Aug 21, 2021
This reverts commit 8f68248 "Remove runtime dep 'setuptools' for Python
< 3.8". It looks like removing setuptools induces problems on some
systems, see for example the linked discussion.

Fixes #380.
adrienverge added a commit that referenced this issue Aug 21, 2021
This reverts commit 8f68248 "Remove runtime dep 'setuptools' for Python
< 3.8". It looks like removing setuptools induces problems on some
systems, see for example the linked discussion.

Fixes #380.
smk4664 added a commit to smk4664/nautobot-plugin-welcome-wizard that referenced this issue Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants