linkedin / linkedin/pygradle

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

Open
#345 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
603
Forks
142
PR merge metrics
No merged PRs in 30d

Description

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()
}
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The reproduction is in examples/example-project/build.gradle and the supplied Dockerfile; start by running it with the listed Python 3.x installations and inspect the plugin's interpreter-selection behavior. Done means pythonVersion = '3' resolves the installed interpreter consistently without a hard-coded OS-specific path.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.