`spin test` fails on Windows

Hello,

I have been trying to install skimage for contributors following the instructions. Unfortunately, I have to do that on a Windows machine.

I get stuck at the spin test step, with Windows being unhappy about a path, even though the build itself looked fine

$ spin test
Invoking `build` prior to running tests:
$ meson compile -C build
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: C:\Users\elena.pascal\Work\repos\scikit-image\Scripts\ninja.EXE -C C:/Users/elena.pascal/Work/repos/scikit-image/scikit-image/build
ninja: Entering directory `C:/Users/elena.pascal/Work/repos/scikit-image/scikit-image/build'
ninja: no work to do.
$ meson install --only-changed -C build --destdir ../build-install
$ export PYTHONPATH="C:\Users\elena.pascal\Work\repos\scikit-image\scikit-image\build-install\usr\Lib\site-packages"
$ export PYTHONPATH="C:\Users\elena.pascal\Work\repos\scikit-image\scikit-image\build-install\usr\Lib\site-packages;C:\Users\elena.pascal\Work\repos\scikit-image\scikit-image\build-install\usr\Lib\site-packages"
$ cd C:\Users\elena.pascal\Work\repos\scikit-image\scikit-image\build-install\usr\Lib\site-packages;C:\Users\elena.pascal\Work\repos\scikit-image\scikit-image\build-install\usr\Lib\site-packages
[WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\elena.pascal\\Work\\repos\\scikit-image\\scikit-image\\build-install\\usr\\Lib\\site-packages;C:\\Users\\elena.pascal\\Work\\repos\\scikit-image\\scikit-image\\build-install\\usr\\Lib\\site-packages'; aborting.

Yes, those paths exist. Anyone seen this before?

Hmm, for some reason you have two directories separated by ; in your PYTHONPATH which is passed to cd. Maybe that’s why it fails?

Not sure though, where these two paths are set. Maybe _setpythonpath() is returning something unexpected?

I think it could be this line https://github.com/scientific-python/spin/blob/8ddc0abea6221bcc6c0ade7ad86f9d1ad1d9b4d8/spin/cmds/meson.py#L32-L33

    if "PYTHONPATH" in env:
        env["PYTHONPATH"] = f"{site_packages}{os.pathsep}{env['PYTHONPATH']}"

what happens if you make sure to unset PYTHONPATH before invoking spin test?

1 Like

Oh amazing, thank you for the Windows whispering! Didn’t cross my mind to try unseting PYTHONPATH. Not sure why venv would not overwrite PYTHONPATH. Nevertheless, the tests at least start running after doing this, so my question is answered.

I can actually reproduce this on Linux. I filled a bug report here `spin test` fails in `meson install` if `PYTHONPATH` is already set · Issue #113 · scientific-python/spin · GitHub.

1 Like