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

Hard dependency on setuptools==5.4.1 is causing bootstrap failure #3948

Closed
mkemp opened this issue Oct 11, 2016 · 3 comments
Closed

Hard dependency on setuptools==5.4.1 is causing bootstrap failure #3948

mkemp opened this issue Oct 11, 2016 · 3 comments
Labels

Comments

@mkemp
Copy link

mkemp commented Oct 11, 2016

Encountering an issue bootstrapping pants on OS X 10.11.4 with python 2.7.12. Brew is updated to the latest available.

Here's the pants.ini file:

[DEFAULT]
pants_version: 1.1.0

[python-setup]
interpreter_requirement: CPython>=2.7,<3
resolver_cache_ttl: 86000
platforms: [
    'current',
    'linux-x86_64'
  ]

[python-repos]
repos: [
    'http://pypi.internal.domain/'
  ]
indexes: [
    'http://pypi.internal.domain/simple/',
  ]

Here's the bootstrap script I'm using.

Here's the output of the run where it fails on the setuptools=5.4.1:

$ ./pants
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1679k  100 1679k    0     0  3772k      0 --:--:-- --:--:-- --:--:-- 3782k
New python executable in /Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/bin/python2.7
Also creating executable in /Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/bin/python
Installing setuptools, pip, wheel...done.
Collecting pantsbuild.pants==1.1.0
  Using cached pantsbuild.pants-1.1.0.tar.gz
Collecting ansicolors==1.0.2 (from pantsbuild.pants==1.1.0)
  Using cached ansicolors-1.0.2.tar.gz
Collecting setproctitle==1.1.10 (from pantsbuild.pants==1.1.0)
  Using cached setproctitle-1.1.10.tar.gz
Collecting twitter.common.collections<0.4,>=0.3.1 (from pantsbuild.pants==1.1.0)
  Using cached twitter.common.collections-0.3.7.tar.gz
Collecting six<2,>=1.9.0 (from pantsbuild.pants==1.1.0)
  Using cached six-1.10.0-py2.py3-none-any.whl
Collecting pathspec==0.3.4 (from pantsbuild.pants==1.1.0)
  Using cached pathspec-0.3.4.tar.gz
Collecting twitter.common.dirutil<0.4,>=0.3.1 (from pantsbuild.pants==1.1.0)
  Using cached twitter.common.dirutil-0.3.7.tar.gz
Collecting requests<2.6,>=2.5.0 (from pantsbuild.pants==1.1.0)
  Using cached requests-2.5.3-py2.py3-none-any.whl
Collecting pystache==0.5.3 (from pantsbuild.pants==1.1.0)
  Using cached pystache-0.5.3.tar.gz
Collecting scandir==1.2 (from pantsbuild.pants==1.1.0)
  Using cached scandir-1.2.zip
Collecting psutil==4.3.0 (from pantsbuild.pants==1.1.0)
  Using cached psutil-4.3.0.tar.gz
Collecting pywatchman==1.3.0 (from pantsbuild.pants==1.1.0)
  Using cached pywatchman-1.3.0.tar.gz
Collecting futures==3.0.5 (from pantsbuild.pants==1.1.0)
  Using cached futures-3.0.5-py2-none-any.whl
Collecting setuptools==5.4.1 (from pantsbuild.pants==1.1.0)
  Using cached setuptools-5.4.1-py2.py3-none-any.whl
Collecting pex==1.1.10 (from pantsbuild.pants==1.1.0)
  Using cached pex-1.1.10-py2.py3-none-any.whl
Collecting Markdown==2.1.1 (from pantsbuild.pants==1.1.0)
  Using cached Markdown-2.1.1.tar.gz
Collecting Pygments==1.4 (from pantsbuild.pants==1.1.0)
  Using cached Pygments-1.4.tar.gz
Collecting docutils<0.13,>=0.12 (from pantsbuild.pants==1.1.0)
  Using cached docutils-0.12.tar.gz
Collecting twitter.common.confluence<0.4,>=0.3.1 (from pantsbuild.pants==1.1.0)
  Using cached twitter.common.confluence-0.3.7.tar.gz
Collecting fasteners==0.14.1 (from pantsbuild.pants==1.1.0)
  Using cached fasteners-0.14.1-py2.py3-none-any.whl
Collecting coverage<3.8,>=3.7 (from pantsbuild.pants==1.1.0)
  Using cached coverage-3.7.1.tar.gz
Collecting pytest<2.7,>=2.6 (from pantsbuild.pants==1.1.0)
  Using cached pytest-2.6.4.tar.gz
