brave-policeman-49804
04/24/2019, 6:27 AMhundreds-father-404
04/24/2019, 7:21 AMbrave-policeman-49804
04/24/2019, 7:50 AMpython_binary( )
to run all the dependency and code with python 3.7?brave-policeman-49804
04/24/2019, 7:51 AMcompatibility="python==3.7"
, and in pants.ini pants_runtime_python_version: 3.7
. This throws me compatibility error.brave-policeman-49804
04/24/2019, 7:59 AM<https://www.pantsbuild.org/install.html>
hundreds-father-404
04/24/2019, 8:27 AM./pants
script again by running the curl command from our install guide (I’m afk so cant grab specific line). And then remove pants_runtime_python_version
from your pants.ini
. We had people put that value as a temporary measure until we could fully support Python 3, and now it’s deprecated and not necessary.hundreds-father-404
04/24/2019, 8:28 AMbrave-policeman-49804
04/24/2019, 8:35 AMbrave-policeman-49804
04/24/2019, 8:56 AMpython_binary()
and few python_library()
linked with it.hundreds-father-404
04/24/2019, 11:48 AMpants.ini
, what value do you have for pants_version
?brave-policeman-49804
04/24/2019, 12:48 PMinterpreter_constraints: ["Cpython>=3.6"]
and pants_version: 1.16.0.dev1
-> in python_binary( ) compatibility=['CPython==3.7.*'],
Now my code runs with python 3.7.
I want to make sure whether this is the recommended way of doing it?hundreds-father-404
04/24/2019, 12:52 PMpython_binary()
, that particular target requires Python 3.7
Independent of what you are specifying your own code to use is the question of what Pants uses to run the tool itself. If you update to the newest ./pants
script by running curl -L -O <https://pantsbuild.github.io/setup/pants>
, then you should never have to think about this question. The script will determine the supported interpreter versions for you. With Pants 1.14.0 and earlier, we required 2.7. With 1.15.0, we allow 2.7 or 3.6. With 1.16.0.dev2 and newer, we allow 2.7, 3.6, or 3.7. The script will read your pants_version
and choose whichever of these supported versions you have on your system. It should make no impact to you as an end user which gets chosen.brave-policeman-49804
04/24/2019, 1:00 PMpython_binary( )
, I had to mention the python micro version like ['CPython==3.7.*']
, omitting it threw me an error saying that Unable to detect a suitable interpreter for compatibilities:
found the solution only by trail and error approach.hundreds-father-404
04/24/2019, 1:02 PMpants_runtime_python_version
even though that’s not necessary anymore. Sorry this is all confusing! Should get simpler soon.
Hm, what interpreter constraints did you try before that?brave-policeman-49804
04/24/2019, 1:06 PMpants_runtime_python_version
was Cpython>=3.6` and the compatibility=['CPython==3.7'],
but it gave me this error FAILURE: Unable to detect a suitable interpreter for compatibilities: CPython==3.7 && Cpython>=3.6 (Conflicting targets: cmd/keyphrase-server:server, pkg:common-libs)
So I assumed that every python_library that I added as a dependency in python_binary needs to be explicitly mentioned as python 3.7. It again threw me off with similar error.hundreds-father-404
04/24/2019, 1:09 PM==3.7
means it must be exactly 3.7
, not 3.7.1
or 3.7.2
etc. I see why that’s confusing - it’s tripped me up a few times too.
To confirm, the issue is not that you have some libraries that are >=3.6
. Those are fine and will work with 3.7.*
. The Issue is entirely the difference from ==3.7
and ==3.7.*
Also note the reason you can say >=3.6
instead of >=3.6.*
is that 3.6.1
ends up resolving as > 3.6
, for examplebrave-policeman-49804
04/24/2019, 1:12 PMhundreds-father-404
04/24/2019, 1:14 PMbrave-policeman-49804
04/24/2019, 1:19 PMbrave-policeman-49804
04/24/2019, 1:27 PMFAILURE: Unable to detect a suitable interpreter for compatibilities: CPython==3.7 && Cpython>=3.6 (Conflicting targets: cmd/keyphrase-server:server, pkg:common-libs)
hundreds-father-404
04/24/2019, 1:32 PMpython-setup.interpreter_constraints
in your pants.ini
or this target’s compatibility
. Refer to https://www.pantsbuild.org/python_readme.html#configure-the-python-version”brave-policeman-49804
04/24/2019, 1:53 PMhundreds-father-404
04/24/2019, 1:56 PMbrave-policeman-49804
04/24/2019, 1:59 PM“These were the interpreter versions detected on your system: CPython 2.7.12, CPython 3.6.8, PyPy 17.1”
I can understand this only when I know where the problem is and why it happened. Appending both of the solution would be helpful too.hundreds-father-404
04/24/2019, 2:00 PMhundreds-father-404
04/26/2019, 4:28 AMbrave-policeman-49804
04/26/2019, 4:37 AM