Trying to setup PyCharm Community Edition 64Bit with QGIS OSGeo4W64 installation on Windows so that I can debug some python and reference the QGIS/Qt modules.

I tried the folowing tutorials;
Adding QGIS-specific Python interpreter to PyCharm on Windows?

The last one creates a .bat file that is suppose to automatically open PyCharm but when it runs nothing opens, no errors either.

@echo off
call "C:\OSGEO4W64"\bin\o4w_env.bat
call "C:\OSGEO4W64"\apps\grass\grass78\etc\env.bat

@echo off
path %PATH%;C:\OSGEO4W64\apps\qgis\bin
path %PATH%;C:\OSGEO4W64\apps\grass\grass78\lib
path %PATH%;C:\OSGeo4W64\bin\apps\Qt5\bin
path %PATH%;C:\OSGeo4W64\bin\apps\Python37\Scripts
set PYTHONPATH=%PYTHONPATH%;C:\OSGeo4W64\bin\apps\qgis\python
set PYTHONHOME=C:\OSGeo4W64\bin\apps\Python37

start "PyCharm aware of Quantum GIS" /B "C:\Program Files\JetBrains\PyCharm 
Community Edition 2019.3.1\bin\pycharm64.exe"

Could someone please help me setup the Community Edition of PyCharm with the OSGeo QGIS installation on a Windows OS?

1 Answer 1


With qgis3 you'll need a different environment:

call "C:\OSGEO4W64"\bin\o4w_env.bat
call "C:\OSGEO4W64"\apps\grass\grass78\etc\env.bat

call qt5_env.bat
call py3_env.bat

path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis
rem Set VSI cache to be used as buffer, see #6448
set VSI_CACHE_SIZE=1000000
set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt5\plugins

Didn't test with PyCharm, but the new environment should be the same for every IDE

  • Seems to have done the trick, thank you! Why isn't it as easy as it is for Arc where you just point to the interpreter (i.e. C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe) or is that doing something different?
    – MrKingsley
    Jan 21, 2020 at 12:30
  • 1
    the difference is, that arcgis 10.x uses an registered python where arcpy is already installed as a site-package and has no serious dependencies. Also it is a different story for arcgis pro, which uses an anaconda environment. In fact Python for QGIS3 use the same environment as QGIS itself. It is a non registered Python-Version, but has the oppertunity to write Qt-Applications or QGIS-Plugins. Jan 21, 2020 at 12:42

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.