Skip to content

having setuptools_scm>6 installed globally breaks pip_install #489

@implr

Description

@implr

Affected Rule

The issue is caused by the rule: pip_install

Description

If you have setuptools_scm installed on your system, it will register itself as a setuptools plugin (because /usr/.../site_packages/ is still on sys.path). Then the part in

      File "/tmp/tmpsov87r8j/setuptools-tmp/setuptools/dist.py", line 740, in finalize_options
        ep.load()(self)

will attempt to import it. setuptools_scm>6 requires setuptools>=45, rules_python bundles setuptools 44, so that import fails therefore pip wheel fails.

🔬 Minimal Reproduction

Basically any pip_install invocation which requires building wheels will fail, as long as setuptools_scm>6 is on your global python path.

🔥 Exception or Error


Error in fail: pip_import failed: Collecting setuptools==44 (from -r /home/bartek/dev/pejs/hscloud/third_party/py/requirements.txt (line 4))
  Using cached https://files.pythonhosted.org/packages/f9/d3/955738b20d3832dfa3cd3d9b07e29a8162edb480bf988332f5e6e48ca444/setuptools-44.0.0-py2.py3-none-any.whl
  Saved ./setuptools-44.0.0-py2.py3-none-any.whl
Collecting arrow==0.14.5 (from -r /home/bartek/dev/pejs/hscloud/third_party/py/requirements.txt (line 5))
  Using cached https://files.pythonhosted.org/packages/4f/c6/32df2c68e02e2d6b4457223fa499634edabb2d4ff74f00087ffff49b4be4/arrow-0.14.5-py2.py3-none-any.whl
  Saved ./arrow-0.14.5-py2.py3-none-any.whl
Collecting asn1crypto==0.24.0 (from -r /home/bartek/dev/pejs/hscloud/third_party/py/requirements.txt (line 6))
  Using cached https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl
  Saved ./asn1crypto-0.24.0-py2.py3-none-any.whl
Collecting bcrypt==3.1.5 (from -r /home/bartek/dev/pejs/hscloud/third_party/py/requirements.txt (line 7))
  Using cached https://files.pythonhosted.org/packages/31/4b/4057d0716e7170c29ff12e19791eb6037422620835e4a58a01d4790e56d1/bcrypt-3.1.5-cp34-abi3-manylinux1_x86_64.whl
  Saved ./bcrypt-3.1.5-cp34-abi3-manylinux1_x86_64.whl
Collecting blinker==1.4 (from -r /home/bartek/dev/pejs/hscloud/third_party/py/requirements.txt (line 8))
  Using cached https://files.pythonhosted.org/packages/1b/51/e2a9f3b757eb802f61dc1f2b09c8c99f6eb01cf06416c0671253536517b6/blinker-1.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "", line 1, in 
      File "/tmp/pip-build-t0bmbmpr/blinker/setup.py", line 10, in 
        setup(name="blinker",
      File "/tmp/tmpsov87r8j/setuptools-tmp/setuptools/__init__.py", line 144, in setup
        _install_setup_requires(attrs)
      File "/tmp/tmpsov87r8j/setuptools-tmp/setuptools/__init__.py", line 132, in _install_setup_requires
        dist = distutils.core.Distribution(dict(
      File "/tmp/tmpsov87r8j/setuptools-tmp/setuptools/dist.py", line 447, in __init__
        _Distribution.__init__(self, {
      File "/usr/lib/python3.9/distutils/dist.py", line 292, in __init__
        self.finalize_options()
      File "/tmp/tmpsov87r8j/setuptools-tmp/setuptools/dist.py", line 740, in finalize_options
        ep.load()(self)
      File "/tmp/tmpsov87r8j/setuptools-tmp/pkg_resources/__init__.py", line 2442, in load
        self.require(*args, **kwargs)
      File "/tmp/tmpsov87r8j/setuptools-tmp/pkg_resources/__init__.py", line 2465, in require
        items = working_set.resolve(reqs, env, installer, extras=self.extras)
      File "/tmp/tmpsov87r8j/setuptools-tmp/pkg_resources/__init__.py", line 791, in resolve
        raise VersionConflict(dist, req).with_context(dependent_req)
    pkg_resources.VersionConflict: (setuptools 44.0.0 (/tmp/tmpsov87r8j/setuptools-tmp), Requirement.parse('setuptools>=45'))

🌍 Your Environment

Operating System:

  
gentoo
  

Output of bazel version:

  
Build label: 3.7.2- (@non-git)
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Sat Apr 24 11:55:50 2021 (1619265350)
Build timestamp: 1619265350
Build timestamp as int: 1619265350
  

Rules_python version:

  
0.0.3
  

I realize this is fairly old, but setuptools is still pinned to 44 on master. I might try to reproduce with rules_python master later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions