QGIS-Mac-Packager icon indicating copy to clipboard operation
QGIS-Mac-Packager copied to clipboard

Possibility to install python packages with C extensions

Open joaoponceleao opened this issue 3 years ago • 3 comments

Hi,

Following the inclusion of pip (thanks!), we are now faced with problem of failed installations of python packages that include C extensions. When installing, pip complains about a missing header file "Python.h". On Linux, this normally requires an install of "python-dev". On Mac (and Windows?), this is normally included in the python package from most sources.

It would be great if this could be included in QGIS. There are two workarounds I can think of for the time being, but neither is ideal.

At the moment, the workaround I have is to include my particular Homebrew python in the C_INCLUDE_PATH of the system environment variables. It seems to take care of the issue, and the QGIS pip installs the package without complaints. This works nicely for development but is not ideal for end-users.

Another workaround, which would be easier when distributing plugins that require such packages, is to ask the end user to install the required python dependencies in a separate python installation (from homebrew, conda, or python.org). I should just be able to add that site-packages directory to the top of my QGIS python plugin. The problem in this case, is having to add multiple site-packages dir sources to the top of the file, since there is no way of knowing which python the user installed, and where.

Would be great to hear your thoughts on this.

Many thanks,

Joao

joaoponceleao avatar May 24 '21 09:05 joaoponceleao

which python package you want to install in the first place?

PeterPetrik avatar May 24 '21 10:05 PeterPetrik

This happened with triangle (https://pypi.org/project/triangle/). Not sure what other packages have this requirement (there does not seem to be a list of these online).

joaoponceleao avatar May 24 '21 10:05 joaoponceleao

I have the same issue trying to install the RichDEM package (https://richdem.readthedocs.io/en/latest/)... basically any package that requires building a C extension module (there are many) will meet this problem? Including header files in /Applications/QGIS.app/Contents/MacOS/include/pythonx.y would be great!

tdanckaert avatar Oct 12 '22 08:10 tdanckaert