

There is a small problem though: Poetry uses venv for installing dependencies: when you add dependencies to a Poetry Python project, a new virtual environment is created where the dependencies are installed. Pipenv was (and is) a good attempt to fix this, but in late 2019 Poetry 1.0 was released and it is very good. from excel import OpenExcel VSCode SetupĪt first, if you open the test.py file, assuming you have Python linter extension installed, VSCode will show an error like this.Python has been the most popular programming language for years, but despite this dependency management has been a weak spot for a long time as well. We will create test.py that will import from the excel package that we just installed. We will install a package in the virtual environment so that we can test if the setup is working as expected. Now, let us activate the virtual environment source venv/bin/activate virtualenvs directory, create a new virtual environment using virtualenv virtualenv venv This is where we will keep all our virtual environments. Install virtualenv using pip: pip install virtualenvĬheck your installation: virtualenv -version Create a Virtual Environmentįirst, let us create a folder.

We will be using virtualenv to create our python virtual environments. If you are only interested in the VSCode setup, skip to the VSCode setup section directly. Just for the sake of completeness, we will start by installing virtualenv and creating a virtual environment. This article shows how to use a Python virtual environment in VSCode, without having to change the pythonPath in VSCode settings. Most of the solutions found on StackOverflow and Github were suggesting to change the pythonPath in VSCode settings. The solution was very simple, but I couldn’t find it on Google. When trying to use a Python virtual environment in VSCode, it was not detecting the virtual environment.
