ValueError: Not a valid python path: 'C:/Program Files/Python351/python.exe'
See original GitHub issueHere is the output of pipenv --support | clip: The path which is causing the error may have existed on my Windows 10 PC, but thefolder C:/Program Files/Python351 no longer exists on my PC. I do not understand where pipenv finds a reference to this non-existing folder and I do not know how to solve this problem.
I have been successfully using the following command to create a virtual env for several new django projects: pipenv install django>=3.0 but now running this command gives this valueerror.
I will very much appreciate a solution to my problem.
G:\Documenten\python_projects\django_for_beginners_projects\newspaper_pycharmproject
λ pipenv --support | clip
Traceback (most recent call last):
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 618, in parse_executable
    result_version = get_python_version(path)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\utils.py", line 105, in get_python_version
    c = subprocess.Popen(version_cmd, **subprocess_kwargs)
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Het systeem kan het opgegeven bestand niet vinden
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Scripts\pipenv.exe\__main__.py", line 7, in <module>
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\core.py", line 1236, in invoke
    return Command.invoke(self, ctx)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\cli\command.py", line 139, in cli
    get_pipenv_diagnostics()
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\help.py", line 33, in get_pipenv_diagnostics
    python_paths = finder.find_all_python_versions()
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 312, in find_all_python_versions
    python_version_dict = getattr(self.system_path, "python_version_dict", {})
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 120, in system_path
    self._system_path = self.create_system_path()
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 82, in create_system_path
    return pyfinder_path.SystemPath.create(
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 682, in create
    instance = instance._run_setup()
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 233, in _run_setup
    new_instance = new_instance._setup_windows()
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\path.py", line 411, in _setup_windows
    windows_finder = WindowsFinder.create()
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 146, in create
    return cls()
  File "<attrs generated init pythonfinder.models.windows.WindowsFinder>", line 13, in __init__
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\windows.py", line 113, in get_versions
    versions[py_version.version_tuple[:5]] = base_dir
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 365, in __getattribute__
    result = super(PythonVersion, self).__getattribute__(key)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 430, in version_tuple
    self.patch,
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 375, in __getattribute__
    instance_dict = self.parse_executable(executable)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\python.py", line 620, in parse_executable
    raise ValueError("Not a valid python path: %r" % path)
ValueError: Not a valid python path: 'C:/Program Files/Python351/python.exe'
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:22 (1 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
Python: pipenv Error (ValueError: Not a valid python path
I have fixed the problem, by using older version of pipenv: pip install pipenv==2018.10.13. I don't know why this happen but it work...
Read more >Not a valid python path: 'C:/Users/hp/anaconda3/ ...
Error while installing pipenv packages ValueError: Not a valid python path: 'C:/Users/hp/anaconda3/python.exe. I'm getting an error while ...
Read more >Mystery ValueError - Python Help
New install of PyCharm, never installed before, I let it do it's default setup, and to test I ran this: print("I love pizza")....
Read more >ValueError: Not a valid python path: 'C/... : r/learnpython
A little bit of background: I uninstalled my previous Python 3.7.4 and installed a newer Python 3.8.3. I installed pipenv, then tried to...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

Anyone facing a similar error needs to uninstall old python versions C:\Windows\regedit.exe HKLM\SOFTWARE\Python\PythonCore
HKCU\SOFTWARE\Python\PythonCore\
My advice to you: look for Python351 in regedit (win+r , regedit) and delete the entries (their content)