brash-baker-91190
11/30/2021, 9:01 PMERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
when I try to run anything (even ./pants version
)hundreds-father-404
12/01/2021, 4:06 PMset -x
to the top and try running again, copy the output if posible here?brash-baker-91190
12/01/2021, 4:14 PMbrash-baker-91190
12/01/2021, 4:15 PMsudo
and have it work, which ends up using a system Python (not Pyenv), if that's useful.hundreds-father-404
12/01/2021, 4:15 PM++ /home/gitpod/.cache/pants/setup/bootstrap-Linux-x86_64/pants.8SS4Vl/install/bin/pip install -U pip
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
WARNING: You are using pip version 21.1.2; however, version 21.3.1 is available.
You should consider upgrading via the '/home/gitpod/.cache/pants/setup/bootstrap-Linux-x86_64/pants.8SS4Vl/install/bin/python -m pip install --upgrade pip' command.
hundreds-father-404
12/01/2021, 4:18 PMbrash-baker-91190
12/01/2021, 4:25 PM/usr/bin/env: 'python3.7': No such file or directory
Installing a 3.7 Python now....brash-baker-91190
12/01/2021, 4:29 PM$ pyenv versions
system
* 3.7.0 (set by /workspace/cloudsmith-buildkite-plugin/.python-version)
3.8.12
I get the following error:
$ ./pants.2.8.1rc1.pex version
Traceback (most recent call last):
File "/home/gitpod/.pex/unzipped_pexes/2af639b86a62016e1736c9a6647e6a01ba5009f6/.bootstrap/pex/pex.py", line 476, in execute
exit_value = self._wrap_coverage(self._wrap_profiling, self._execute)
File "/home/gitpod/.pex/unzipped_pexes/2af639b86a62016e1736c9a6647e6a01ba5009f6/.bootstrap/pex/pex.py", line 401, in _wrap_coverage
return runner(*args)
File "/home/gitpod/.pex/unzipped_pexes/2af639b86a62016e1736c9a6647e6a01ba5009f6/.bootstrap/pex/pex.py", line 432, in _wrap_profiling
return runner(*args)
File "/home/gitpod/.pex/unzipped_pexes/2af639b86a62016e1736c9a6647e6a01ba5009f6/.bootstrap/pex/pex.py", line 532, in _execute
return self.execute_entry(self._pex_info.entry_point)
File "/home/gitpod/.pex/unzipped_pexes/2af639b86a62016e1736c9a6647e6a01ba5009f6/.bootstrap/pex/pex.py", line 668, in execute_entry
return self.execute_pkg_resources(entry_point)
File "/home/gitpod/.pex/unzipped_pexes/2af639b86a62016e1736c9a6647e6a01ba5009f6/.bootstrap/pex/pex.py", line 700, in execute_pkg_resources
return runner()
File "/home/gitpod/.pex/installed_wheels/3277bf65a33f7b4df0d47854d16a2eaf10bcfc1c/pantsbuild.pants-2.8.1rc1+git35901a6f-cp37-cp37m-linux_x86_64.whl/pants/bin/pants_loader.py", line 115, in main
PantsLoader.main()
File "/home/gitpod/.pex/installed_wheels/3277bf65a33f7b4df0d47854d16a2eaf10bcfc1c/pantsbuild.pants-2.8.1rc1+git35901a6f-cp37-cp37m-linux_x86_64.whl/pants/bin/pants_loader.py", line 111, in main
cls.run_default_entrypoint()
File "/home/gitpod/.pex/installed_wheels/3277bf65a33f7b4df0d47854d16a2eaf10bcfc1c/pantsbuild.pants-2.8.1rc1+git35901a6f-cp37-cp37m-linux_x86_64.whl/pants/bin/pants_loader.py", line 93, in run_default_entrypoint
exit_code = runner.run(start_time)
File "/home/gitpod/.pex/installed_wheels/3277bf65a33f7b4df0d47854d16a2eaf10bcfc1c/pantsbuild.pants-2.8.1rc1+git35901a6f-cp37-cp37m-linux_x86_64.whl/pants/bin/pants_runner.py", line 77, in run
with initialize_stdio(global_bootstrap_options), stdio_destination(
File "/home/gitpod/.pyenv/versions/3.7.0/lib/python3.7/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/home/gitpod/.pex/installed_wheels/3277bf65a33f7b4df0d47854d16a2eaf10bcfc1c/pantsbuild.pants-2.8.1rc1+git35901a6f-cp37-cp37m-linux_x86_64.whl/pants/init/logging.py", line 167, in initialize_stdio
global_bootstrap_options.pants_workdir,
File "/home/gitpod/.pyenv/versions/3.7.0/lib/python3.7/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/home/gitpod/.pex/installed_wheels/3277bf65a33f7b4df0d47854d16a2eaf10bcfc1c/pantsbuild.pants-2.8.1rc1+git35901a6f-cp37-cp37m-linux_x86_64.whl/pants/init/logging.py", line 204, in initialize_stdio_raw
log_path,
Exception: Could not initialize logging: Error opening pantsd logfile: Permission denied (os error 13)
hundreds-father-404
12/01/2021, 4:34 PMpython3.7 pants.2.8.1rc1.pex
for example, i.e. override the shebanghundreds-father-404
12/01/2021, 4:35 PMhundreds-father-404
12/01/2021, 4:35 PMsudo
work?brash-baker-91190
12/01/2021, 4:39 PMsudo
workshundreds-father-404
12/01/2021, 4:48 PMpip install pytest
for example works using a Pyenv interpreter. It sounds like this isn't a Pants problem in particular, rather that Pants is trying to install itself with an interpreter that has insufficient permissions. I think that test would prove thatbrash-baker-91190
12/01/2021, 4:52 PMpip install pytest
works fine, actually 🤔brash-baker-91190
12/01/2021, 4:53 PMsudo
if I can help it... I may need to do some more asking around on the Gitpod side of thingshundreds-father-404
12/01/2021, 4:55 PMpip install -U pip
command is failing
(one thing to be sure of is you're using the correct Pyenv pip, not the system interpreter)brash-baker-91190
12/01/2021, 4:56 PM/home/gitpod/.cache/pants/setup/bootstrap-Linux-x86_64/pants.7zPr2Q/install/bin/pip install -U pip
hundreds-father-404
12/01/2021, 4:57 PM.cache/pants/setup/bootstrap-Linux-x86_64/pants.7zPr2Q/install/bin/pip
Instead, try running that command with the original pip
corresponding to the interpreter used to create the venvbrash-baker-91190
12/01/2021, 5:02 PMbrash-baker-91190
12/01/2021, 10:26 PMPIP_USER=yes
in the environment, which is apparently a way to make every pip
command behave as though --user
was passed. Once I unset that (or, alternatively, set it to no
), Pants works fine.hundreds-father-404
12/01/2021, 10:27 PMbrash-baker-91190
12/01/2021, 10:27 PMpants
using sudo
... the .pants.d
and .pids
directories were owned by root
, and wackiness ensued 😅hundreds-father-404
12/01/2021, 10:28 PMhundreds-father-404
12/01/2021, 10:29 PMpip
command inside the ./pants
bash script with sudo
, then keep the final exec
statement not-sudo. Although your fix is much betterbrash-baker-91190
12/01/2021, 10:33 PMsudo
was also a bit of a red-herring... it didn't work because it had magic root
powers, it worked because PIP_USER
wasn't in its environment. I just tried running sudo -E ./pants version
(after blowing away all Pants cache directories) and it failed with the same message.brash-baker-91190
12/01/2021, 10:35 PMPIP_USER
unset. Looks like you all do something similar with the scrub_PEX_env_vars
function in the pants
shell script.brash-baker-91190
12/01/2021, 10:38 PMunset PIP_USER
at the end of scrub_PEX_env_vars
and it worked. Probably need to kick the tires on some other more complicated projects (not sure if other things need to pip install
into that venv or not).brash-baker-91190
12/01/2021, 10:47 PM--isolated
flag to the two pip
invocations in the pants
script: https://pip.pypa.io/en/stable/cli/pip/#cmdoption-isolatedbrash-baker-91190
12/01/2021, 10:50 PMhundreds-father-404
12/01/2021, 11:04 PM./pants
script we distribute. I can imagine cases where you do want --user
to be used or for env vars like Certs to be still used
Instead, probably better to have your version of the script diverge from the one provided w/ that one line. Wdyt?
And even better is distribute Pants as a binary https://github.com/pantsbuild/pants/issues/7369brash-baker-91190
12/01/2021, 11:15 PMpants
scripts... Gitpod allows you to customize the container it uses for your workspace, so I just tweaked ours to remove that one variable. If we end up adopting Gitpod more broadly, I imagine we'd just have a base image that all our repos would use, and they'd all inherit that configuration. Modifying our pants
script would get weird when we need to update it to pull in changes that you all make to it, so I'd rather steer clear of that if at all possible.
Distributing Pants as a Rust binary looks pretty sweet, though 😄hundreds-father-404
12/01/2021, 11:20 PMbrash-baker-91190
12/01/2021, 11:22 PMhundreds-father-404
12/01/2021, 11:34 PMbrash-baker-91190
12/01/2021, 11:41 PM