Collecting pytest-cov<1.9,>=1.8 (from pantsbuild.pants==1.1.0)
  Using cached pytest-cov-1.8.1.tar.gz
Collecting lmdb==0.89 (from pantsbuild.pants==1.1.0)
  Using cached lmdb-0.89.tar.gz
Collecting twitter.common.lang==0.3.7 (from twitter.common.collections<0.4,>=0.3.1->pantsbuild.pants==1.1.0)
  Using cached twitter.common.lang-0.3.7.tar.gz
Collecting twitter.common.log==0.3.7 (from twitter.common.confluence<0.4,>=0.3.1->pantsbuild.pants==1.1.0)
  Using cached twitter.common.log-0.3.7.tar.gz
Collecting monotonic>=0.1 (from fasteners==0.14.1->pantsbuild.pants==1.1.0)
  Using cached monotonic-1.2-py2.py3-none-any.whl
Collecting py>=1.4.25 (from pytest<2.7,>=2.6->pantsbuild.pants==1.1.0)
  Using cached py-1.4.31-py2.py3-none-any.whl
Collecting cov-core>=1.14.0 (from pytest-cov<1.9,>=1.8->pantsbuild.pants==1.1.0)
  Using cached cov-core-1.15.0.tar.gz
Collecting twitter.common.options==0.3.7 (from twitter.common.log==0.3.7->twitter.common.confluence<0.4,>=0.3.1->pantsbuild.pants==1.1.0)
  Using cached twitter.common.options-0.3.7.tar.gz
Building wheels for collected packages: pantsbuild.pants, ansicolors, setproctitle, twitter.common.collections, pathspec, twitter.common.dirutil, pystache, scandir, psutil, pywatchman, Markdown, Pygments, docutils, twitter.common.confluence, coverage, pytest, pytest-cov, lmdb, twitter.common.lang, twitter.common.log, cov-core, twitter.common.options
  Running setup.py bdist_wheel for pantsbuild.pants ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/68/e8/59/59025fec42943645e9984f64fcd1c1d9239e962a74ee6f69c8
  Running setup.py bdist_wheel for ansicolors ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/3a/e9/7a/d539da1af316475bbfe0710f15249d194ccf96755293af318d
  Running setup.py bdist_wheel for setproctitle ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/5b/e6/ac/0a9f3ba8962551d270aa651226c7ccb561b3c3f94063cb2f27
  Running setup.py bdist_wheel for twitter.common.collections ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/2a/6b/3e/7d9b44c1b4f01d0fb06719364b5c1e0de008daa63f6d5ca03d
  Running setup.py bdist_wheel for pathspec ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/05/fc/50/1a7e8fc57b03fe4c1299f1cf04e89ac8606614769ca65a9f5f
  Running setup.py bdist_wheel for twitter.common.dirutil ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/a0/dd/df/4fddf60e01e1f28877f441649de6d3b8b08f64f4b5ff09ceeb
  Running setup.py bdist_wheel for pystache ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/9f/ad/66/0c671b563cdf76d88f1ab37a9db5e1804e2dd32cff0e70454e
  Running setup.py bdist_wheel for scandir ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/05/30/da/2e612ab84a6efb0d3fc104856ecda6dd21d49793679b9b4357
  Running setup.py bdist_wheel for psutil ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/e9/8b/35/535f07b31ebe94e56901cee48e1291e18989b272d79de437db
  Running setup.py bdist_wheel for pywatchman ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/72/10/43/28655ed4bb6bd65cfee7d3e377b05c1218ba5ccfc52da4e1c4
  Running setup.py bdist_wheel for Markdown ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/54/57/5d/d85a28804ddffc92283587426652d63ed9578cc01fbf6be957
  Running setup.py bdist_wheel for Pygments ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/ea/0e/59/c878cc73abc93eff6f42d83a924b5901f4163c3c9e1e1ffc1f
  Running setup.py bdist_wheel for docutils ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/db/de/bd/b99b1e12d321fbc950766c58894c6576b1a73ae3131b29a151
  Running setup.py bdist_wheel for twitter.common.confluence ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/25/c3/50/6a11de424e46102442655de1b43333f20b1f81df131398d2a3
  Running setup.py bdist_wheel for coverage ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/09/d5/14/fad8864342631171117f01b9b2473a07c053e5c1054d40e48c
  Running setup.py bdist_wheel for pytest ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/ca/1c/fe/8b76e537572f91c810910e822cccb178ba3156e432e644ac89
  Running setup.py bdist_wheel for pytest-cov ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/e5/94/08/eab43cda4e17e6ae729ed2cd832d7ca4e3ddca7fa6886ec2b8
  Running setup.py bdist_wheel for lmdb ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/1d/36/58/b211fed809590977150eabf644580f7bc23569d1d782275fd6
  Running setup.py bdist_wheel for twitter.common.lang ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/b4/91/6b/e0a5ae9722528a67f600d436e0b97b30a040a65a5a35978272
  Running setup.py bdist_wheel for twitter.common.log ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/26/36/82/e6a6b7ca739262435cecee1cde7950bf60950f1aaa2ce21093
  Running setup.py bdist_wheel for cov-core ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/86/e1/c2/9ff8cfe9773ce07003f2c2be096e169af4614c2f634671d49b
  Running setup.py bdist_wheel for twitter.common.options ... done
  Stored in directory: /Users/mkemp/Library/Caches/pip/wheels/60/c2/40/54b323809df9598cc125f02527f93ff743cd9bd979f4a1737d
