Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError: Not a valid python path: 'C:/Program Files/Python351/python.exe'

See original GitHub issue

Here 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.


λ 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\", 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\", line 105, in get_python_version
    c = subprocess.Popen(version_cmd, **subprocess_kwargs)
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\", 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\", 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\", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Scripts\pipenv.exe\", line 7, in <module>
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\", 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\", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\", 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\", 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\", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\", 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\", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\click\", 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\", line 139, in cli
  File "c:\users\martin\appdata\local\programs\python\python38-32\lib\site-packages\pipenv\", 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\", 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\", 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\", 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\", 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\", 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\", 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\", line 146, in create
    return cls()
  File "<attrs generated init>", line 13, in __init__
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\", 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\", 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\", line 430, in version_tuple
  File "C:\Users\Martin\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\pipenv\vendor\pythonfinder\models\", 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\", 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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:22 (1 by maintainers)

github_iconTop GitHub Comments

snoopprcommented, Sep 18, 2020

Anyone facing a similar error needs to uninstall old python versions C:\Windows\regedit.exe HKLM\SOFTWARE\Python\PythonCore

IdanBananicommented, Jun 16, 2020

My advice to you: look for Python351 in regedit (win+r , regedit) and delete the entries (their content)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found