`PyCall` throws `PyImport_ImportModule` on continuous integration systems

When I am trying to test my packages which use Python packages installed by PyCall.jl on remote continuous integration (CI) systems, sometimes it fails because the package cannot be imported. After an investigation, I think this situation usually happens on systems with python pre-installed. For example, on some 64-bit Ubuntu systems provided by GitHub CI, they have /usr/bin/python3 installed. And I cannot add Python packages to that executable.

My GitHub Actions config files are generated by PkgTemplate.jl, and they look like this. How should I change them to make it work? Adding ENV["PYTHON"] = "" to somewhere in the config file?

At this line

- uses: julia-actions/julia-buildpkg@v1

try

- uses: julia-actions/julia-buildpkg@v1
  env:
    PYTHON: ""
1 Like

This seems to be working! Thanks! But it does not seem to work for Windows-x86 systems:

Miniforge (the default Python distribution installed by PyCall.jl) does not support 32-bit Windows. Perhaps you could try the setup-python action.

- uses: actions/setup-python@v2
  with:
    python-version: ${{ matrix.python-version }}
    architecture: arch: ${{ matrix.arch }}
- uses: julia-actions/setup-julia@v1
  with:
    version: ${{ matrix.julia-version }}
    arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@v1
  env:
    # PYTHON: ""      # Python executable from the local miniconda distribution
    PYTHON: 'python'  # Python executable from setup-python action

1 Like