Reputation: 21
I install python and set its path too. When I check in CMD pip, It shows me the following...
C:\Users\maher>pip --version
pip 21.1.2""
But after activation of virtual environment when I want to install any packeg using pip, thew see following error.
(data) PS D:\Masters_FIT\4th\Webdatabese\Project\Code\Data_Collection> pip install tablib
Traceback (most recent call last):
File "c:\users\maher\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\maher\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\Masters_FIT\4th\Webdatabese\Project\Code\data\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
(data) PS D:\Masters_FIT\4th\Webdatabese\Project\Code\Data_Collection>
My Project and environment director.
"data" is my environment name "Data_Collection" is the Project name.
any help or suggestion will be welcome and thanks in Advance.
Upvotes: 2
Views: 10693
Reputation: 210
So I was having the same issue.
How I got that issue is
Before editing home in pyvenv.cfg
After editing home in pyvenv.cfg
Here the problem started
python --version
is giving 3.11 but pip --version
is throwing error
This is the fix I tried
So, I have uncommented import site
in pythonxx._pth
(xx is python version downloaded)
before commenting:
after removing the commit:
I also got this error when I python tried to use the cached wheel for installing packages
then I tried to upgrade pip using cmd: c:\users\sam\desktop\py\django\tst\scripts\python.exe -m pip install --upgrade pip
and then pip install pands worked
Note: when the python dir is changed (changing home var in pyvenv.cfg) uninstalling and re-installing packages will fix a few errors.
Upvotes: 0
Reputation: 176
Please run:
python -m ensurepip
and if not resolve the issue run this:
c:\users\maher\appdata\local\programs\python\python37-32\scripts\easy_install.exe pip
Upvotes: 6
Reputation: 69
May be by some reason pip and wheel did not install in your venv.
You may try python -m pip install tablib
to check if pip is working as a module.
Upvotes: 0