[QGIS-Developer] Issues with plugin development environment on new osgeo4w QGIS

Lauri Kajan lauri.kajan at gmail.com
Tue Jun 8 00:33:06 PDT 2021


Hi all!

When developing qgis plugins I have usually created a python virtual
environment for each plugin project in which I have installed all the
necessary linting, formatting and testing tools.

Now I'm facing issues with new/next gen/testing osgeo4w based QGIS installs
that are using python 3.9. I have installed `pre-commit` to my venv but it
cannot run because it needs sqlite3 and it cannot be imported on the
virtual environment. ImportError is raised saying that dlls cannot be
found. I think that must be because Python changed the way DLLs are loaded
on py38. Those are not loaded any more from PATH directories. Dll search
paths are fixed in qgis.__init__.py but of course pre-commit is not aware
that before importing any libraries one should import qgis first.

I have created the virtual environment with command `python-qgis.bat -m
venv --system-site-packages env`. That is using python.exe from
apps/Python39/ and not from bin/. Therefore python doesn't find dlls from
bin/.
Is there some other way to make virtual env aware of dlls in the
osgeo4w/bin/ folder?

Does this way of using a virtual environment during development sound
reasonable anyhow?
What is your way of developing plugins?


Thanks,

-Lauri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210608/bc1f3601/attachment.html>


More information about the QGIS-Developer mailing list