Matplotlib.font_manager fails to find WINDIR environment variable


I’m trying to set up a Travis CI Windows build for Pyunicorn. Everything runs fine when using macOS or Linux, but there’s a Problem with the WINDIR environment variable on the Windows build.

My .travis.yml boils down to:

os: windows
language: shell
env: PATH=/c/Python311:/c/Python311/Scripts:$PATH

    - choco install python --version 3.11.6
    - python -m pip install --upgrade pip

    # install my package
    - travis_retry pip install -v -e ".[testing,docs]"

    # run tests via tox
    - tox -v

but when running the test suite via tox, matplotlib won’t find the WINDIR environment variable (see build log), although I tried adding an echo $WINDIR right before running tox and it returned C:\Windows as it should.

The same happens when I use a conda environment in the build (see this build log)

Can anyone come up with an idea on what could cause this?

Cheers, Fritz


When using tox, the WINDIR environment variable needs to be passed to the tox environment. This can be done by adding a

passenv = WINDIR

into your tox.ini or whatever config file you are using.