Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

458
Views
ImportError: cannot import name 'FastAPI' from partially initialized module 'fastapi' : circular import

My initial project setup was working fine but, after installing psutil, I started getting a circular import error for fastApi. I tried uninstalling psutil but, the error persists.

File ".\project.py", line 1, in <module>
        from fastapi import FastAPI
      File "c:\users\nikhi\pycharmprojects\fastapi\venv\lib\site-packages\fastapi\__init__.py", line 7, in <module>
        from .applications import FastAPI as FastAPI
      File "c:\users\nikhi\pycharmprojects\fastapi\venv\lib\site-packages\fastapi\applications.py", line 4, in <module>
        from fastapi import routing
      File "c:\users\nikhi\pycharmprojects\fastapi\venv\lib\site-packages\fastapi\routing.py", line 30, in <module>
        from fastapi.encoders import DictIntStrAny, SetIntStr, jsonable_encoder
      File "c:\users\nikhi\pycharmprojects\fastapi\venv\lib\site-packages\fastapi\encoders.py", line 9, in <module>
        from fastapi import FastAPI
    ImportError: cannot import name 'FastAPI' from partially initialized module 'fastapi' (most likely due to a circular import) 
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

If your project is named fastapi and installed as a module, or you have a file named fastapi.py in your project, those will override the internal dependency loading for the module themselves (depending on the path set up by the Python interpreter).

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!