Pipenv: AttributeError: Das Objekt 'NoneType' hat kein Attribut 'version_sort'.

Erstellt am 30. Mai 2020  ·  16Kommentare  ·  Quelle: pypa/pipenv

Fehlerbeschreibung

Das Ausführen von pipenv install --verbose ist fehlgeschlagen.

Erwartetes Ergebnis

Es wurde erwartet, dass eine virtuelle Umgebung eingerichtet, eine Pip-Datei erstellt und keine Fehler angezeigt werden.

Tatsächliche Ergebnis


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'

Zu replizierende Schritte

Geben Sie die zu replizierenden Schritte an (die normalerweise mindestens die Befehle und die Pip-Datei enthalten).

pipenv install --verbose auf der win10-Maschine.

$ pipenv - Unterstützung

Pipenv-Version: '2020.5.28'

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

Python-Speicherort: 'c:\\python38\\python.exe'

Python-Installationen gefunden:

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'
Type Vendored Dependencies

Hilfreichster Kommentar

Dieses Problem besteht weiterhin unter Win10 mit Python 3.8.3 und Pipenv 2020.6.2

DVCL643<strong i="6">@10NB03610</strong>:~/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'

Ich habe dies gelöst, indem ich zu zurückgekehrt bin

pip install pipenv==2018.11.26

Alle 16 Kommentare

Ich erhalte den gleichen Fehler. Ich freue mich darauf, dass jemand, der klüger ist, eine Lösung findet

Ich habe eine Problemumgehung gefunden, bin aber mit Computern / Python / virtuellen Umgebungen nicht gut genug, um zu wissen, warum dies funktioniert.
Vom Terminal:

  1. Laden Sie virtualenv herunter (falls Ihre pip-Installation von pipenv dies noch nicht getan hat)
  2. Erstellen Sie eine virtuelle Umgebung in virtualenv -> suchen Sie online nach Anweisungen
  3. Sobald Sie sich in der virtuellen Umgebung befinden, gehen Sie zu dem Ordner, in dem Sie Ihre Pip-Datei haben möchten
  4. pipenv install [python_package]
  5. Sollte die Pipfile erstellen und Dateien sperren. Beenden Sie dann die virtuelle Umgebung
  6. Navigieren Sie mit pipenv-Dateien zu dem Ordner für Ihr Projekt
  7. Typ Pipenv Shell. Dies sollte eine virtuelle Umgebung innerhalb des pipenv-Konstrukts erstellen.

Ich habe den gleichen Fehler, irgendetwas, um ihn zu beheben?
Obwohl die Installation von pipenv in einem erstellten virtaulenv ohne Probleme wie jasoncammarata funktioniert.
Warum ist das so?

Dieses Problem besteht weiterhin unter Win10 mit Python 3.8.3 und Pipenv 2020.6.2

DVCL643<strong i="6">@10NB03610</strong>:~/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'

Ich habe dies gelöst, indem ich zu zurückgekehrt bin

pip install pipenv==2018.11.26

Windows 10, Python 3.8.3, pipenv 2020.6.2

Ich habe es geschafft, dies zu lösen, indem ich den vollständigen Pfad zur python.exe eingegeben habe:

pipenv install --python = "C: \ Benutzer \ mein_name \ AppData \ Local \ Programme \ Python \ Python38python.exe"

Viola! Virtuelle Umgebung erstellt.

Immer noch der gleiche Fehler mit vollständigem Pfad zu python.exe .

Windows 10, Build 20161
Miniconda Python 3.7.4
pipenv 2020.6.2

pipenv install --python="C:\Users\Han\Miniconda3\python.exe"

Pipfile:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
pytest = "*"
v = {editable = true,version = "*"}

[packages]
numpy = "==1.19"
tensorflow = "==2.2"
pillow = "*"
requests = "*"
nltk = "*"
matplotlib = "*"

[requires]
python_version = "3.7"

Ich musste schließlich die Python-Version in der Pipfile angeben, um mit 3.8 arbeiten zu können

[requires]
python_version = "3.8"

Wo befindet sich Pipfile?

Wo befindet sich Pipfile?

@ Vincentclaes danke Probleme wurde gelöst ..

Ich sehe diesen Fehler auch unter OSX 10.14.6 mit pipenv 2020.8.13:

Pipfile:

[requires]
python_version = "3.7.6"

pipenv install --dev --python $(pyenv root)/versions/3.7.6/bin/python

Schließlich,
AttributeError: 'NoneType' object has no attribute 'url'

Haben Sie jemals eine Lösung für diese @mracette gefunden ?

Bearbeiten: Ich hatte genau die gleiche Fehlermeldung von mracette, konnte sie jedoch beheben, indem ich zu pipenv==2018.11.26 . Es erschien in der Version pipenv==2020.4.1b1 die die erste Veröffentlichung nach der Version

@sigtot Ich musste auch auf 2018.11.26 zurückgreifen

@sigtot pip-tools und gewöhnlicher pip-tools venv ? :Lächeln:

Ich verstehe das auch. Gibt es einen bestimmten Grund, warum dies geschieht? Verwendet es die env-Variable PATH / PYTHONPATH?

Ich hatte mehrere Versionen von Python installiert und schokoladig ausprobiert, und dieser Fehler trat nur eines Tages auf. Wahrscheinlich nachdem ich es aktualisiert habe. Ich ging durch, deinstallierte jede aufgelistete Version von Python, installierte 3.8.6 auf Systemebene neu und bekam immer noch diesen Fehler. Deinstallierte die und gebrauchte chocolatey 3.8.6 zu installieren und, noch einmal, immer noch aufgetaucht.

Ich bin mir nicht sicher, ob meine Umgebungsvariablen mit den verschiedenen Versionen durcheinander geraten sind und schokoladig, aber ich dachte, es wäre mit einer Deinstallation / Neuinstallation behoben worden.

Ich habe auch diesen Fehler bekommen !!! Centos Umgebung macht auch keinen Sinn .. habe 2 Computer unter pipenv & pyenv ausprobiert, gleiche Nachricht

Wie andere angegeben haben, wurde die Herabstufung auf pipenv 2018.11.26_4 behoben

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen