I’m on Windows 11 and originally had two Python installations: 3.14 and 3.9.
Both were installed and added to the PATH.
After setting up PyCharm 2025.2.4, I started getting this error when creating a virtual environment for Python 3.9:
Cannot set up a python SDK
at Python 3.14 (Python) (C:/Users/.../PycharmProjects/Python/.venv/Scripts/python.exe).
The SDK seems invalid.
When trying to create a venv manually:
python -m venv .venv
Error: Command '['...\Scripts\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 101.
What I have already tried:
Removed Python 3.14 from PATH → deleted .idea, removed .venv → rebooted
No effect. PyCharm still tries to use Python 3.14, even though it is no longer installed.Completely uninstalled Python 3.14 → cleaned .idea, removed .venv → rebooted
No effect. PyCharm still shows:
< Python 3.14 (Python)> C:\Users\...\PycharmProjects\Python\.venv\Scripts\python.exe
But this directory does NOT exist.
- Uninstalled Python 3.9 as well → cleaned .idea → removed all venvs → rebooted → Installed Python 3.9 again on a clean system
Still the same result — PyCharm keeps insisting on linking the project to Python 3.14, which no longer exists.
Additional details:
I deleted PyCharm caches:
C:\Users\<USER>\AppData\Local\JetBrains\PyCharm2025.2.4\
C:\Users\<USER>\AppData\Roaming\JetBrains\PyCharm2025.2.4\I recreated the entire project in a new folder — PyCharm STILL automatically selects Python 3.14.
In the project structure I see:
External Libraries → Python 3.14 (Python)
C:\Users\...\PycharmProjects\Python\.venv\Scripts\python.exe
But this folder and interpreter do not exist at all.
Question:
Where could PyCharm be storing or retrieving the path to this phantom Python 3.14 interpreter, considering that:
Python 3.14 was removed from PATH
Python 3.14 was fully uninstalled
the project’s
.ideafolder was deletedJetBrains caches were deleted
all virtual environments were removed
Python 3.9 was installed fresh on a clean system
And how can I completely remove any reference to this non-existent Python 3.14 interpreter so PyCharm stops trying to use it?
Update
I completely removed PyCharm, Python 3.14, Python 3.9, and all related files from the system. After that, I installed only Python 3.9.9, added it to PATH, and rebooted Windows.
To eliminate the possibility that the issue comes from PyCharm or project settings, I cloned my repository manually via terminal into a different folder, without any IDE involved.
Then I attempted to create a virtual environment directly from the Windows terminal:
python -m venv .venv
But I still get the exact same error:
Error: Command '['C:\\path\\to\\.venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']'
returned non-zero exit status 101.
So the problem appears not to be related to:
- PyCharm
- .idea files
- old project settings
- Git
It seems to be something deeper in the system or related to how Python runs ensurepip on my machine.
Update:
The issue was caused by the space in my Windows username path. I was able to work around it by calling the Python interpreter using the short path (C:\Users*ALEXKA~1*...) instead of the full path with spaces. After that, creating virtual environments worked correctly.