square-oxygen-75288
05/04/2021, 11:10 AMNo valid Python interpreter found. For `pants_version = "1.30.0"`, Pants requires Python 3.6, 3.7, or 3.8 to run. Please check that a valid interpreter is installed and on your $PATH.
If I open IDEA's terminal and run python
there, I will see:
% python
Python 3.8.6 (default, May 4 2021, 09:31:45)
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Cause I have pyenv configured for this (scala) project
So I don't get how to get Pants in IDEA up and running cause it seems like it tries to use 3.9.x and fails (and it ignored pyenv)
Any ideas how to fix it? Cheers.happy-kitchen-89482
05/04/2021, 4:23 PMhappy-kitchen-89482
05/04/2021, 4:23 PMhappy-kitchen-89482
05/04/2021, 4:24 PMhappy-kitchen-89482
05/04/2021, 4:24 PMhappy-kitchen-89482
05/04/2021, 4:24 PMecho $PATH
in that terminal?square-oxygen-75288
05/06/2021, 8:37 AM% echo $PATH
/home/serge/bin:/home/serge/.nvm/versions/node/v14.16.1/bin:/home/serge/.pyenv/plugins/pyenv-virtualenv/shims:/home/serge/.pyenv/shims:/home/serge/.pyenv/bin:/home/serge/.cargo/bin:/home/serge/.local/bin:/home/serge/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
square-oxygen-75288
05/06/2021, 9:36 AMhappy-kitchen-89482
05/06/2021, 2:37 PMpython
in IntelliJ will most likely come from /home/serge/.pyenv/shims
, which I suspect means it'll use the pyenv global interpreter (since IntelliJ is probably not running in a shell or a CWD in which you've set some other pyenv interpreter)happy-kitchen-89482
05/06/2021, 2:37 PMpyenv global
show?happy-kitchen-89482
05/06/2021, 2:38 PMhappy-kitchen-89482
05/06/2021, 2:38 PMsquare-oxygen-75288
05/06/2021, 2:40 PM~ % pyenv global
3.8.6
square-oxygen-75288
05/06/2021, 2:40 PMhappy-kitchen-89482
05/06/2021, 5:10 PMhappy-kitchen-89482
05/06/2021, 5:10 PMhappy-kitchen-89482
05/06/2021, 5:10 PMwide-energy-11069
05/06/2021, 6:35 PMNow my IDEA complains about python version when I try to refresh the project:
No valid Python interpreter found. Forthis should be related to how pants find the interpreter. is py36,37,38 on your system path?, Pants requires Python 3.6, 3.7, or 3.8 to run. Please check that a valid interpreter is installed and on your $PATH.pants_version = “1.30.0”
which -a python3
if not, make them available, and retry after restarting intellij.
if still no dice and your pants is a pex, you can use /etc/pexrc to help it find it. E.g.
$ cat /etc/pexrc
PEX_PYTHON_PATH=/opt/ee/python/2.7/bin/python2.7:/<some/path>/3.6/bin/python3.6
square-oxygen-75288
05/07/2021, 1:34 PM~ % which -a python3
/home/serge/.pyenv/shims/python3
/usr/bin/python3
/bin/python3
/home/serge/.pyenv/shims/python3
is 3.8.6
other 2 are 3.9.4square-oxygen-75288
05/07/2021, 1:41 PM% which -a python
/home/serge/.pyenv/shims/python
this one is also 3.8.6wide-energy-11069
05/10/2021, 4:36 AMsquare-oxygen-75288
05/10/2021, 8:31 AM/bin/python3
and /usr/bin/python3
from 3.9.x to 3.8.x can lead to some unforeseen problems with the operating system itself, cause all the packages will assume 3.9.x and not 3.8.xwide-energy-11069
05/10/2021, 2:37 PMsquare-oxygen-75288
05/10/2021, 5:55 PMhappy-kitchen-89482
05/10/2021, 5:58 PMPEX_PYTHON_PATH=/path/to/python3.8
in /etc/pexrc
?happy-kitchen-89482
05/10/2021, 6:00 PM/Users/<username>/.pyenv/versions/3.8.6/bin/python
) to intellij's PATH and restart intellij.happy-kitchen-89482
05/10/2021, 6:00 PMsquare-oxygen-75288
05/10/2021, 6:09 PM/etc/pexrc
happy-kitchen-89482
05/10/2021, 8:08 PMhappy-kitchen-89482
05/10/2021, 8:08 PMsquare-oxygen-75288
05/11/2021, 11:51 AM~ % cat /etc/pexrc
PEX_PYTHON_PATH=/home/serge/.pyenv/versions/3.8.6/bin/python3.8
but it did not helphappy-kitchen-89482
05/11/2021, 9:42 PMhappy-kitchen-89482
05/11/2021, 9:46 PMhappy-kitchen-89482
05/11/2021, 9:46 PMhappy-kitchen-89482
05/11/2021, 9:47 PMwide-energy-11069
05/11/2021, 9:56 PMwide-energy-11069
05/11/2021, 9:56 PMPEX_PYTHON_PATH=/home/serge/.pyenv/versions/3.8.6/bin/python3.8in case this doesn’t work. this might have to be path to real py38 interpreter, not in venv
wide-energy-11069
05/11/2021, 9:58 PMhappy-kitchen-89482
05/11/2021, 10:33 PMhappy-kitchen-89482
05/11/2021, 10:33 PMwide-energy-11069
05/12/2021, 6:04 AM/etc/pexrc
is relevant for pex (assuming the pants run here is in a pex), especially if the right interpreter for pex isn’t available on system PATH.happy-kitchen-89482
05/12/2021, 6:20 AMwide-energy-11069
05/12/2021, 6:37 PMhappy-kitchen-89482
05/12/2021, 7:01 PMwide-energy-11069
05/13/2021, 2:50 AMwide-energy-11069
05/13/2021, 2:50 AMsquare-oxygen-75288
05/13/2021, 9:25 AMwide-energy-11069
05/13/2021, 7:58 PMwide-energy-11069
05/13/2021, 8:01 PMPANTS_INTERPRETOR_PATH
. just throwing this idea out.happy-kitchen-89482
05/13/2021, 8:19 PMhappy-kitchen-89482
05/13/2021, 8:19 PM./pants
wrapper script in the repo?happy-kitchen-89482
05/13/2021, 8:20 PMwide-energy-11069
05/14/2021, 4:39 AM./pants
exactly, and that’s how twitter does it. so ./pants
is essentially a wrapper which eventually calls the pants.pex in our casesquare-oxygen-75288
05/14/2021, 8:29 AM/home/serge/bin:/home/serge/.nvm/versions/node/v14.16.1/bin:/home/serge/.pyenv/plugins/pyenv-virtualenv/shims:/home/serge/.pyenv/shims:/home/serge/.pyenv/bin:/home/serge/.cargo/bin:/home/serge/.local/bin:/home/serge/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
added only PATH=/home/serge/.pyenv/versions/3.8.6/bin
- no effect
added only PEX_PYTHON_PATH=/path/to/python3.8
- no effect...square-oxygen-75288
05/14/2021, 8:34 AMfunction set_supported_python_versions {
local pants_version="$1"
local pants_major_version
local pants_minor_version
pants_major_version="$(echo "${pants_version}" | cut -d '.' -f1)"
pants_minor_version="$(echo "${pants_version}" | cut -d '.' -f2)"
if [[ "${pants_major_version}" -eq 1 ]]; then
supported_python_versions_decimal=('3.6' '3.7' '3.8')
supported_python_versions_int=('36' '37' '38')
supported_message='3.6, 3.7, or 3.8'
elif [[ "${pants_major_version}" -eq 2 && "${pants_minor_version}" -eq 0 ]]; then
supported_python_versions_decimal=('3.6' '3.7' '3.8')
supported_python_versions_int=('36' '37' '38')
supported_message='3.6, 3.7, or 3.8'
elif [[ "${pants_major_version}" -eq 2 && "${pants_minor_version}" -eq 1 ]]; then
supported_python_versions_decimal=('3.7' '3.8' '3.6')
supported_python_versions_int=('37' '38' '36')
supported_message='3.7, 3.8, or 3.6 (deprecated)'
elif [[ "${pants_major_version}" -eq 2 && "${pants_minor_version}" -lt 5 ]]; then
supported_python_versions_decimal=('3.8' '3.7')
supported_python_versions_int=('38' '37')
supported_message='3.7 or 3.8'
else
# We put 3.9 first because Apple Silicon only works properly with Python 3.9, even though it's possible to have
# older Pythons installed. This makes it more likely that Pants will work out-of-the-box.
supported_python_versions_decimal=('3.9' '3.8' '3.7')
supported_python_versions_int=('39' '38' '37')
supported_message='3.7, 3.8, or 3.9'
fi
}
for some reason Python3.9 is missing there?square-oxygen-75288
05/14/2021, 8:47 AMhappy-kitchen-89482
05/14/2021, 7:08 PMhappy-kitchen-89482
05/14/2021, 7:08 PMhappy-kitchen-89482
05/14/2021, 7:09 PMhappy-kitchen-89482
05/14/2021, 7:09 PMsquare-oxygen-75288
05/14/2021, 7:12 PMsquare-oxygen-75288
05/14/2021, 7:14 PMSuccessfully installed pip-21.1.1
ERROR: Could not find a version that satisfies the requirement pantsbuild.pants==1.30.0 (from versions: 0.0.17, 0.0.18, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.0.24, 0.0.25, 0.0.26, 0.0.27, 0.0.28, 0.0.29, 0.0.30, 0.0.31, 0.0.32, 0.0.33, 0.0.34, 0.0.35, 0.0.36, 0.0.37, 0.0.38, 0.0.39, 0.0.40, 0.0.41, 0.0.42, 0.0.43, 0.0.44, 0.0.45, 0.0.46, 0.0.47, 0.0.48, 0.0.49, 0.0.50, 0.0.51, 0.0.52, 0.0.53, 0.0.54, 0.0.55, 0.0.56, 0.0.57, 0.0.58, 0.0.59, 0.0.60, 0.0.61, 0.0.62, 0.0.63, 0.0.64, 0.0.65, 0.0.66, 0.0.67, 0.0.68, 0.0.69, 0.0.70, 0.0.71, 0.0.72, 0.0.73, 0.0.74, 0.0.75, 0.0.76, 0.0.77, 0.0.79, 0.0.80, 0.0.81, 0.0.82, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.15.0, 1.16.0, 1.17.0, 1.18.0, 1.19.0, 1.20.0, 1.21.0, 1.22.0, 1.23.0, 1.24.0, 1.25.0, 1.26.0, 1.27.0, 1.28.0, 2.5.0.dev2, 2.5.0.dev3, 2.5.0rc0, 2.5.0rc1, 2.5.0rc2)
ERROR: No matching distribution found for pantsbuild.pants==1.30.0
./pants: line 282: /home/serge/.cache/pants/setup/bootstrap-Linux-x86_64/1.30.0_py39/bin/python: No such file or directory
so probably it is not the best idea...happy-kitchen-89482
05/14/2021, 7:26 PMsquare-oxygen-75288
05/14/2021, 7:28 PMsquare-oxygen-75288
05/14/2021, 7:29 PMsquare-oxygen-75288
05/14/2021, 7:29 PMhappy-kitchen-89482
05/14/2021, 9:57 PMhappy-kitchen-89482
05/14/2021, 9:57 PMpants
script, since that is what IDEA runs when it executes pantshappy-kitchen-89482
05/14/2021, 9:57 PMsquare-oxygen-75288
05/15/2021, 4:56 PMsquare-oxygen-75288
05/15/2021, 5:07 PMif [[ "${pants_major_version}" -eq 1 ]]; then
supported_python_versions_decimal=('3.6' '3.7' '3.8', '3.9')
supported_python_versions_int=('36' '37' '38', '39')
supported_message='3.6, 3.7, 3.8 or 3.9'
now it does not work from the console
ERROR: Could not find a version that satisfies the requirement pantsbuild.pants==1.30.0 (from versions: 0.0.17, 0.0.18, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.0.24, 0.0.25, 0.0.26, 0.0.27, 0.0.28, 0.0.29, 0.0.30, 0.0.31, 0.0.32, 0.0.33, 0.0.34, 0.0.35, 0.0.36, 0.0.37, 0.0.38, 0.0.39, 0.0.40, 0.0.41, 0.0.42, 0.0.43, 0.0.44, 0.0.45, 0.0.46, 0.0.47, 0.0.48, 0.0.49, 0.0.50, 0.0.51, 0.0.52, 0.0.53, 0.0.54, 0.0.55, 0.0.56, 0.0.57, 0.0.58, 0.0.59, 0.0.60, 0.0.61, 0.0.62, 0.0.63, 0.0.64, 0.0.65, 0.0.66, 0.0.67, 0.0.68, 0.0.69, 0.0.70, 0.0.71, 0.0.72, 0.0.73, 0.0.74, 0.0.75, 0.0.76, 0.0.77, 0.0.79, 0.0.80, 0.0.81, 0.0.82, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.15.0, 1.16.0, 1.17.0, 1.18.0, 1.19.0, 1.20.0, 1.21.0, 1.22.0, 1.23.0, 1.24.0, 1.25.0, 1.26.0, 1.27.0, 1.28.0, 2.5.0.dev2, 2.5.0.dev3, 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3)
ERROR: No matching distribution found for pantsbuild.pants==1.30.0
./pants: line 282: /home/serge/.cache/pants/setup/bootstrap-Linux-x86_64/1.30.0_py39/bin/python: No such file or directory
IDEA fails as well (the same message in idea.log)square-oxygen-75288
05/15/2021, 5:31 PM~/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-1/203.8084.24/bin
% ./idea.sh
it seems to pick up the correct python version and project can be imported
this issue was actually reported almost a year ago by a colleague of mine: https://github.com/pantsbuild/intellij-pants-plugin/issues/505square-oxygen-75288
05/15/2021, 5:55 PMhappy-kitchen-89482
05/15/2021, 6:49 PMhappy-kitchen-89482
05/15/2021, 6:50 PMsquare-oxygen-75288
05/15/2021, 7:26 PMsquare-oxygen-75288
05/15/2021, 7:27 PMsquare-oxygen-75288
05/15/2021, 7:27 PM