I have used the following command-line successfully (python3.7)

conda install -c conda-forge qgis

and I'm able to import the qgis-python module by import qgis in IPython.

However, when I tried to import qgis-python module in PyCharm (I am quite sure in the same conda environment as the environment mentioned before), I was warned

no module named qgis

Is there anything I need to do before If I want to import qgis package in PyCharm of VSCode? Or It is not allowed to import it outside QGIS?

successfully imported in ipython

successfully installed (conda list command)

failed in PyCharm

  • Actually I need to use python module from conda rather than qgis-python installed with QGIS3.17 because we need to develop something without QGIS Desktop
    – kawataku
    Commented Oct 19, 2021 at 9:57
  • Not sure about conda, but if you installed QGIS with OSGeo4W - check this answer: gis.stackexchange.com/a/337623/35561 Commented Oct 19, 2021 at 9:57

1 Answer 1


PyCharm does not seem to actually activate the environment which means that QGIS' Python paths are not registered.

Check these:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.