I'm trying to get QGIS API intellisense in VS Code IDE but it doesn't work.

I'm using QGIS 3.4 and Windows 10. I followed the instructions from this link: http://gis-expert.com/wp/2018/10/15/how-to-setup-qgis-3-and-visual-studio-code-plugin-development-windows/

I'm using: VS Code 1.29.1, extensions: Python and PYQT Integration.

This is my bat file:

@echo off
path %PATH%;C:\PROGRA~1\QGIS3~1.4\bin
path %PATH%;C:\PROGRA~1\QGIS3~1.4\apps\qgis\bin
path %PATH%;C:\PROGRA~1\QGIS3~1.4\apps\grass\grass-7.4.2\lib
path %PATH%;C:\PROGRA~1\QGIS3~1.4\apps\Qt5\bin
path %PATH%;C:\PROGRA~1\QGIS3~1.4\apps\qgis\python\qgis\PyQt
path %PATH%;C:\PROGRA~1\QGIS3~1.4\apps\Python37\Scripts
set PYTHONPATH=%PYTHONPATH%;C:\PROGRA~1\QGIS3~1.4\apps\qgis\python
set PYTHONHOME=C:\Users\[username]\AppData\Local\Programs\Python\Python37
path %PATH%;C:\Users\[username]\AppData\Local\Programs\Python\Python37\Scripts

start "VisualCode QGIS" /B "C:\Users\[username]\AppData\Local\Programs\Microsoft VS Code\Code.exe" %*

Python and PyQT intellisense are ok, QGIS not. Can you help me?

  • If you want to do anything with python3, you should call py3_env.bat in your bat file. There is an example bat/template (python3.bat.tmpl) which shows how to do it. It's in osgeo4w\bin and i was able to call many ide's by changing just the last line. Nov 30, 2018 at 13:47

2 Answers 2


this is my .bat for VS Code try with this



@echo off
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"
call "%OSGEO4W_ROOT%\bin\qt5_env.bat"
call "%OSGEO4W_ROOT%\bin\py3_env.bat"

@echo off
path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis

set VSI_CACHE_SIZE=1000000
set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt5\plugins

cd /d %~dp0

SET VSCBIN=D:\Users\fran\AppData\Local\Programs\Microsoft VS Code

call "%VSCBIN%\Code.exe" %*

I hope I help you

  • Thanks! This one is actually working for me (excluding IntelliSense). I've tried the usual "copy the existing batch file and swap whatever path for VS code". Like what Anita Graser had posted for PyCharm, but it doesn't work for me. Python is not able to import qgis package. Perhaps explicitly pointing to OSGeo root does the trick.
    – pg85
    Jan 18, 2021 at 14:11

I'm running QGIS 3.82 and VSCode 1.37.1 on Windows 10, but had no luck with Fran's .bat file.

I've managed to get intellisense working with just the following entries in a .settings file and starting VSCode without a .bat

     "python.pythonPath": "C:\\Program Files\\QGIS 3.8\\apps\\Python37\\python.exe",
     "python.autoComplete.extraPaths": [
         "C:\\Program Files\\QGIS 3.8\\apps\\qgis\\python"]

The above paths are for standalone QGIS installation, and obviously would need to be updated for an OSGEO4W install.

  • Thanks @OrdinaryOrange The following works for VSCode and QGIS 3.4 ltr: { "python.pythonPath": "C:\\Program Files\\QGIS 3.4\\apps\\Python37\\python.exe", "python.autoComplete.extraPaths": ["C:\\Program Files\\QGIS 3.4\\apps\\qgis-ltr\\python"] }
    – ian
    Oct 10, 2019 at 19:00
  • When you say "in a .settings file and starting VS Code without a .bat" where do you put the .settings file? In the workspace? in the VS Code install directory?
    – auslander
    Nov 18, 2021 at 18:13
  • Been a while, but according to my notes the above json should go into the settings.json file of VSCode Nov 18, 2021 at 23:21

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.