Skip to content

Poetry is broken on python3.9 due to dulwich dropping python 3.9 support #10615

Description

@joein

Description

I tried to run poetry install on python3.9, however it failed with

  TypeError

  unsupported operand type(s) for |: 'type' and 'NoneType'

Most likely due to dulwich dropping support for 3.9

Workarounds

Downgrade to poetry<2.2.0

Poetry Installation Method

pip

Operating System

mac os x

Poetry Version

2.2.1

Poetry Configuration

poetry config --list

unsupported operand type(s) for |: 'type' and 'NoneType'

Python Sysconfig

No response

Example pyproject.toml

Poetry Runtime Logs

poetry-runtime.log
Stack trace:

15  venv/lib/python3.9/site-packages/cleo/application.py:327 in run
     325│ 
     326│             try:
   → 327│                 exit_code = self._run(io)
     328│             except BrokenPipeError:
     329│                 # If we are piped to another process, it may close early and send a

14  venv/lib/python3.9/site-packages/poetry/console/application.py:255 in _run
     253│ 
     254│         with directory(self._working_directory):
   → 255│             self._load_plugins(io)
     256│ 
     257│             exit_code: int = 1

13  venv/lib/python3.9/site-packages/poetry/console/application.py:630 in _load_plugins
     628│         if not self._disable_plugins:
     629│             from poetry.plugins.application_plugin import ApplicationPlugin
   → 630│             from poetry.plugins.plugin_manager import PluginManager
     631│ 
     632│             PluginManager.add_project_plugin_path(self.project_directory)

12  venv/lib/python3.9/site-packages/poetry/plugins/plugin_manager.py:18 in <module>
      16│ 
      17│ from poetry.__version__ import __version__
   →  18│ from poetry.installation import Installer
      19│ from poetry.packages import Locker
      20│ from poetry.plugins.application_plugin import ApplicationPlugin

11  venv/lib/python3.9/site-packages/poetry/installation/__init__.py:3 in <module>
       1│ from __future__ import annotations
       2│ 
   →   3│ from poetry.installation.installer import Installer
       4│ 
       5│ 

10  venv/lib/python3.9/site-packages/poetry/installation/installer.py:9 in <module>
       7│ from packaging.utils import canonicalize_name
       8│ 
   →   9│ from poetry.installation.executor import Executor
      10│ from poetry.puzzle.transaction import Transaction
      11│ from poetry.repositories import Repository

 9  venv/lib/python3.9/site-packages/poetry/installation/executor.py:26 in <module>
      24│ from poetry.installation.operations import Update
      25│ from poetry.installation.wheel_installer import WheelInstaller
   →  26│ from poetry.puzzle.exceptions import SolverProblemError
      27│ from poetry.utils._compat import decode
      28│ from poetry.utils.authenticator import Authenticator

 8  venv/lib/python3.9/site-packages/poetry/puzzle/__init__.py:3 in <module>
       1│ from __future__ import annotations
       2│ 
   →   3│ from poetry.puzzle.solver import Solver
       4│ 
       5│ 

 7  venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:21 in <module>
      19│ from poetry.puzzle.exceptions import OverrideNeededError
      20│ from poetry.puzzle.exceptions import SolverProblemError
   →  21│ from poetry.puzzle.provider import Indicator
      22│ from poetry.puzzle.provider import Provider
      23│ 

 6  venv/lib/python3.9/site-packages/poetry/puzzle/provider.py:30 in <module>
       28│ from poetry.mixology.term import Term
       29│ from poetry.packages import DependencyPackage
   →   30│ from poetry.packages.direct_origin import DirectOrigin
       31│ from poetry.packages.package_collection import PackageCollection
       32│ from poetry.puzzle.exceptions import OverrideNeededError

 5  venv/lib/python3.9/site-packages/poetry/packages/direct_origin.py:16 in <module>
      14│ from poetry.utils.helpers import download_file
      15│ from poetry.utils.helpers import get_file_hash
   →  16│ from poetry.vcs.git import Git
      17│ 
      18│ 

 4  venv/lib/python3.9/site-packages/poetry/vcs/git/__init__.py:3 in <module>
       1│ from __future__ import annotations
       2│ 
   →   3│ from poetry.vcs.git.backend import Git
       4│ 
       5│ 

 3  venv/lib/python3.9/site-packages/poetry/vcs/git/backend.py:15 in <module>
      13│ from urllib.parse import urlunparse
      14│ 
   →  15│ from dulwich import porcelain
      16│ from dulwich.client import HTTPUnauthorized
      17│ from dulwich.client import get_transport_and_path

 2  venv/lib/python3.9/site-packages/dulwich/porcelain.py:133 in <module>
      131│ from .archive import tar_stream
      132│ from .bisect import BisectState
   →  133│ from .client import (
      134│     FetchPackResult,
      135│     LsRemoteResult,

 1  venv/lib/python3.9/site-packages/dulwich/client.py:2961 in <module>
     2959│ 
     2960│ 
   → 2961│ class SSHGitClient(TraditionalGitClient):
     2962│     """Git client that connects over SSH."""
     2963│ 

TypeError

unsupported operand type(s) for |: 'type' and 'NoneType'

at venv/lib/python3.9/site-packages/dulwich/client.py:3068 in SSHGitClient
    3064│         config: Optional[Config] = None,
    3065│         path_encoding: str = TraditionalGitClient.DEFAULT_ENCODING,
    3066│         vendor: Optional[SSHVendor] = None,
    3067│         key_filename: Optional[str] = None,
  → 3068│         ssh_command: str | None = None,
    3069│     ) -> "SSHGitClient":
    3070│         """Create an SSHGitClient from a parsed URL.
    3071│ 
    3072│         Args:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions