Skip to content

Pipenv broken on Python 3.15.0 (alpha 2) because of typing.no_type_check_decorator removal #6444

@Mr0grog

Description

@Mr0grog

Pipenv crashes with the exception AttributeError: module 'typing' has no attribute 'no_type_check_decorator' in Python 3.15.0a2 because typing.no_type_check_decorator was removed (python/cpython#133602).

The problem is in pipenv/patched/pip/_vendor/typing_extensions.py:

no_type_check_decorator = typing.no_type_check_decorator

The comment above this section makes it sound like the line causing the error could just be removed since it's not referenced anywhere else in the codebase and its main purpose is to blow up like this:

# Aliases for items that have always been in typing.
# Explicitly assign these (rather than using `from typing import *` at the top),
# so that we get a CI error if one of these is deleted from typing.py
# in a future version of Python

…but I’m not too familiar with the internals or interdependencies here and it’s possible there are other things this affects that I don’t know about. Otherwise I’d just submit a PR. 😄

Steps to reproduce

Using Pyenv:

# Install and activate a 3.15.0a2 environment:
pyenv install 3.15.0a2
pyenv local 3.15.0a2
python -m venv .venv
source .venv/bin/activate

# Install pipenv:
pip install pipenv

# Actual bug:
pipenv --help

The final line outputs:

$ pipenv --version
Traceback (most recent call last):
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/bin/pipenv", line 3, in <module>
    from pipenv import cli
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/__init__.py", line 32, in <module>
    from pipenv.cli import cli  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/cli/__init__.py", line 1, in <module>
    from .command import cli  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/cli/command.py", line 5, in <module>
    from pipenv import environments
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/environments.py", line 8, in <module>
    from pipenv.utils.fileutils import normalize_drive
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/utils/fileutils.py", line 17, in <module>
    from pipenv.patched.pip._internal.network.download import PipSession
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/patched/pip/_internal/network/download.py", line 13, in <module>
    from pipenv.patched.pip._internal.cli.progress_bars import get_download_progress_renderer
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/patched/pip/_internal/cli/progress_bars.py", line 19, in <module>
    from pipenv.patched.pip._internal.cli.spinners import RateLimiter
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/patched/pip/_internal/cli/spinners.py", line 9, in <module>
    from pipenv.patched.pip._internal.utils.logging import get_indentation
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/patched/pip/_internal/utils/logging.py", line 29, in <module>
    from pipenv.patched.pip._internal.utils.misc import ensure_dir
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/patched/pip/_internal/utils/misc.py", line 44, in <module>
    from pipenv.patched.pip._internal.utils.retry import retry
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/patched/pip/_internal/utils/retry.py", line 5, in <module>
    from pipenv.patched.pip._vendor.typing_extensions import ParamSpec
  File "/Users/testuser/Dev/test/pipenv/no_type_check_decorator/.venv/lib/python3.15/site-packages/pipenv/patched/pip/_vendor/typing_extensions.py", line 4584, in <module>
    no_type_check_decorator = typing.no_type_check_decorator
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/testuser/.pyenv/versions/3.15.0a2/lib/python3.15/typing.py", line 3881, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'typing' has no attribute 'no_type_check_decorator'

Obviously I can’t run pipenv --support, but pip shows I’ve installed version 2025.0.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions