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
    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 Oct 19, 2021 at 9:57
  • 1
    Please add additional information by editing your question rather than in comments.
    – Matt
    Oct 19, 2021 at 12:44


Your Answer

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

Browse other questions tagged or ask your own question.