Hi, Setting up Pants from scratch (after deleting ...
# general
f
Hi, Setting up Pants from scratch (after deleting the .cache/pants directory) lead to an error:
Copy code
>> ./pants tests target
 [ERROR] 1 Exception encountered:

  FileNotFoundError: [Errno 2] No such file or directory: '.cache/pants/setup/bootstrap-Darwin-x86_64/pants.0fpKJL/install/lib/python3.9/site-packages/pants/backend/python/subsystems/pytest_lockfile.txt'
The pytest_lockfile.txt is missing and prevents pants from running tests. Any idea of how to resolve this issue ?
r
Usually i bootstrap pants if I delete any cache etc.
./pants version
Which i suppose you already did
f
What do you mean by bootstrap ? I found the issue. If I delete the
~/.cache/pants
directory, I also have to delete the pants related directories in my local repo (
.pants.d
and
pids
).
e
Although deleting
.pants.d
and
.pids
worked, that was just a secondary effect. What really happened here was that the
pantsd
daemon was still running when you deleted
~/.cache/pants
and that long running daemon needs the Python venv you deleted (it runs from there). When you delete
.pants.d
and
.pids
that's a round-about way to force
pantsd
to restart. You could have also done
pkill pantsd
or any number of other things to force the
pantsd
daemon process to stop.
f
I see. I am not familiar yet with the underlying process of pants. I updated the python version from 3.8 to 3.9, but then pants would not run anymore. Do you have a recommended way to update pants after changing the python version ?
e
Ah. No, what you ended up doing is about the best you can do today. That points out a bug in the
pants
script though. It should probably specify
--copies
when creating the pants venv. Since it doesn't currently, if the venv was built using a system Python that is layer upgraded, the venv is corrupted. This is a known issue with all venvs not created with
--copies
. I'll mint an issue / fix against the pantsbuild/setup repo this morning: https://github.com/pantsbuild/setup/blob/98e8f51f6094c30941f56d9ebdc49a9af6f82085/pants#L359
👍 1
SO,
--copies
doesn't work. I was naive. I think we have no obvious way of fixing the current Pants venv scheme to be robust to this. It would effectively require yet another script to run that would repair the 1st.