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

python: pip: missing setuptools dependency #74651

Merged
merged 1 commit into from Nov 29, 2019
Merged

Conversation

jonafato
Copy link
Contributor

Motivation for this change

pip commands that deal with source distributions require setuptools.
This change unbreaks those commands.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @ FRidh

@jonringer
Copy link
Contributor

can you give an example?

@jonringer
Copy link
Contributor

also, can you change the base branch to staging, this is too many rebuilds for master

pip commands that deal with source distributions require setuptools.
This change unbreaks those commands.
@jonafato
Copy link
Contributor Author

Base changed to staging. Examples below:

With current staging:

[nix-shell:/tmp/example]$ pip download uwsgi
Collecting uwsgi
  Using cached https://files.pythonhosted.org/packages/e7/1e/3dcca007f974fe4eb369bf1b8629d5e342bb3055e2001b2e5340aaefae7a/uwsgi-2.0.18.tar.gz
  Saved ./uwsgi-2.0.18.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /nix/store/w5a20i6x17b31nkmrmgdkssvwg8k374z-python3-3.8.0/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/run/user/1000/pip-download-terhbjoy/uwsgi/setup.py'"'"'; __file__='"'"'/run/user/1000/pip-download-terhbjoy/uwsgi/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 /run/user/1000/pip-download-terhbjoy/uwsgi/pip-egg-info
         cwd: /run/user/1000/pip-download-terhbjoy/uwsgi/
    Complete output (3 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
[nix-shell:/tmp/example]$ pip install --target . flask
Collecting flask
  Using cached https://files.pythonhosted.org/packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
Collecting click>=5.1
  Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting itsdangerous>=0.24
  Using cached https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Jinja2>=2.10.1
  Using cached https://files.pythonhosted.org/packages/65/e0/eb35e762802015cab1ccee04e8a277b03f1d8e53da3ec3106882ec42558b/Jinja2-2.10.3-py2.py3-none-any.whl
Collecting Werkzeug>=0.15
  Using cached https://files.pythonhosted.org/packages/ce/42/3aeda98f96e85fd26180534d36570e4d18108d62ae36f87694b476b83d6f/Werkzeug-0.16.0-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23
  Using cached https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /nix/store/w5a20i6x17b31nkmrmgdkssvwg8k374z-python3-3.8.0/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/run/user/1000/pip-install-xxd62r0q/MarkupSafe/setup.py'"'"'; __file__='"'"'/run/user/1000/pip-install-xxd62r0q/MarkupSafe/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 /run/user/1000/pip-install-xxd62r0q/MarkupSafe/pip-egg-info
         cwd: /run/user/1000/pip-install-xxd62r0q/MarkupSafe/
    Complete output (3 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

With this change:

[nix-shell:/tmp/example]$ pip download uwsgi
Collecting uwsgi
  File was already downloaded /tmp/example/uwsgi-2.0.18.tar.gz
Successfully downloaded uwsgi
[nix-shell:/tmp/example]$ pip install --target . flask
Collecting flask
  Using cached https://files.pythonhosted.org/packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
Collecting click>=5.1
  Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting Werkzeug>=0.15
  Using cached https://files.pythonhosted.org/packages/ce/42/3aeda98f96e85fd26180534d36570e4d18108d62ae36f87694b476b83d6f/Werkzeug-0.16.0-py2.py3-none-any.whl
Collecting itsdangerous>=0.24
  Using cached https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting Jinja2>=2.10.1
  Using cached https://files.pythonhosted.org/packages/65/e0/eb35e762802015cab1ccee04e8a277b03f1d8e53da3ec3106882ec42558b/Jinja2-2.10.3-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23
  Using cached https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz
Installing collected packages: click, Werkzeug, itsdangerous, MarkupSafe, Jinja2, flask
    Running setup.py install for MarkupSafe ... done
Successfully installed Jinja2-2.10.3 MarkupSafe-1.1.1 Werkzeug-0.16.0 click-7.0 flask-1.1.1 itsdangerous-1.1.0

@jonringer
Copy link
Contributor

don't think I've used the download command, but seems reasonable

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jonringer jonringer merged commit 25f0dab into NixOS:staging Nov 29, 2019
@jonafato jonafato deleted the fix-pip branch November 29, 2019 23:55
@FRidh
Copy link
Member

FRidh commented Nov 30, 2019

Reverted in 5bdd7a5.

@FRidh
Copy link
Member

FRidh commented Nov 30, 2019

Pip does not have a setuptools dependency. What you see is after downloading when the package gets installed, which nowadays tries to follow PEP 517 which means whatever backend the package needs needs to be provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants