enough-advantage-61561
08/11/2023, 8:56 AMpants
2.16.0 on a very simple dummy python project, inside a virtual environment and getting
(venv) niko@niko-ubuntu:~/tmp/pants-tests$ pants roots
11:47:04.85 [INFO] Initialization options changed: reinitializing scheduler...
11:47:09.70 [INFO] Scheduler initialized.
11:47:09.75 [ERROR] 1 Exception encountered:
Engine traceback:
in `roots` goal
in Compute all source roots
IntrinsicError: Failed to read link "/home/niko/tmp/pants-tests/venv/bin/python": Absolute symlink: "/usr/bin/python"
Any idea what would be wrong? In addition, is this the correct place to ask help or is there some other preferred place for this kind of questions?refined-addition-53644
08/11/2023, 9:40 AMpants.toml
please? What OS are you on?enough-advantage-61561
08/11/2023, 9:41 AMpants.toml
is very minimal. Simply
[GLOBAL]
pants_version = "2.16.0"
I also tried:
[GLOBAL]
pants_version = "2.16.0"
[source]
root_patterns = ['/']
and
[GLOBAL]
pants_version = "2.16.0"
backend_packages = [
"pants.backend.python"
]
[source]
root_patterns = ['/']
enough-advantage-61561
08/11/2023, 9:43 AMpants-tests/
├─setup.py
├─pants.toml
└─mypkg/
├─__init__.py
└─something.py
I am running the commands in pants-tests
folder. The venv
is also located in that folder.refined-addition-53644
08/11/2023, 9:44 AMpants version
show anything?enough-advantage-61561
08/11/2023, 9:45 AM(venv) niko@niko-ubuntu:~/tmp/pants-tests$ pants version
2.16.0
refined-addition-53644
08/11/2023, 9:46 AMpants tailor ::
enough-advantage-61561
08/11/2023, 9:47 AMenough-advantage-61561
08/11/2023, 9:48 AMpants tailor ::
with backend_packages = ["pants.backend.python"]
in pants.toml
and it looks similar to the pants roots
output
(venv) niko@niko-ubuntu:~/tmp/pants-tests$ pants tailor ::
12:46:50.97 [INFO] waiting for pantsd to start...
12:46:52.07 [INFO] pantsd started
12:46:52.13 [INFO] Initializing scheduler...
12:46:56.93 [INFO] Scheduler initialized.
12:46:56.99 [ERROR] 1 Exception encountered:
Engine traceback:
in `tailor` goal
IntrinsicError: Failed to read link "/home/niko/tmp/pants-tests/venv/bin/python": Absolute symlink: "/usr/bin/python"
refined-addition-53644
08/11/2023, 9:51 AMenough-advantage-61561
08/11/2023, 9:54 AM...
if __name__ == "__main__":
print("Hello from ", __file__)
enough-advantage-61561
08/11/2023, 9:54 AM(venv) niko@niko-ubuntu:~/tmp/pants-tests$ python mypkg/something.py
Hello from /home/niko/tmp/pants-tests/mypkg/something.py
enough-advantage-61561
08/11/2023, 9:55 AM(venv) niko@niko-ubuntu:~/tmp/pants-tests$ python
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.executable)
/home/niko/tmp/pants-tests/venv/bin/python
enough-advantage-61561
08/11/2023, 9:57 AMpants roots
and pants tailor
working without errors in another project structure earlier, but faced problems trying to configure it correctly, so I decided to start with a small dummy project.refined-addition-53644
08/11/2023, 9:57 AM~/.cache/nce/
and running pants version
again to set-it up after activating this virtual envenough-advantage-61561
08/11/2023, 9:58 AMrefined-addition-53644
08/11/2023, 9:59 AM~/.cache/pants
exist, remove that too.enough-advantage-61561
08/11/2023, 10:00 AMniko@niko-ubuntu:~/tmp/pants-tests$ ls -la
total 36
drwxrwxr-x 7 niko niko 4096 elo 11 11:31 .
drwxrwxr-x 14 niko niko 4096 elo 11 12:40 ..
drwxrwxr-x 2 niko niko 4096 elo 11 11:31 my_cool_pkg.egg-info
drwxrwxr-x 2 niko niko 4096 elo 11 10:09 mypkg
drwxrwxr-x 3 niko niko 4096 elo 11 12:46 .pants.d
-rw-rw-r-- 1 niko niko 110 elo 11 12:46 pants.toml
drwxrwxr-x 3 niko niko 4096 elo 11 12:53 .pids
-rw-rw-r-- 1 niko niko 157 elo 11 10:57 setup.py
drwxrwxr-x 6 niko niko 4096 elo 11 12:53 venv
but in the user home ~/
?refined-addition-53644
08/11/2023, 10:00 AMenough-advantage-61561
08/11/2023, 10:04 AM~/.cache/pants
and ~/.cache/nce
and then did activate the venv again and ran pants version
and tried pants roots
. Here's the output.
niko@niko-ubuntu:~/tmp/pants-tests$ source venv/bin/activate
(venv) niko@niko-ubuntu:~/tmp/pants-tests$ pants version
Bootstrapping Pants 2.16.0 using cpython 3.9.16
Installing pantsbuild.pants==2.16.0 into a virtual environment at /home/niko/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.16.0
New virtual environment successfully created at /home/niko/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.16.0.
2.16.0
(venv) niko@niko-ubuntu:~/tmp/pants-tests$ pants roots
13:02:54.59 [ERROR] 1 Exception encountered:
Engine traceback:
in `roots` goal
in Compute all source roots
IntrinsicError: Failed to read link "/home/niko/tmp/pants-tests/venv/bin/python": Absolute symlink: "/usr/bin/python"
enough-advantage-61561
08/11/2023, 10:07 AMpants roots
command seems to work fine in an another project on the same machine.enough-advantage-61561
08/11/2023, 10:08 AMenough-advantage-61561
08/11/2023, 10:10 AM📁 pants-tests/
├─📄 setup.py
├─📄 pants.toml
└─📁 mypkg/
├─📄 __init__.py
└─📄 something.py
pants.toml
[GLOBAL]
pants_version = "2.16.0"
backend_packages = ["pants.backend.python"]
[source]
root_patterns = ['/']
enough-advantage-61561
08/11/2023, 10:12 AM./src
)
project structure:
📁 pants-tests/
├─📁 src/
│ ├─📄 setup.py
│ └─📁 mypkg/
└─📄 pants.toml
pants.toml
[GLOBAL]
pants_version = "2.16.0"
backend_packages = ["pants.backend.python"]
[source]
root_patterns = ['/src']
enough-advantage-61561
08/11/2023, 10:14 AMpants roots
(venv) niko@niko-ubuntu:~/tmp/pants-tests$ pants roots
src
but with pants tailor
(venv) niko@niko-ubuntu:~/tmp/pants-tests$ pants tailor ::
13:13:19.02 [ERROR] 1 Exception encountered:
Engine traceback:
in `tailor` goal
IntrinsicError: Failed to read link "/home/niko/tmp/pants-tests/venv/bin/python": Absolute symlink: "/usr/bin/python"
enough-advantage-61561
08/11/2023, 10:15 AMrefined-addition-53644
08/11/2023, 10:19 AMenough-advantage-61561
08/11/2023, 10:21 AMpants
refined-addition-53644
08/11/2023, 10:22 AMenough-advantage-61561
08/11/2023, 10:23 AMpants.toml
to have
pants_version = "2.15.0"
and running a command?refined-addition-53644
08/11/2023, 10:24 AMIs that as simple as changingyes As far as debugging go, you can check thisto havepants.toml
pants --print-stacktrace -ldebug <rest of your command>
https://www.pantsbuild.org/docs/troubleshootingenough-advantage-61561
08/11/2023, 10:32 AM(venv) niko@niko-ubuntu:~/tmp/pants-tests$ pants --print-stacktrace -ldebug tailor ::
13:29:09.01 [DEBUG] acquiring lock: <pants.pantsd.lock.OwnerPrintingInterProcessFileLock object at 0x7fc9b435eca0>
13:29:09.01 [DEBUG] terminating pantsd
13:29:09.01 [DEBUG] sending signal 15 to pid 158713
13:29:09.21 [DEBUG] successfully terminated pid 158713
13:29:09.21 [DEBUG] purging metadata directory: /home/niko/tmp/pants-tests/.pids/6bfb3ce52fe9/pantsd
13:29:09.21 [DEBUG] Launching pantsd
13:29:09.21 [DEBUG] purging metadata directory: /home/niko/tmp/pants-tests/.pids/6bfb3ce52fe9/pantsd
13:29:09.22 [DEBUG] pantsd command is: PANTS_DAEMON_ENTRYPOINT=pants.pantsd.pants_daemon:launch_new_pantsd_instance PYTHONPATH=/home/niko/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/bin:/home/niko/code/omat:/home/niko/.cache/nce/2b6e146234a4ef2a8946081fc3fbfffe0765b80b690425a49ebe40b47c33445b/cpython-3.9.16+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python39.zip:/home/niko/.cache/nce/2b6e146234a4ef2a8946081fc3fbfffe0765b80b690425a49ebe40b47c33445b/cpython-3.9.16+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9:/home/niko/.cache/nce/2b6e146234a4ef2a8946081fc3fbfffe0765b80b690425a49ebe40b47c33445b/cpython-3.9.16+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/lib-dynload:/home/niko/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages /home/niko/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/bin/python /home/niko/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/bin/pants --python-repos-find-links=-['file:///home/niko/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/find_links/2.15.0/214abc14/index.html'] --print-stacktrace -ldebug tailor ::
13:29:10.72 [DEBUG] pantsd is running at pid 158773, pailgun port is 32933
13:29:10.72 [DEBUG] releasing lock: <pants.pantsd.lock.OwnerPrintingInterProcessFileLock object at 0x7fc9b435eca0>
13:29:10.72 [DEBUG] Connecting to pantsd on port 32933
13:29:10.72 [DEBUG] Connecting to pantsd on port 32933 attempt 1/3
13:29:10.72 [DEBUG] Connected to pantsd
13:29:10.73 [DEBUG] Launching 1 roots (poll=false).
13:29:10.75 [DEBUG] computed 1 nodes in 0.018775 seconds. there are 9 total nodes.
13:29:10.75 [DEBUG] Launching 1 roots (poll=false).
13:29:10.75 [DEBUG] computed 1 nodes in 0.000763 seconds. there are 13 total nodes.
13:29:10.78 [INFO] Initializing scheduler...
13:29:10.79 [DEBUG] File handle limit is: 10000
13:29:10.82 [DEBUG] Using [cache::CommandRunner { inner: bounded::CommandRunner { inner: SwitchedCommandRunner { .. }, .. }, .. }, cache::CommandRunner { inner: bounded::CommandRunner { inner: SwitchedCommandRunner { .. }, .. }, .. }] for process execution.
13:29:11.23 [DEBUG] Changes to /home/niko/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/bin, outside of the buildroot, will not be invalidated.
13:29:11.23 [DEBUG] Changes to /home/niko/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/bin, outside of the buildroot, will not be invalidated.
13:29:11.23 [DEBUG] Changes to /home/niko/code/omat, outside of the buildroot, will not be invalidated.
13:29:11.23 [DEBUG] Changes to /home/niko/.cache/nce/2b6e146234a4ef2a8946081fc3fbfffe0765b80b690425a49ebe40b47c33445b/cpython-3.9.16+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python39.zip, outside of the buildroot, will not be invalidated.
13:29:11.23 [DEBUG] Changes to /home/niko/.cache/nce/2b6e146234a4ef2a8946081fc3fbfffe0765b80b690425a49ebe40b47c33445b/cpython-3.9.16+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9, outside of the buildroot, will not be invalidated.
13:29:11.23 [DEBUG] Changes to /home/niko/.cache/nce/2b6e146234a4ef2a8946081fc3fbfffe0765b80b690425a49ebe40b47c33445b/cpython-3.9.16+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/lib-dynload, outside of the buildroot, will not be invalidated.
13:29:11.23 [DEBUG] Changes to /home/niko/.cache/nce/c55ee58a557d20bd4b109870e5a01b264c0d501ce817cce29502b2552903834d/bindings/venvs/2.15.0/lib/python3.9/site-packages, outside of the buildroot, will not be invalidated.
13:29:11.23 [DEBUG] setting up service <pants.pantsd.service.scheduler_service.SchedulerService object at 0x7f2c5001ce20>
13:29:11.23 [DEBUG] setting up service <pants.pantsd.service.store_gc_service.StoreGCService object at 0x7f2c500207c0>
13:29:11.23 [DEBUG] starting service <pants.pantsd.service.scheduler_service.SchedulerService object at 0x7f2c5001ce20>
13:29:11.23 [DEBUG] starting service <pants.pantsd.service.store_gc_service.StoreGCService object at 0x7f2c500207c0>
13:29:11.23 [INFO] Scheduler initialized.
13:29:11.23 [DEBUG] Launching 1 roots (poll=false).
13:29:11.23 [DEBUG] computed 1 nodes in 0.000531 seconds. there are 13 total nodes.
13:29:11.23 [DEBUG] Launching 1 roots (poll=false).
13:29:11.23 [DEBUG] computed 1 nodes in 0.000154 seconds. there are 13 total nodes.
13:29:11.26 [DEBUG] specs are: Specs(includes=RawSpecs(description_of_origin='CLI arguments', address_literals=(), file_literals=(), file_globs=(), dir_literals=(), dir_globs=(), recursive_globs=(RecursiveGlobSpec(directory=''),), ancestor_globs=(), unmatched_glob_behavior=<GlobMatchErrorBehavior.error: 'error'>, filter_by_global_options=True, from_change_detection=False), ignores=RawSpecs(description_of_origin='CLI arguments', address_literals=(), file_literals=(), file_globs=(), dir_literals=(), dir_globs=(), recursive_globs=(), ancestor_globs=(), unmatched_glob_behavior=<GlobMatchErrorBehavior.error: 'error'>, filter_by_global_options=False, from_change_detection=False))
13:29:11.26 [DEBUG] changed_options are: ChangedOptions(since=None, diffspec=None, dependees=<DependeesOption.NONE: 'none'>)
13:29:11.26 [DEBUG] Launching 1 roots (poll=false).
13:29:11.28 [DEBUG] computed 1 nodes in 0.015743 seconds. there are 13 total nodes.
13:29:11.28 [DEBUG] Launching 1 roots (poll=false).
13:29:11.28 [WARN] Please either set `enabled = true` in the [anonymous-telemetry] section of pants.toml to enable sending anonymous stats to the Pants project to aid development, or set `enabled = false` to disable it. No telemetry sent for this run. An explicit setting will get rid of this message. See <https://www.pantsbuild.org/v2.15/docs/anonymous-telemetry> for details.
13:29:11.28 [DEBUG] computed 1 nodes in 0.001310 seconds. there are 21 total nodes.
13:29:11.28 [DEBUG] Launching 1 roots (poll=false).
13:29:11.28 [DEBUG] computed 1 nodes in 0.000205 seconds. there are 21 total nodes.
13:29:11.28 [DEBUG] requesting <class 'pants.core.goals.tailor.TailorGoal'> to satisfy execution of `tailor` goal
13:29:11.28 [DEBUG] Launching 1 roots (poll=false).
13:29:11.28 [DEBUG] Completed: Find all sources from input specs
13:29:11.29 [DEBUG] Completed: `tailor` goal
13:29:11.29 [DEBUG] computed 1 nodes in 0.007573 seconds. there are 113 total nodes.
13:29:11.29 [ERROR] 1 Exception encountered:
Engine traceback:
in select
..
in pants.core.goals.tailor.tailor
`tailor` goal
in pants.engine.internals.specs_rules.resolve_specs_paths
Find all sources from input specs
in paths
Finding files: **
Traceback (no traceback):
<pants native internals>
Exception: Failed to read link "/home/niko/tmp/pants-tests/venv/bin/python": Absolute symlink: "/usr/bin/python"
enough-advantage-61561
08/11/2023, 10:35 AMpants
does not like. I could try also a fresh start. If so, what is the correct order of actions?enough-advantage-61561
08/11/2023, 10:36 AMusr/bin
related to python. Could that be the reason?
niko@niko-ubuntu:/usr/bin$ ls -la | grep python
lrwxrwxrwx 1 root root 23 heinä 1 2022 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx 1 root root 24 kesä 11 08:26 pdb3.10 -> ../lib/python3.10/pdb.py
lrwxrwxrwx 1 root root 31 elo 18 2022 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx 1 root root 7 loka 11 2021 python -> python3
lrwxrwxrwx 1 root root 9 heinä 28 2021 python2 -> python2.7
-rwxr-xr-x 1 root root 3592504 heinä 1 2022 python2.7
lrwxrwxrwx 1 root root 10 elo 18 2022 python3 -> python3.10
-rwxr-xr-x 1 root root 5913032 kesä 11 08:26 python3.10
lrwxrwxrwx 1 root root 34 kesä 11 08:26 python3.10-config -> x86_64-linux-gnu-python3.10-config
lrwxrwxrwx 1 root root 17 elo 18 2022 python3-config -> python3.10-config
-rwxr-xr-x 1 root root 960 tammi 25 2023 python3-futurize
-rwxr-xr-x 1 root root 964 tammi 25 2023 python3-pasteurize
lrwxrwxrwx 1 root root 29 heinä 28 2021 pyversions -> ../share/python/pyversions.py
-rwxr-xr-x 1 root root 3123 kesä 11 08:26 x86_64-linux-gnu-python3.10-config
lrwxrwxrwx 1 root root 34 elo 18 2022 x86_64-linux-gnu-python3-config -> x86_64-linux-gnu-python3.10-config
enough-advantage-61561
08/11/2023, 10:37 AMpants
commands work on the other project on the same machine.broad-processor-92400
08/11/2023, 10:40 AMenough-advantage-61561
08/11/2023, 10:41 AMenough-advantage-61561
08/11/2023, 10:42 AMenough-advantage-61561
08/11/2023, 10:42 AMniko@niko-ubuntu:~/tmp/pants-tests$ pants tailor ::
13:42:01.08 [INFO] Initializing scheduler...
13:42:01.51 [INFO] Scheduler initialized.
13:42:01.55 [WARN] Please either set `enabled = true` in the [anonymous-telemetry] section of pants.toml to enable sending anonymous stats to the Pants project to aid development, or set `enabled = false` to disable it. No telemetry sent for this run. An explicit setting will get rid of this message. See <https://www.pantsbuild.org/v2.15/docs/anonymous-telemetry> for details.
Created src/BUILD:
- Add python_sources target src
Created src/mypkg/BUILD:
- Add python_sources target mypkg
broad-processor-92400
08/11/2023, 10:44 AMhappy-kitchen-89482
08/11/2023, 3:21 PMpip install pantsbuild.pants==2.16.0
or something like that?enough-advantage-61561
08/11/2023, 3:24 PMpython -m venv venv
and used it. That was before I came to know that Pants does not work (or should not be used) inside virtual environment.
I installed Pants using
curl --proto '=https' --tlsv1.2 -fsSL <https://static.pantsbuild.org/setup/get-pants.sh> | bash
enough-advantage-61561
08/11/2023, 3:25 PMhappy-kitchen-89482
08/11/2023, 3:25 PMhappy-kitchen-89482
08/11/2023, 3:26 PMget-pants.sh
should be isolated from any pythons on your PATHhappy-kitchen-89482
08/11/2023, 3:26 PMhappy-kitchen-89482
08/11/2023, 3:27 PMenough-advantage-61561
08/11/2023, 3:28 PMbroad-processor-92400
08/12/2023, 6:53 AM