Original title was: Can't install pip on Windows Server 2019 Standard using Windows embeddable package for Python 3.12.4 Edited to: File "", ModuleNotFoundError: No module named 'pip' o Windows to help finding it.
I'm using a Windows Server 2019 Standard with admin rights.
I had Python 3.11.0 portable under C:\Portable\python
and I was using pip without problems.
I thought it was time to upgrade my Python environment, so I renamed C:\Portable\python
to C:\Portable\python311
, downloaded https://www.python.org/ftp/python/3.12.4/python-3.12.4-embed-amd64.zip
, and unzipped its content to a new C:\Portable\python
folder.
I tried to use pip but pip where not installed on this portable version.
I ran curl -o C:\Portable\python\get-pip.py https://bootstrap.pypa.io/get-pip.py
to download get-pip.py
I ran: python get-pip.py
and got:
Collecting pip
Using cached pip-24.1.2-py3-none-any.whl.metadata (3.6 kB)
Collecting setuptools
Using cached setuptools-70.3.0-py3-none-any.whl.metadata (5.8 kB)
Collecting wheel
Using cached wheel-0.43.0-py3-none-any.whl.metadata (2.2 kB)
Using cached pip-24.1.2-py3-none-any.whl (1.8 MB)
Using cached setuptools-70.3.0-py3-none-any.whl (931 kB)
Using cached wheel-0.43.0-py3-none-any.whl (65 kB)
Installing collected packages: wheel, setuptools, pip
Successfully installed pip-24.1.2 setuptools-70.3.0 wheel-0.43.0
Then I ran: python.exe -m pip --version
and got:
python.exe: No module named pip
If I go to C:\Portable\python\Scripts
, I see these files:
pip.exe
pip3.12.exe
pip3.exe
wheel.exe
If I run C:\Portable\python\Scripts>pip
I get this error:
C:\Portable\python\Scripts>pip
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Portable\python\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
I tried using https://www.python.org/ftp/python/3.12.4/python-3.12.4-embed-win32.zip instead of https://www.python.org/ftp/python/3.12.4/python-3.12.4-embed-amd64.zip.
I don't want to use and 'installable' version on this machine.
If I delete C:\Portable\python
folder and copy C:\Portable\python311
to it, then go to C:\Portable\python\Scripts
, remove all files, and run python get-pip.py
. pip is installed perfectly and works without problems.
To be honest, I don't remember where I got my Python 3.11.0 version.
So, what else can I do?
Is the current python-3.12.4-embed-amd
portable version not usable under Windows Server 2019 Standard?
Do I need to take any additional steps before using it?
Is there another portable version that comes with pip already working?
P.S.: I checked some very similar questions with the same problems, but they were either not solved or too old.
All I had to do was edit the python312._pth
file and add this line: Lib\site-packages
, so the final content is:
python312.zip
Lib\site-packages
.
# Uncomment to run site.main() automatically
#import site