qgis / QGIS-Mac-Packager

Scripts for Official QGIS MacOS Packages
https://www.qgis.org
GNU General Public License v2.0
54 stars 21 forks source link

Possibility to install python packages with C extensions #128

Open joaoponceleao opened 3 years ago

joaoponceleao commented 3 years ago

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

PeterPetrik commented 3 years ago

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

joaoponceleao commented 3 years ago

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).

tdanckaert commented 1 year ago

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!