I've been trying to move from JupyterLab to Visual Studio Code for Python coding but I have been facing a large difficulty with respect to access to some packages. Probably the issue is that VS Code is very specific with the interpreter path and doesn't look for the existence of a package in a different folder.
I have tried to select running it with all available interpreters. Didn't work. I tried to install it in a specific version. Didn't help either. Trying directly pip install PACKAGENAME
didn't work either.
For instance,import seaborn
from bs4 import BeautifulSoup
. For both of these packages VS Code could not find it. I tried a lot of ways but the only solution for me (very inefficient one) was to copy a bs4 and seaborn into the following folder:'/opt/anaconda3/lib/python3.8/site-packages/'
I am sure more instances might arise with other 'missing' packages for VS Code, and it takes some unnecessary effort. Can someone help me with this? Do you have any idea why this is the case?
Thanks!
CodePudding user response:
VSCode is nothing more then a text editor a terminal shell. Running a Python script from VSCode is exactly as running it from any other terminal.
Whether you're on a Windows or Unix machine, you can solve your "missing packages" problem once and for all by learning how to work on virtual environments
https://realpython.com/python-virtual-environments-a-primer/