1

I use PyCharm CE 2020.3.3 (also tested with 2020.2.5) and just upgraded QGIS to the new version 3.18 (first version with Python 3.9). When I updated my start script for PyCharm and updated the Python interpreter in PyCharm, the program recognises some parts of the API, but not all: PyCharm Screenshot of import statements It seems that it's only finding those classes that are directly defined in the init.py of the qgis.core module.

Is that a QGIS bug or a PyCharm bug or related to how I loaded PyQGIS into PyCharm? This is my start script:

@echo off
call C:\OSGeo4W64\bin\o4w_env.bat
call "%OSGEO4W_ROOT%\apps\grass\grass78\etc\env.bat"
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
path %PATH%;%OSGEO4W_ROOT%\apps\grass\grass78\lib
path %PATH%;%OSGEO4W_ROOT%\apps\Qt5\bin
path %PATH%;%OSGEO4W_ROOT%\apps\Python39\Scripts

set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python
set PYTHONPATH=%PYTHONPATH%;C:\Users\jludwig\PycharmProjects\QGIS-LRS-Rail;%OSGEO4W_ROOT%\apps\Python39\Scripts
set QGIS_PLUGINPATH=%QGIS_PLUGINPATH%;C:\Users\jludwig\PycharmProjects\QGIS-LRS-Rail;%OSGEO4W_ROOT%\apps\qgis\python\plugins
set PYTHONPATH=%PYTHONPATH%;%QGIS_PLUGINPATH%
set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python39

path %PATH%;C:\Program Files\Git\bin

start "PyCharm aware of QGIS 3" /B "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.5\bin\pycharm64.exe" %*

And this is the list of paths known to the Python interpreter: PyCharm Interpreter Paths

0

It turned out to be a packaging issue with the new OSGeo4W repo, Ticket is here: https://trac.osgeo.org/osgeo4w/ticket/669

It has been fixed with qgis-3.18.1-3 and qgis-common-3.18.1-3 packages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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