Sunday, March 13, 2022

[SOLVED] VSCode cannot see packages on a GCP VM

Issue

I have an issue where vscode when connected to a VM on GCP cannot see packages installed in /opt/conda/lib/python3.7/site-packages. I have created the VM using Vertex AI. When I open the jupyter notebook through the UI in a the browser I can see all the packages via pip3 list. But when I am connected to the VM through SSH in vscode I cannot see the packages installed such as nltk, spacy etc. and when I try to load it gives me ModuleNotFoundError. This error does not show up when I use the jupyter notebook from the Vertex AI UI. The site-packages folder is in my system path and the python that I am using is /opt/conda/bin/python3.

Any help is appreciated. Please do let me know if my question is clear.

EDIT: I figured out that my packages are running on a container in the VM. Is there a way for me to access those packages via jupyter notebook in vscode?


Solution

Posting the answer as community wiki. As confirmed by @Abhishek, he was able to make it work by installing a docker extension on the VM then attach VS code to the container.



Answered By - Ricco D
Answer Checked By - David Marino (WPSolving Volunteer)