Skip to content

fastapi0.87.0 - ModuleNotFoundError: No module named 'httpx' while import TestClient from fastapi.testclient #5656

@anoopks12

Description

@anoopks12

First Check

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the FastAPI documentation, with the integrated search.
  • I already searched in Google "How to X in FastAPI" and didn't find any information.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to FastAPI but to Pydantic.
  • I already checked if it is not related to FastAPI but to Swagger UI.
  • I already checked if it is not related to FastAPI but to ReDoc.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

pip insall fastapi

>>> print(fastapi.__version__)
0.87.0

>>> from fastapi.testclient import TestClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\lib\site-packages\fastapi\testclient.py", line 1, in <module>
    from starlette.testclient import TestClient as TestClient  # noqa
  File "C:\ProgramData\Anaconda3\lib\site-packages\starlette\testclient.py", line 15, in <module>
    import httpx
ModuleNotFoundError: No module named 'httpx'

Description

Getting error ModuleNotFoundError: No module named 'httpx' while import TestClient from fastapi.testclient.
It looks like an issue specific to the version 0.87.0 (which is released on 13-Nov-2022)
Its working in version 0.86.0

Operating System

Windows

Operating System Details

No response

FastAPI Version

0.87.0

Python Version

3.8

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions