question-mark
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.

AttributeError: 'NoneType' object has no attribute 'version_sort'

See original GitHub issue

Issue description

Running pipenv install --verbose failed.

Expected result

Expected a virtual env to be set up, a pipfile created, and no errors to pop up.

Actual result


Traceback (most recent call last):
  File "c:\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python38\Scripts\pipenv.exe\__main__.py", line 7, in <module>
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\python38\lib\site-packages\pipenv\cli\command.py", line 231, in install
    retcode = do_install(
  File "c:\python38\lib\site-packages\pipenv\core.py", line 1924, in do_install
    ensure_project(
  File "c:\python38\lib\site-packages\pipenv\core.py", line 581, in ensure_project
    ensure_virtualenv(
  File "c:\python38\lib\site-packages\pipenv\core.py", line 495, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "c:\python38\lib\site-packages\pipenv\core.py", line 385, in ensure_python
    path_to_python = find_a_system_python(python)
  File "c:\python38\lib\site-packages\pipenv\core.py", line 347, in find_a_system_python
    return next(iter(finder.find_all_python_versions()), None)
  File "c:\python38\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 328, in find_all_python_versions
    path_list = sorted(versions, key=version_sort, reverse=True)
AttributeError: 'NoneType' object has no attribute 'version_sort'

Steps to replicate

Provide the steps to replicate (which usually at least includes the commands and the Pipfile).

pipenv install --verbose on win10 machine.

$ pipenv --support

Pipenv version: '2020.5.28'

Pipenv location: 'c:\\python38\\lib\\site-packages\\pipenv'

Python location: 'c:\\python38\\python.exe'

Python installations found:

Traceback (most recent call last):
  File "c:\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python38\Scripts\pipenv.exe\__main__.py", line 7, in <module>
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 1236, in invoke
    return Command.invoke(self, ctx)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func    
    return ctx.invoke(f, obj, *args, **kwargs)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Python38\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\python38\lib\site-packages\pipenv\cli\command.py", line 138, in cli
    get_pipenv_diagnostics()
  File "c:\python38\lib\site-packages\pipenv\help.py", line 33, in get_pipenv_diagnostics
    python_paths = finder.find_all_python_versions()
  File "c:\python38\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 328, in find_all_python_versions
    path_list = sorted(versions, key=version_sort, reverse=True)
AttributeError: 'NoneType' object has no attribute 'version_sort'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:29

github_iconTop GitHub Comments

42reactions
madnohcommented, Jul 12, 2020

Windows 10, Python 3.8.3, pipenv 2020.6.2

I managed to solve this by typing in the full path to the python.exe:

pipenv install --python=“C:\Users\my_name\AppData\Local\Programs\Python\Python38\python.exe”

Viola! Virtual environment created.

28reactions
vincentclaescommented, Jun 22, 2020

this issue still persists on win10 with python 3.8.3 and pipenv 2020.6.2

DVCL643@10NB03610:~/workspace/python/mailswitch_security$ pipenv shell
Traceback (most recent call last):
  File "c:\users\dvcl643\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\dvcl643\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\dvcl643\AppData\Local\Programs\Python\Python38\Scripts\pipenv.exe\__main__.py", line 9, in <module>
  File "C:\Users\dvcl643\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\dvcl643\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\dvcl643\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\dvcl643\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\dvcl643\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\dvcl643\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "C:\Users\dvcl643\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\dvcl643\appdata\local\programs\python\python38\lib\site-packages\pipenv\cli\command.py", line 428, in shell
    do_shell(
  File "c:\users\dvcl643\appdata\local\programs\python\python38\lib\site-packages\pipenv\core.py", line 2363, in do_shell
    ensure_project(
  File "c:\users\dvcl643\appdata\local\programs\python\python38\lib\site-packages\pipenv\core.py", line 576, in ensure_project
    ensure_virtualenv(
  File "c:\users\dvcl643\appdata\local\programs\python\python38\lib\site-packages\pipenv\core.py", line 498, in ensure_virtualenv
    python = ensure_python(three=three, python=python)
  File "c:\users\dvcl643\appdata\local\programs\python\python38\lib\site-packages\pipenv\core.py", line 388, in ensure_python
    path_to_python = find_a_system_python(python)
  File "c:\users\dvcl643\appdata\local\programs\python\python38\lib\site-packages\pipenv\core.py", line 350, in find_a_system_python
    return next(iter(finder.find_all_python_versions()), None)
  File "c:\users\dvcl643\appdata\local\programs\python\python38\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 328, in find_all_python_ve
rsions
    path_list = sorted(versions, key=version_sort, reverse=True)
AttributeError: 'NoneType' object has no attribute 'version_sort'

I have solved this by reverting to

pip install pipenv==2018.11.26

Read more comments on GitHub >

github_iconTop Results From Across the Web

Attribute Error 'NoneType' object has no attribute
The problem is here: Prep = print(re.sub(r" ?\([^)]+\)", "", result)). You're assigning the return value of print to Prep and then later ...
Read more >
AttributeError: 'NoneType' object has no attribute 'get_items'
Hello everyone, We have imported one job (Local Resolution Estimation) from an old project and an old instance onto a newly installed, ...
Read more >
pipenv shell attributeerror 'nonetype' object has no ... - 掘金
pipenv shell attributeerror 'nonetype' object has no attribute 'version sort' ; DebugUsery · AttributeError: 'NoneType'对象没有'get'属性的解决方法 ; 二鱼先生.
Read more >
AttributeError: 'NoneType' object has no attribute 'execute_v2'
Description While Exporting my YOLOV7's ONNX model to TensorRT, I am getting the below error- AttributeError: 'NoneType' object has no ...
Read more >
'NoneType' object has no attribute 'getPartitionByPath'
Thread.run(self) AttributeError: 'NoneType' object has no attribute 'getPartitionByPath' Additional info: addons: com_redhat_kdump, com_redhat_docker ...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found