Successfully built pantsbuild.pants ansicolors setproctitle twitter.common.collections pathspec twitter.common.dirutil pystache scandir psutil pywatchman Markdown Pygments docutils twitter.common.confluence coverage pytest pytest-cov lmdb twitter.common.lang twitter.common.log cov-core twitter.common.options
Installing collected packages: ansicolors, setproctitle, twitter.common.lang, twitter.common.collections, six, pathspec, twitter.common.dirutil, requests, pystache, scandir, psutil, pywatchman, futures, setuptools, pex, Markdown, Pygments, docutils, twitter.common.options, twitter.common.log, twitter.common.confluence, monotonic, fasteners, coverage, py, pytest, cov-core, pytest-cov, lmdb, pantsbuild.pants
  Found existing installation: setuptools 23.1.0
    Not uninstalling setuptools at /usr/local/lib/python2.7/site-packages, outside environment /Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/bin/..
Successfully installed Markdown-2.1.1 Pygments-1.4 ansicolors-1.0.2 cov-core-1.15.0 coverage-3.7.1 docutils-0.12 fasteners-0.14.1 futures-3.0.5 lmdb-0.89 monotonic-1.2 pantsbuild.pants-1.1.0 pathspec-0.3.4 pex-1.1.10 psutil-4.3.0 py-1.4.31 pystache-0.5.3 pytest-2.6.4 pytest-cov-1.8.1 pywatchman-1.3.0 requests-2.5.3 scandir-1.2 setproctitle-1.1.10 setuptools-23.1.0 six-1.10.0 twitter.common.collections-0.3.7 twitter.common.confluence-0.3.7 twitter.common.dirutil-0.3.7 twitter.common.lang-0.3.7 twitter.common.log-0.3.7 twitter.common.options-0.3.7
Exception caught: (<class 'pkg_resources.ContextualVersionConflict'>)
  File "/Users/mkemp/.cache/pants/setup/bootstrap/1.1.0/bin/pants", line 11, in <module>
    sys.exit(main())
  File "/Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/lib/python2.7/site-packages/pants/bin/pants_exe.py", line 44, in main
    PantsRunner(exiter).run()
  File "/Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/lib/python2.7/site-packages/pants/bin/pants_runner.py", line 57, in run
    options_bootstrapper=options_bootstrapper)
  File "/Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/lib/python2.7/site-packages/pants/bin/pants_runner.py", line 46, in _run
    return LocalPantsRunner(exiter, args, env, options_bootstrapper=options_bootstrapper).run()
  File "/Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/lib/python2.7/site-packages/pants/bin/local_pants_runner.py", line 53, in run
    self._maybe_profiled(self._run)
  File "/Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/lib/python2.7/site-packages/pants/bin/local_pants_runner.py", line 50, in _maybe_profiled
    runner()
  File "/Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/lib/python2.7/site-packages/pants/bin/local_pants_runner.py", line 59, in _run
    options, build_config = OptionsInitializer(options_bootstrapper, exiter=self._exiter).setup()
  File "/Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/lib/python2.7/site-packages/pants/bin/options_initializer.py", line 174, in setup
    backends)
  File "/Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/lib/python2.7/site-packages/pants/bin/options_initializer.py", line 83, in _load_plugins
    return load_backends_and_plugins(plugins, working_set, backend_packages)
  File "/Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/lib/python2.7/site-packages/pants/bin/extension_loader.py", line 37, in load_backends_and_plugins
    load_plugins(build_configuration, plugins or [], working_set)
  File "/Users/mkemp/.cache/pants/setup/bootstrap/pants.RpXRl7/install/lib/python2.7/site-packages/pants/bin/extension_loader.py", line 87, in load_plugins
    entries['register_goals'].load()()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2228, in load
    self.require(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2245, in require
    items = working_set.resolve(reqs, env, installer)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 834, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)

