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?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
JamesLeversha
  • 743
  • 5
  • 15

1 Answers1

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.

thayer
  • 141
  • 7
JamesLeversha
  • 743
  • 5
  • 15
  • 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 '20 at 16:01
  • @LucienS. see my edit for the location of the python interpreter since the MacOS packager has been updated. – thayer Mar 18 '22 at 19:28