Ideally I would like to use Loading an Lmod module using VSCode with Remote-SSH however the soultion to use that directly does not seem to work. On the other hand virtualenvs ought to be supported by the Python VSCode extension.
Thus I figured the following steps should work instead.
- Set-up the virtualenvironment in the remote environment
$ module load Python
$ virtualenv --system-site-packages my_python
- Connect via "Remote - SSH" plugin
- In the terminal source your virtual environment from 1 and get the path to the python binary softlink:
$ source my_python/bin/activate
$ which python
/path/to/my_python/bin/python
- Copy the path to the python binary and paste it into the path to the Python intepreter that VSCode asks for.
And they do, but not always. The first time I tried this it worked and now everytime I try this for the same host it works directly. However, whenever I change to another host with the same parallel file system and redo step 4 it doesn't and instead says
Invalid python interpreter selected
This is the same error message as when you try to directly point to the python that the is loaded with Lmod (and built with EasyBuild if that makes a difference).
Now I'm stuck because the error message is not very helpful, I haven't found a stacktrace or any log-files that include this error. If I could find that or the code that handles the logic for what is a valid interpreter, that would be really helpful.
In summary:
virtualenv --system-site-packages
symlinked Python doesn't work reliably as interpreter when system site Python is not a valid Python interpreter.- How to get this to work reliably?
- Alternatively, what is the logic that determines a valid interpreter?