Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ImportError: cannot import name Deque #2732

@kkruzich

Description

@kkruzich

First check

  • [ x] I added a very descriptive title to this issue.
  • [ x] I used the GitHub search to find a similar issue and didn't find it.
  • [ x] I searched the FastAPI documentation, with the integrated search.
  • [ x] I already searched in Google "How to X in FastAPI" and didn't find any information.
  • [ x] I already read and followed all the tutorial in the docs and didn't find an answer.
  • [ x] I already checked if it is not related to FastAPI but to Pydantic.
  • [ x] I already checked if it is not related to FastAPI but to Swagger UI.
  • [ x] I already checked if it is not related to FastAPI but to ReDoc.
  • [ x] After submitting this, I commit to one of:
    • Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there.
    • I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future.
    • Implement a Pull Request for a confirmed bug.

Example

Here's a self-contained, minimal, reproducible, example with my use case:

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
def read_root():
    return {"Hello": "World"}

Description

Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from typing import Optional
>>> from fastapi import FastAPI
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fastapi/__init__.py", line 7, in <module>
    from .applications import FastAPI as FastAPI
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fastapi/applications.py", line 3, in <module>
    from fastapi import routing
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fastapi/routing.py", line 18, in <module>
    from fastapi import params
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fastapi/params.py", line 4, in <module>
    from pydantic.fields import FieldInfo
  File "pydantic/__init__.py", line 2, in init pydantic.__init__
  File "pydantic/dataclasses.py", line 4, in init pydantic.dataclasses
    import types
  File "pydantic/error_wrappers.py", line 4, in init pydantic.error_wrappers
  File "pydantic/json.py", line 12, in init pydantic.json
  File "pydantic/types.py", line 28, in init pydantic.types
    yield
  File "pydantic/validators.py", line 9, in init pydantic.validators
ImportError: cannot import name Deque

Environment

  • OS: macOS 10.15.3

To know the FastAPI version use:

python3 -c "import fastapi; print(fastapi.__version__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fastapi/__init__.py", line 7, in <module>
    from .applications import FastAPI as FastAPI
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fastapi/applications.py", line 3, in <module>
    from fastapi import routing
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fastapi/routing.py", line 18, in <module>
    from fastapi import params
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fastapi/params.py", line 4, in <module>
    from pydantic.fields import FieldInfo
  File "pydantic/__init__.py", line 2, in init pydantic.__init__
  File "pydantic/dataclasses.py", line 4, in init pydantic.dataclasses
    import types
  File "pydantic/error_wrappers.py", line 4, in init pydantic.error_wrappers
  File "pydantic/json.py", line 12, in init pydantic.json
  File "pydantic/types.py", line 28, in init pydantic.types
    yield
  File "pydantic/validators.py", line 9, in init pydantic.validators
ImportError: cannot import name Deque
  • Python version:
Python 3.6.0

Additional context

Metadata

Metadata

Assignees

No one assigned

    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