0

I have seen the below question, and searched around the internet for a tutorial for instructions on getting Pycharm CE to recognise the QGIS package. I have found which interpreter that QGIS is using, and I can import QGIS in terminal, but Pycharm doesn't recognise it.

Adding QGIS-specific Python interpreter to PyCharm on Windows?

Are there any tutorials or specific instructions to get Pycharm and QGIS working together on MacOS?

1

1 Answer 1

3

EDIT: For newer versions of QGIS (e.g. 3.12+) see "EDIT" below.

I have utilised the above link that @Fran supplied to add in the appropraite paths to my interpreter without cloning the repository. I have added the following paths to my interpreter:

/Applications/QGIS.app/Contents/Resources/python

Needed for processing framework imports

/Applications/QGIS.app/Contents/Resources/python/plugins/

It was a bit weird trying to find where to add the paths in PyCharm

Preferences >> Project Interpreter >> Click the down arrow to choose interpreter >> Show All> Select the appropriate interpreter>> then click on the folder (Show paths for the selected interpreter >> Add the paths >> apply.

EDIT: For newer versions of QGIS (e.g. 3.12+) the path to the interpreter (change to 'QGIS-LTR.app' if you are using the long term release) is as so: /Applications/QGIS.app/Contents/MacOS/bin/python3.8
When adding the new new interpreter, check 'Inherit...' to make sure the QGIS relevant packages are included.

2
  • 2
    /Applications/QGIS.app/Contents/Resources/python doesn't seem to contain a python interpreter in QGIS3.12, am I missing something?
    – Lucien S.
    Aug 13, 2020 at 16:01
  • @LucienS. see my edit for the location of the python interpreter since the MacOS packager has been updated.
    – thayer
    Mar 18, 2022 at 19:28

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.

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