I have some functions using PDAL in Python that I'd like to integrate inside a QGIS plugin. This plugin must be easy to install on different OS (Windows, Linux).
However, even if PDAL is used by QGIS to display point clouds, I didn't find a way to access and use it with a plugin. I have to create a conda environment with QGIS and PDAL, activate it and launch QGIS from this environment which is uncomfortable and not an easy way for QGIS users.
Is there a simpler solution to using PDAL in a QGIS plugin?
Related questions:
- Development of a plugin which depends on an external Python library
- Using PDAL in custom QGIS plugin
In your metadata.txt for the plugin, in the about section, put the following instructions:
Before using this plugin, open the QGIS menu and pick: 'Plugins | Python Console' Then enter the following:
This usually works for installing modules into the QGIS python.
If the user is not an admin user, pip might not install the package in the correct location. Pip will explain the error, and tell the user where it got installed (typically the user's own directory). This is rather useless, pip can be quite annoying this way. Or maybe QGIS is the annoying one, not looking at the user's install directory. Anyway, we found a workaround, the user can add the path that pip chose to use into the QGIS sys.path by typing something like this in the Python console: