6

I'm using QGIS 1.8.0 on a Mac with OSX 10.6.8 (Snow Leopard). I've installed QGIS including GDAL, GSL, UNIXImageIO, Freetype, and Matplotlib all from www.kyngchaos.com.

When installing the plugin Contour I get the error that the Python module Shapely.geometry isn't present at my system. So I have to conclude that this module isn't a part of QGIS nor of Matplotlib and also not of the plugin Contour.

Where do I find this module and how do I install this on a Mac? I'm new to a Mac. In Windows this isn't a problem, everything works correct, also the Contour plugin.

4

It is a recurrent question: the module is Shapely and it is a pure Python module and not a QGIS plugin. (Shapely.geometry is part of the Shapely module).

QGIS on Mac OS X use the default Apple install of Python (Mac OS X is a UNIX, like Linux)

Windows does not have Python installed by default, so QGIS must install its own version of Python where Shapely is preinstalled.

And so, you must install yourself this Python module which is not simple if you do not know Python.

see How to install shapely for python 2.6 (Mac) NOT 2.7? or Does anyone have a shapely install for python “dummies” guide?

  • Gene,thanks for the information. I managed to install the module shapely. Everything works fine now. – Robert Mar 17 '13 at 13:32
3

To install Shapely in Linux, you can use the pip command. This assumes that you have installed pip.

sudo pip install Shapely

https://pypi.python.org/pypi/Shapely

0

Directly you would not find pip inside MacOsierra.

Due to that I also suffered through this issue to run Python scripts in QGIS which depends on an external Python library. The most straightforward solution is to install Boundless Desktop that comes with the command line and installs its own python. Using the command line you can run and install (using pip) any external package of python.

0

I had a similar problem in QGIS 2.18, while trying to install the LecoS plugin. I found that python modules installed with pip, for example, even if the folder is saved in a system variable as PYTHONPATH, are not used by QGIS because it uses its own python in other folder. So, after installing the module with:

sudo pip install [module name]

the module subfolder will be located in a folder such as:

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

And should to copied to:

/Applications/QGIS.app/Contents/Resources/python
  • 2
    This is not a good way to do it, unless the version and architecture of python are the same and the module either has no dependencies or you copy all the dependencies as well. You would be better calling the QGIS pip or python executable and telling it to execute pip itself, i.e. (not sure of the exact path) /Applications/QGIS.app/Contents/Resources/python -m pip install [module name] – user2856 Nov 8 '18 at 2:17

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.