JaminMartin / spcs_instruments

An experiment manager and instrument control library written in Python and Rust
0 stars 1 forks source link

Windows + Rye script pathing does not seem to work. #10

Open JaminMartin opened 2 days ago

JaminMartin commented 2 days ago

When invoking the pfx cli utility on Windows, the user receives a module not found error on Windows. This issue was raised by @davidrrwalker attempting local development.

This is because on Mac/Linux when calling pfx, the first path entry is the path to the rye virtual environment the script (which masquerades as a fully-fledged cli tool) is symlinked to. This gives the correct Python path that is "aware" of all the modules within that standalone virtual environment. This path is later used to define the Python interpreter used to call the experiment script, thus is correctly aware of all the supporting modules.

On Windows, the first path is still the default Python interpreter path, despite being invoked in the same way. How this happens may be a bug in rye itself on Windows.

An easy fix is to take this path and replace part of it with the known path to the correct Python interpreter. It is not ideal, but should be robust. If spcs_instruments is installed (which it has to be to be invoked) there must exist its corresponding Python interpreter. I will make this the working case only for Windows.

Patch will be pushed in the coming days.

JaminMartin commented 1 day ago

Added a hotfix in 9f1ecbae19f302f5c6221c3dd43540fec88d6eeb allowing for the correct path to be used to call the correct python and therefore use the correct supporting site-packages.

Currently in testing on spcs-devel-windows branch