I am working on a Python flask web app in visual studio. I am using a virtual environment. I installed requirements from requirements.txt by right clicking on the environment and clicking install from requirements.txt. The packages got populated. Now when I try installing requirements.txt I get the following error:
----- Installing '-r C:UsersshahdsourcereposTrekkersOrgml-apirequirements.txt' -----
Traceback (most recent call last):
File "C:Program Files (x86)Microsoft Visual StudioSharedPython39_64librunpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:Program Files (x86)Microsoft Visual StudioSharedPython39_64librunpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip__main__.py", line 29, in <module>
from pip._internal.cli.main import main as _main
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip_internalclimain.py", line 9, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip_internalcliautocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip_internalclimain_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip_internalclicmdoptions.py", line 23, in <module>
from pip._internal.cli.parser import ConfigOptionParser
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip_internalcliparser.py", line 12, in <module>
from pip._internal.configuration import Configuration, ConfigurationError
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip_internalconfiguration.py", line 20, in <module>
from pip._internal.exceptions import (
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip_internalexceptions.py", line 13, in <module>
from pip._vendor.requests.models import Request, Response
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip_vendorrequests__init__.py", line 43, in <module>
from pip._vendor import urllib3
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip_vendorurllib3__init__.py", line 11, in <module>
from . import exceptions
File "C:UsersshahdsourcereposTrekkersOrgml-apienvlibsite-packagespip_vendorurllib3exceptions.py", line 3, in <module>
from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
ModuleNotFoundError: No module named 'pip._vendor.urllib3.packages'
----- Failed to install '-r C:UsersshahdsourcereposTrekkersOrgml-apirequirements.txt' -----
'requirements.txt' failed to install.
2
Answers
Just run command
pip install -r requirements.txt
in your virtual environmentHere are a few steps you can try to resolve it:
Recreate the Virtual Environment.
Upgrade pip:try running
pip install --upgrade pip
.Clear pip Cache:try running
pip cache purge
.Try these steps and see if they resolve the issue.