opendatahub-io-contrib / workbench-images

Various custom Workbenches and Runtimes for Open Data Hub and OpenShift Data Science
MIT License
35 stars 23 forks source link

vscode default python interpreter is not the terminal python interpreter #41

Open thoraxe opened 11 months ago

thoraxe commented 11 months ago

The default available/selected interpreter for VSCode itself is /bin/python3.11 The terminal default interpreter is /opt/app-root/bin/python

Because of this, when you install packages with pip install in the terminal (which you have to do), they don't go where vscode is looking for them. This results in pylint using the wrong python which then can't find any of the modules you installed, so all the intellisense things break.

shalberd commented 6 months ago

I have found a solution for it, will probably first present them in the context of "Visual Studio / Code Server airgapped" PR here.

shalberd commented 6 months ago

The key is: creating a settings.json for User settings in a specific User directory under where the PVC is mounted at /opt/app-root/src.

For the non-contrib images in the notebooks subproject, this has already been integrated correctly and solved by @atheo89

https://github.com/opendatahub-io/notebooks/commit/8d23be442e7e1b3de6480e2c8b28d05b70c5cc54

Also passing a certain value / writing it into that settings.json

"python.defaultInterpreterPath": "/opt/app-root/bin/python3"