Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

467
Visualizações
Python Django ImportError: cannot import name 'Required' from 'typing_extensions'

Django version is 3.2.9.

Python version is 3.10.0.

And typing_extensions 3.10.0.2

I'm new to coding, python, etc., and can't figure out what is the problem. Following django tutorial I created an app and ran the server successfully, but a day later, when I tried to do that again I faced this problem:

File "C:\Users\fused\Desktop\code\py\myproject\myapp\views.py", line 1, in <module>
from typing_extensions import Required
ImportError: cannot import name 'Required' from 'typing_extensions' (C:\Users\fused\AppData\Local\Programs\Python\Python310\lib\site-packages\typing_extensions.py)

After trying to run a server with 'python manage.py runserver' this problem appeared, tried reinstalling typing_extensions, checked versions of everything, but nothing solved the problem.

If any additional information is needed, I'll reply with it. Thanks in advance

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Update

Support for Required and NotRequired have been added to typing_extensions version 4.0.0 as experimental features.

Everything should work for now like it's stated in PEP 655.

Old Answer

It seems like Required and NotRequired aren't implemented yet in typing_extensions.

PEP 655 states:

The goal is to be able to make the following statement:

The mypy type checker supports Required and NotRequired. A reference implementation of the runtime component is provided in the typing_extensions module.

It's just the goal — it isn't the current state. It is neither listed in typing_extensions' README nor does it appear in the source code.

I think it is really confusing that vscode's pylance/pyright can resolve typing_extensions.Required and typing_extensions.NotRequired, even though it isn't implemented in the module.

As a workaround you could try to replace from typing_extensions import Required with

try:
    from typing_extensions import Required
except ImportError:
    from typing import Generic, TypeVar

    T = TypeVar("T")

    class Required(Generic[T]):
        pass
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda