Hello! First of all - thank you for building Pants...
# general
b
Hello! First of all - thank you for building Pants - it is a trully awesome tool. I'm evaluating the use case where all 3rd party packages need to be installed from the internal devpi index. This all works when I manually create a lock file, point a tool (like black) and run
./pants generate-lockfiles ...
However when I try to use a tool that relies on a default lockfile, I get this error: (in this particular case I was running
./pants package
against a
python_distribution
target)
Copy code
13:07:24.22 [ERROR] 1 Exception encountered:

  ProcessExecutionFailure: Process 'Building build_backend.pex from setuptools_default.lock' failed with exit code 1.
stdout:
...
 pex.result.ResultError: There were 2 errors downloading required artifacts:
1. setuptools 57.5 from <https://files.pythonhosted.org/packages/4b/b9/71687c5d2034c863db1db2e0704f5e27581ff3cb44d7f293968c5e08ceb3/setuptools-57.5.0-py3-none-any>.
whl
    <urlopen error [Errno 101] Network is unreachable>
2. wheel 0.37.1 from <https://files.pythonhosted.org/packages/27/d6/003e593296a85fd6ed616ed962795b2f87709c3eee2bca4f6d0fe55c6d00/wheel-0.37.1-py2.py3-none-any.whl> 
    <urlopen error [Errno 101] Network is unreachable>
As it tries to download from https://files.pythonhosted.org it's clear that the resolve doesn't honor the internal package index. I've tried adding the following to my
pants.toml
config with no luck:
Copy code
[python-repos]
indexes = [
  "<http://devpi.company.internal/root/+simple/>",
]
[subprocess-environment]
env_vars.add = [
  "PIP_INDEX_URL=devpi.company.internal/root/+simple/,
  "PIP_TRUSTED_HOST=devpi.company.internal",
]
Could you maybe point me in some direction where the problem may happen? Thanks very much in advance!
e
I attempted to walk through your situation a few days ago and just documented that here: https://github.com/pantsbuild/pants/issues/16328 See the bottom of the pants.toml diff where several tools have a
lockfile
path configuration added. You'll need to do that for all tools you use and then
./pants generate-lockfiles
and then commit all the new lockfiles to your repo.
b
yes, as I mentioned in the post, I can indeed pin all the tools to my own locks and it works but my question is more about how can I get around the issue when a default lock is resolved incorrectly
e
From what I can tell, your backtrace indicates this is just another tool to fix like you have the others. This one here: https://www.pantsbuild.org/docs/reference-setuptools This is definitely cryptic for sure.
It'll continue to be tool lockfile whac-a-mole.
For what it's worth, you should be able to remove the
[subprocess-environment]
configuration you added if that was just to try to work around default lock file issues. Pants / Pex won't use Pip environment variables.
👍 1
b
alright, thank you