Virtualenv uses wrong python, even though it is first in $PATH

My problem was that i recently moved my project with virtualenv to another location, due to this activate script had wrong VIRTUAL_ENV path. $ cat path_to_your_env/bin/activate … # some declarations VIRTUAL_ENV=”/path_to_your_env/bin/python” # <– THIS LINE export VIRTUAL_ENV … # some declarations To fix this, just update VIRTUAL_ENV in activate script. Also you maybe need to … Read more

Mypy does not respect setting in mypy.ini to exclude folder from checking when called from VS Code

The issue is that VS Code is invoking mypy file by file. And mypy doesn’t use the exclude option when invoked on a single file. The workaround is using python.linting.ignorePatterns in the settings.json. “python.linting.ignorePatterns”: [ “venv/**/*.py” ] More info about the behaviour of exclude: Note that this flag only affects recursive discovery, that is, when … Read more

Creating a virtualenv with preinstalled packages as in requirements.txt

Typically the steps you always takes are: git clone <repo> cd <repo> pip install virtualenv (if you don’t already have virtualenv installed) virtualenv venv to create your new environment (called ‘venv’ here) source venv/bin/activate to enter the virtual environment pip install -r requirements.txt to install the requirements in the current environment