Maybe related to the above question from Sean re: ...
# general
b
Maybe related to the above question from Sean re: urllib, I’m getting this error:
Copy code
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: <https://github.com/urllib3/urllib3/issues/2168>
I was not previously getting this error, it started yesterday (Sean said May 4 for them). I’ve tried recreating my previous setup using the steps below. (FYI our pants_version is 2.13.0) Steps 1. Made a fresh clone of our repo 2. Made a fresh branch from an earlier commit hash (April 25) 3. Made a fresh virtual env (I don’t think this matters for Pants, but did it anyway) 4. Cleaned out the
~/.cache/pants
dir on my local system 5. Ran
./pants --version
, which fails with the above ImportError. What am I missing? I can only think of 2 reasons this could happen: 1. Some permanent change to my system was made that’s somehow influencing Pants (though I don’t believe it should, since it’s hermetic execution) 2. During Pants bootstrapping, live resources are pulled independent of local configuration (or there’s a config setting that could fix this, but I do not yet know of it) I’m new to Pants, so thank you for your help and patience!
b
Unfortunately, this is a problem with installing/bootstrapping pants itself, which isn't fully hermetic/reproducible. As in, doing a fresh install of pants on May 1 might have different behaviour to May 9. In theory, the
PIP_CONSTRAINTS
suggestion in https://pantsbuild.slack.com/archives/C046T6T9U/p1683661374866099?thread_ts=1683574114.661669&amp;cid=C046T6T9U should help with this installation issue.
You may need do step 4 again, before doing that, to ensure you get a fresh install
b
I will try this and get back, thank you!!
Unfortunately this doesn’t seem to work, running
./pants
blanket fails with that ImportError. I downloaded an updated
./pants
script that sources
.pants.bootstrap
, and added the constraints. I confirmed that it’s detecting the file, though I’m not sure how to confirm whether it’s correctly passing those constraints to pip--any guidance? I can see in
~/.cache/pants/…/2.13.0_py39/lib/python3.9/site-packages/
that the urllib3 version is 2.0.2, despite setting urllib3<2 in constraints.
As a side note, I tried installing the pants binary launcher and this issue goes away, so I guess my local python interpreter somehow got “corrupt” and is passing that on to the
./pants
installer?
e
I don't think so:
Copy code
jsirois@Gill-Windows:~/dev/pantsbuild/example-django (main) $ rm -rf ~/.cache/pants/setup/
jsirois@Gill-Windows:~/dev/pantsbuild/example-django (main) $ echo "urllib3<2" > constraints.txt
jsirois@Gill-Windows:~/dev/pantsbuild/example-django (main) $ PIP_CONSTRAINT=constraints.txt ./pants -V
Bootstrapping Pants using /home/jsirois/.pyenv/shims/python3.9
Creating the virtualenv PEX.
Downloading the Pex PEX.
SHA256 fingerprint of <https://github.com/pantsbuild/pex/releases/download/v2.1.103/pex> verified.
Installing pantsbuild.pants==2.14.0 into a virtual environment at /home/jsirois/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39
New virtual environment successfully created at /home/jsirois/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39.
18:19:02.76 [INFO] Initializing scheduler...
18:19:02.92 [INFO] Scheduler initialized.
2.14.0
jsirois@Gill-Windows:~/dev/pantsbuild/example-django (main) $ ls -l /home/jsirois/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/ | grep urllib3
drwxr-xr-x  6 jsirois jsirois   4096 May  9 18:18 urllib3
drwxr-xr-x  2 jsirois jsirois   4096 May  9 18:18 urllib3-1.26.15.dist-info
That's for the pantsbuild/example-django repo using the checked-in
./pants
script just now.
guess my local python interpreter somehow got “corrupt” and is passing that on
Both
pants
and
./pants
create a venv as a 1st step. It's just that
pants
uses a hermetic interpreter and `./pants`picks one from your system - but either way its a fresh new venv. They each then install
pantsbuild.pants
in the fresh venv using
pip install ...
and thus the
PIP_*
env var trick works.
@best-furniture-15331 in my example CLI session above I did not use
.pants.bootstrap
for clarity. Perhaps you can do that too to rule out weirdness there 1st?
One way to test PIP_CONSTRAINT is use a bogus value, then Pip blows up:
Copy code
jsirois@Gill-Windows:~/dev/pantsbuild/example-django (main) $ rm -rf ~/.cache/pants/setup/
jsirois@Gill-Windows:~/dev/pantsbuild/example-django (main) $ PIP_CONSTRAINT=spam.txt ./pants -V
Bootstrapping Pants using /home/jsirois/.pyenv/shims/python3.9
Creating the virtualenv PEX.
Downloading the Pex PEX.
SHA256 fingerprint of <https://github.com/pantsbuild/pex/releases/download/v2.1.103/pex> verified.
Installing pantsbuild.pants==2.14.0 into a virtual environment at /home/jsirois/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'spam.txt'
WARNING: You are using pip version 21.1.2; however, version 23.1.2 is available.
You should consider upgrading via the '/home/jsirois/.cache/pants/setup/bootstrap-Linux-x86_64/pants.F188cA/install/bin/python -m pip install --upgrade pip' command.
b
I just tested it by setting the env var inline instead of through .pants.bootstrap and it works! I went back and added
export
to my
.pants.bootstrap
file so that must’ve been the problem
(I originally had only
PIP_CONSTRAINT=constraints.txt
without export)
e
ah yes, the export is needed.