I had 2 installations of QGIS. One was through OSGeo4W, while the other one was installed independently. I too faced the same qgis import error issue. This is what I did. **Just *TWO* changes:** 1. **PYTHONPATH** = C:\OSGeo4W\apps\qgis\python; C:\OSGeo4W\apps\qgis\python\plugins; C:\OSGeo4W\apps\Python39\Lib\site-packages 2. **Path**(in system variables): C:\OSGeo4W\apps\qgis\python *(Add this path and "move down" any other existing path to QGIS)* Also, make sure that the paths that you require are moved to the top of Path variable list.