flaky-artist-57016
08/01/2022, 9:03 PMpants
is using when I call ./pants test ::
for example. When I run the test command with -ldebug
it appears (I could be wrong) that pants
is spawning multiple processes with different versions of Python that I have installed--even if I remove them from my PATH
.
For example:
16:42:45.42 [DEBUG] spawned local process as Some(23549) for Process { argv: ["/Users/username/miniconda3_py3.8/envs/io-env/bin/python"...
...
16:42:45.43 [DEBUG] spawned local process as Some(23550) for Process { argv: ["/Users/username/.pyenv/versions/3.8.13/bin/python"...
...
16:42:45.43 [DEBUG] spawned local process as Some(23551) for Process { argv: ["/Users/username/.pyenv/versions/3.10.4/bin/python"...
...
What is going on there?happy-kitchen-89482
08/01/2022, 9:41 PMpython-bootstrap
options control where Python looks for possible interpreters. The python
options, along with the interpreter_constraints
fields, if any, on your targets, control which of those interpreters is actually selected for a given process.happy-kitchen-89482
08/01/2022, 9:42 PMhappy-kitchen-89482
08/01/2022, 9:42 PM[python-bootstrap]
and [python]
sections?flaky-artist-57016
08/01/2022, 9:43 PMinterpreter_constraints = [">=3.8,<3.9"]
search_path = ["<PATH>", "<PYENV>"]
happy-kitchen-89482
08/01/2022, 9:50 PMminiconda
mentioned in any constraints fields of any targets?happy-kitchen-89482
08/01/2022, 9:51 PM">=3.8,<3.9"
is shorthand for "CPython>=3.8,<3.9"
, so i'm surprised miniconda is being selectedhappy-kitchen-89482
08/01/2022, 9:51 PMflaky-artist-57016
08/01/2022, 9:57 PM$PYTHON
to the Python executable in my miniconda env when looking into this. Before explicitly setting $PYTHON
I was expecting that pants would pick up the miniconda Python install because it is PATH
. I’ve since used pyenv to install the same version and pants is picking that up instead.flaky-artist-57016
08/01/2022, 10:04 PM./pants -ldebug test ::
after using pyenv to install the same version of Python as in my conda environment and pants is exclusively using that. I’m not seeing different versions being used in different processes.
Seems like pants
just can’t detect Python installed in a conda env unless the path is explicitly set in $PYTHON
?happy-kitchen-89482
08/01/2022, 10:49 PMhappy-kitchen-89482
08/01/2022, 10:49 PMflaky-artist-57016
08/01/2022, 11:04 PMhappy-kitchen-89482
08/02/2022, 12:36 AMflaky-artist-57016
08/02/2022, 12:37 AMflaky-artist-57016
08/02/2022, 12:37 AMpyenv install 3.8.13
happy-kitchen-89482
08/02/2022, 12:38 AMhappy-kitchen-89482
08/02/2022, 12:39 AMflaky-artist-57016
08/02/2022, 12:54 AMhappy-kitchen-89482
08/02/2022, 1:28 AMimport sys; print(sys.implementation)
happy-kitchen-89482
08/02/2022, 1:28 AMhappy-kitchen-89482
08/02/2022, 1:29 AM>=3.8,<3.9
is shorthand for CPython>=3.8,<3.9
so that's really what your interpreter constraints are asking forflaky-artist-57016
08/02/2022, 1:29 AMnamespace(_multiarch='darwin', cache_tag='cpython-38', hexversion=50859504, name='cpython', version=sys.version_info(major=3, minor=8, micro=13, releaselevel='final', serial=0))
happy-kitchen-89482
08/02/2022, 1:29 AMhappy-kitchen-89482
08/02/2022, 1:29 AMhappy-kitchen-89482
08/02/2022, 1:29 AMhappy-kitchen-89482
08/02/2022, 1:31 AMhappy-kitchen-89482
08/02/2022, 1:32 AMflaky-artist-57016
08/02/2022, 1:32 AMflaky-artist-57016
08/02/2022, 1:32 AMhappy-kitchen-89482
08/02/2022, 1:33 AMhappy-kitchen-89482
08/02/2022, 1:34 AMhappy-kitchen-89482
08/02/2022, 1:34 AMflaky-artist-57016
08/02/2022, 1:44 AMflaky-artist-57016
08/02/2022, 1:45 AMhappy-kitchen-89482
08/02/2022, 2:16 AMhappy-kitchen-89482
08/02/2022, 2:17 AM