So I have two similar but different issues than my previous question, one I may have mentioned already. When attempting to install the Contour plugin I am told I need matplotlib, which I have on my system (v. 1.1.1).

Also, the Profile Tool is telling me I need Qwt5...I have no idea what this is.

I posted earlier about needing Shapely.wkd for the Profile from Line tool, and received a response that the issue has to do with incompatibility between pyQwt5 and pyQwt.

The Contour plugin does not seem to be related to the Qwt5 issue. Is it possible there is a suite of python modules I am missing on my install?

Install: KingChaos 1.8.0 Lisboa System: MacOSX 10.7.5

I really enjoy QGIS, but I want it to work correctly.

  • Did you install Shapely Python module?. Also, what does import matplotlib return when run in Python console of QGIS? – dakcarto Nov 3 '12 at 19:48
  • SyntaxError: invalid syntax >>> import matplotlib Traceback (most recent call last): File "<input>", line 1, in <module> File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 309, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ImportError: No module named matplotlib – J_L Nov 3 '12 at 20:06
  • actually now that you mention it I never did install shapely because I was unsure about how to go about it. I am quite new to this stuff, more of a user if you will. – J_L Nov 3 '12 at 20:09

Beyond my comments above. A good practice for installing Python modules is to use pip. Though, for your initial use, I would forgo the setup of a virtualenv at this time as that may complicate your use of those modules from within QGIS (though certainly doable).

As you will be installing pip and Python modules into Mac system areas (/usr/local for pip, modules in /Library/Python/2.7/site-packages/), you will need to preface any install commands in Terminal with sudo:

sudo pip install Shapely

For matplotlib, consider using the Kynchaos.com installer for that. I'm running 10.7.4 and QGIS (1.8 and master branch build) has no problem finding matplotlib after using said installer.

  • Hi there, ran the KyngChaos installer for Matplotlib, attemted to reinstall Contour plugin and receive the following error: An error has occured while executing Python code: RuntimeError: module compiled against API version 6 but this version of numpy is 4 Python version: 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] – J_L Nov 3 '12 at 21:15
  • I updated numpy from the kingchaos site, but still have the problem. Any advice? – J_L Nov 3 '12 at 21:17
  • Can we step backwards for a minute, do I need to install or import these python modules (matplotlib etc.) in to QGIS using the python terminal, after I have installed them on my system? Sorry, I really have no idea what I am doing. – J_L Nov 3 '12 at 23:36
  • Once you have installed (via pip or a Mac installer) any Python module, it will generally go into /Library/Python/2.7/site-packages/ which is automatically added to the Python sys.path when QGIS's embedded Python interpreter launched. This means PyQGIS any plugin should have those modules available to it. If you want to use those modules in the Python Console, you will have to import them just like in any other Python console (like in Terminal on Mac). – dakcarto Nov 5 '12 at 7:19
  • 1
    You can compare your QGIS embedded Python interpreter vs. your Python used in Terminal by running the following commands in each and comparing: import sys;sys.version;sys.path to find info about the interpreter, import numpy;numpy.version.version to compare numpy versions. If they are not the same, re-install QGIS and try again, or check that you have not set any Python env variables in your shell, causing your modules to be installed in a non-standard location. – dakcarto Nov 5 '12 at 7:32

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.