I am having trouble with bootstrapping that I can'...
# general
l
I am having trouble with bootstrapping that I can't quite figure out. When running any pants command I get an error with pex 2.1.42:
Copy code
$ p list ::
Bootstrapping Pants using /Users/ryan.king/.asdf/shims/python3.8
Creating the virtualenv PEX.
Downloading the Pex PEX.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   640  100   640    0     0    870      0 --:--:-- --:--:-- --:--:--   876
100 3529k  100 3529k    0     0  2633k      0  0:00:01  0:00:01 --:--:-- 18.5M
No version is set for command python3.8
Consider adding one of the following versions in your config file at 
python 3.8.12
SHA256 of <https://github.com/pantsbuild/pex/releases/download/v2.1.42/pex> is not as expected. Aborting.
Adding config to upgrade doesn't seem to help
Copy code
diff --git a/pants.toml b/pants.toml
index bb0945af39..8758c5189b 100644
--- a/pants.toml
+++ b/pants.toml
@@ -147,3 +147,6 @@ build_args = [
 config = ".pylintrc"
 source_plugins = ["//src/clr_pylint_checkers"]
 lockfile = ".pylint.lockfile"
+
+[download-pex-bin]
+version = "2.1.63"`
For context I both recently upgrade to Mac OS Monterey and we upgraded pants to 2.9.0
h
I think those two things are different, it looks like that first snippet is for the
./pants
bash script which downloads Pex in order to bootstrap running Pants itself. The second snippet only changes what Pex is used after Pants already is bootstrapped. John recently made some improvements to the bash script at https://github.com/pantsbuild/setup/blob/gh-pages/pants, including using a more modern version of Pex. I recommend upgrading your script (check that into git)
l
ok, upgrading that seems to change which version is downloaded, but I get the same error still
Copy code
$ p list ::
No preset version installed for command python3.9
Please install a version by running one of the following:

asdf install python 3.8.12
asdf install python 3.6.15

or add one of the following versions in your config file at /Users/ryan.king/code/color/.tool-versions
python 3.9.7
Bootstrapping Pants using /Users/ryan.king/.asdf/shims/python3.8
Creating the virtualenv PEX.
Downloading the Pex PEX.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   640  100   640    0     0   1623      0 --:--:-- --:--:-- --:--:--  1658
100 3609k  100 3609k    0     0  3066k      0  0:00:01  0:00:01 --:--:-- 5888k
No version is set for command python3.8
Consider adding one of the following versions in your config file at 
python 3.8.12
SHA256 of <https://github.com/pantsbuild/pex/releases/download/v2.1.62/pex> is not as expected. Aborting.
what appears to be happening is that fingerprinting the pex download if failing because, for some reason, when the pants script calls python3.8, asdf things there is not version installed
added some debug output:
Copy code
DEBUG python /Users/ryan.king/.asdf/shims/python3.8
No version is set for command python3.8
Consider adding one of the following versions in your config file at 
python 3.8.12
SHA256 of <https://github.com/pantsbuild/pex/releases/download/v2.1.62/pex> () is not as expected (56668b1ca147bd63141e586ffee97c7cc51ce8e6eac6c9b7a4bf1215b94396e5). Aborting.
that same command works fine when I call it directly:
Copy code
$ /Users/ryan.king/.asdf/shims/python3.8 --version
Python 3.8.12
Ah I figure out what is going on and why. So, I use asdf to manage python versions, which uses a
.tool-versions
file at the root of our repo to set versions. Until recently I also had a
~/.tool-versions
to set a default for my user account. I deleted that to debug a different issue. I think that the bootstrapping process is happening outside the directory tree of our repo, so asdf did not have a python version configured.
Is this worth filing an issue?
Also note, that I am now onto a different issue, with the latest pants script -> https://gist.github.com/ryanking/1cbd8ef1ef832bac6b3aa0bee2dcde6f
It seems to be asking for pex 2.1.63, but pants 2.9.0 only works up through 2.1.61?
e
The
pants
script's Pex version is independent of anything else. That script just uses Pex to download virtualenv. And it uses 2.1.62: https://github.com/pantsbuild/setup/blob/f58bc5a44ef738325c57308349ccda3fc39567ec/pants#L37-L39 No released Pants version uses anything past 2.1.61. Here's the tip of main: https://github.com/pantsbuild/pants/blob/e30239dc7238b48aec97562a37e096e0c4058e19/src/python/pants/backend/python/util_rules/pex_cli.py#L42-L44 for example, still shipping with 2.1.61 as the default. Do you have relevant custom config somewhere?
c
@loud-laptop-17949 that’s the version of pex you added to your pants.toml in the OP.
l
sorry, yeah I forgot to post that I reverted that change and things are fixed!
👍 1