Don't resolve Python executable path for subprocess calls
When resolving the path of the Python executable for a subprocess call, the sys.prefix can be different from the one that would be used when not resolving it. Python Virtual Environments work by relying on the module search paths being determined by the sys.prefix . Thus in the default case, in which the Python executable of the virtual environment is just a symbolic link to the system's executable, the resolving of the path will cause the wrong environment to be used (aka one in which anasymod might not even be installed).
Thus it would be nice if either Python executables could be special-cased for this, or the call to get_full_path (used also from within the which function inside files.py) can be omitted in respective use-cases.
Thanks for raising this issue! May I ask which function is invoking the Python executable? The main one that comes to mind is when msdsl is used to generate models. In that case, the current workaround is to set the environment variable PYTHON_MSDSL to the full path of the Python executable that you want to use. (We could modify msdsl as you suggest in the future.)
Relevant code: https://github.com/sgherbst/msdsl/blob/acec424b51220a5775fc931683b0161d74c8188e/msdsl/plugin/msdsl.py#L42-L51
I encountered it when running anasymod -i mymodel --models, the code snippet you linked shows the origin of the call, which is indeed part of msdsl. Setting PYTHON_MSDSL works also fine.
Please feel free to close this issue and open one for msdsl instead.
OK, thanks for letting me know. I'll move the issue to msdsl.