Exception message: (setuptools 23.1.0 (/usr/local/lib/python2.7/site-packages), Requirement.parse('setuptools==5.4.1'), set(['pantsbuild.pants']))

FWIW, I've tried removing .pants.d, ~/.cache/pants and ~/Library/Caches/pip/wheels and still see the same results.

@jsirois
Copy link
Contributor

jsirois commented Oct 11, 2016

Please try this and report back:

$ git diff
diff --git a/pants b/pants
index 6774d66..f9089e7 100755
--- a/pants
+++ b/pants
@@ -72,7 +72,7 @@ function bootstrap_pants {
     (
       venv_path="$(bootstrap_venv)" && \
       staging_dir=$(tempdir "${PANTS_BOOTSTRAP}") && \
-      "${PYTHON}" "${venv_path}/virtualenv.py" --no-download "${staging_dir}/install" && \
+      "${PYTHON}" "${venv_path}/virtualenv.py" --no-download --no-setuptools "${staging_dir}/install" && \
       "${staging_dir}/install/bin/python" "${staging_dir}/install/bin/pip" install "${pants_requirement}" && \
       ln -s "${staging_dir}/install" "${staging_dir}/${pants_version}" && \
       mv "${staging_dir}/${pants_version}" "${PANTS_BOOTSTRAP}/${pants_version}"

@mkemp
Copy link
Author

mkemp commented Oct 17, 2016

Implementing that flag seems to have done the trick. Thanks for the fast response John!

@mkemp mkemp closed this as completed Oct 17, 2016
jsirois added a commit to pantsbuild/setup that referenced this issue Oct 22, 2016
This allows pants relatively old setuptools constraint to trump fixing
pantsbuild/pants#3948
@jsirois
Copy link
Contributor

jsirois commented Oct 22, 2016

Great - thanks for verifying. I committed this diff over at pantsbuild/setup@a4b5f74

@jsirois jsirois reopened this Oct 22, 2016
@jsirois jsirois closed this as completed Oct 22, 2016
Eric-Arellano added a commit to pantsbuild/setup that referenced this issue Mar 16, 2019
)

### Problem
We originally had to manually pin setuptools to 5.4.1 to workaround pantsbuild/pants#3948.

This is no longer the case thanks to multiple changes to Pex and Pants, most recently seen at pantsbuild/pants#6594.

Continuing to pin to 5.4.1 prevents Python 3 from working, as seen with https://travis-ci.org/pantsbuild/setup/jobs/507117401#L553.

### Solution
Remove all custom code resolving setuptools and let Pip install and resolve as it normally does.

1. 14 fewer lines of custom code, making the script easier for people to understand and for us to develop.
    * Note `pip` ships with `setuptools` by default for a reason. It's a sensible default.
1. We end up with the same version as Pants after all is done, which is the behavior we want.
1. If we ever needed to bump the pinned version, we would need people to curl the script again, which is very infrequent for them to do.

### Result
Because we pin `setuptools` in Pants' `requirements.txt`, we end up getting the exact same setuptools that Pants is using for that version.

This is the output after creating a new virtual env:
```
Successfully installed Markdown-2.1.1 Pygments-2.3.1 ansicolors-1.0.2 asn1crypto-0.24.0 asttokens-1.1.13 certifi-2019.3.9 cffi-1.11.1 chardet-3.0.4 configparser-3.5.0 contextlib2-0.5.5 cryptography-2.6.1 docutils-0.12 enum34-1.1.6 fasteners-0.14.1 faulthandler-2.6 future-0.17.1 idna-2.8 ipaddress-1.0.22 monotonic-1.5 packaging-16.8 pantsbuild.pants-1.15.0.dev4 pathspec-0.5.9 pex-1.5.3 ply-3.11 psutil-5.4.8 py-zipkin-0.17.0 pycparser-2.19 pyopenssl-17.3.0 pyparsing-2.3.1 pystache-0.5.3 pywatchman-1.4.1 requests-2.21.0 scandir-1.2 setproctitle-1.1.10 setuptools-40.4.3 six-1.12.0 subprocess32-3.2.7 thriftpy2-0.4.2 twitter.common.collections-0.3.10 twitter.common.confluence-0.3.10 twitter.common.dirutil-0.3.10 twitter.common.lang-0.3.10 twitter.common.log-0.3.10 twitter.common.options-0.3.10 urllib3-1.24.1 wheel-0.31.1 www-authenticate-0.9.2

New virtual environment successfully created at /Users/eric/.cache/pants/setup/bootstrap-Darwin-x86_64/1.15.0.dev4_py27.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants