Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unable to find or execute python" python details set version=3 only works for python3.7 #345

Open
wssrcok opened this issue Jul 21, 2020 · 1 comment

Comments

@wssrcok
Copy link

wssrcok commented Jul 21, 2020

in an Ubuntu18.04 container, I keep getting this error:

* What went wrong:
A problem occurred evaluating root project 'example-project'.
> Unable to find or execute python

I tried install python3.5, 3.6 and 3.8. but only python3.7 works.
I know the work around would be setting systemPythonInterpreter = file("/usr/bin/python3"). But it's not portable: works on ubuntu but doesn't work on my mac (which has different path: /usr/local/bin/python3)

I'd be appreciate if someone can look at the issue and point out why is it the case. I'm not familiar with kotlin so I got very impatient when I look at the code base..

I have reproduced this issue in example-project with this Dockerfile and build.gradle (the original build.gradle had many errors)
Dockerfile:

FROM ubuntu:18.04

RUN apt update && apt install python3-distutils python3 vim git openjdk-8-jdk gradle -y

RUN git clone https://github.com/linkedin/pygradle.git

COPY build.gradle /pygradle/examples/example-project/

CMD ["bash"]

build.gradle

buildscript {
    repositories {
            mavenLocal()
            maven {
              url "https://plugins.gradle.org/m2/"
            }
            mavenCentral()
            jcenter()
    }
    dependencies{
        classpath "gradle.plugin.com.linkedin.pygradle:pygradle-plugin:0.9.11"
    }
}

apply plugin: "com.linkedin.python-sdist"
apply plugin: com.linkedin.gradle.python.plugin.WheelFirstPlugin

python {
        details {
                pythonVersion = '3'
        }
        forceVersion('pypi', 'flake8', '3.2.1')
        forceVersion('pypi', 'six', '1.13.0')
        forceVersion('pypi', 'pbr','1.10.0')
}

dependencies {
    python 'pypi:requests:2.9.1'
    test 'pypi:mock:2.0.0'
}

repositories {
   pyGradlePyPi()
}
@asubbotin-snaplogic
Copy link

You may try to set the location of the interpreter (the example is on Kotlin):

extensions.configure<com.linkedin.gradle.python.PythonExtension>("python") {
    details.setSystemPythonInterpreter("/usr/local/bin/python3")
    details.setPythonVersion("3.9")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants