Skip to content

Chaquopy can't find buildPython in Windows venv or conda environments  #752

@mhsmith

Description

@mhsmith

Chaquopy version

13.0.0

Describe your issue

On Windows, both venv and conda create environments containing only a python executable, not python3, python3.x, or py. So if py is not otherwise on the PATH, Chaquopy will fail to find any Python executable.

In the case of venv environments, a plain py (found in C:\Windows) is somehow able to detect that it's in a virtual environment and use that environment's Python. This doesn't work in a conda environment, although conda users are less likely to have the py launcher installed at all. In any case, Chaquopy never runs py on its own, it always runs py -3 or py -3.x, which apparently ignore the current environment.

The simplest solution is probably to just use python as a final fallback on both Windows and Unix. If it turns out to be Python 2, I believe we still maintain compatible syntax in all the build scripts, and we have integration tests to verify they produce clear error messages.

This does mean it may choose a mismatching py -3 version even if the current environment's python happens to have the correct version. But the only way to fix that would be to make the Gradle plugin do more complex version detection, e.g. by running a test script with python -c. That isn't worth the effort just now, especially since most users seem happy enough just using buildPython to work around any corner cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions