3

I'm keen to create some contours (isochrones for a pedestrian 'ped-shed' catchment) from a point dataset in QGIS, using the contour plugin from the Plugins repository.

I installed the plugin, but restarting QGIS generated a popup saying that the plugin had been disabled because one or more of shapely, matplotlib and numpy were not installed.

Since other plugins already depend on numpy and matplotlib, it was clear that only shapely could be the problem. pip install shapely finished without a hitch, but re-opening QGIS again spat out the popup.

When I open the Python console in QGIS and type import shapely, it's found - as the screenshot below shows.

A trawl of the internet and of this SX yield mostly questions like this - i.e., people who missed the dependencies (as I did, but have remedied).

Has anybody seen this behaviour before? If so, how was it resolved?

Both Python (2.7) and QGIS (2.8.2 Wien) are 32-bit; running on Windows 7 ultimate.

enter image description here

  • OK, so it turns out that further detective work helped. QGIS Python console found shapely, contour didn't. QGIS is using its own version of Python (2.7.4) in [QGIS directory]\apps while my non-QGIS Python install - tailored to my non-QGIS work needs and !important is 2.7.9 in C:\Python27. Try installing shapely to theQGIS-sub-version-specific version of Python: it's a GIGANTIC PITFA. For the present I've bat-ed a toggle for Windows PATH and PYTHONPATH: switch to QGIS' Python when QGIS starts, else revert to proper Python. All just to run one plugin: plugin works real nice though. – GT. Aug 14 '15 at 0:00
2

Turns out that while QGIS' Python console found shapely, contour didn't.

QGIS is using its own version of Python (2.7.4) in QGIS directory\apps while my non-QGIS Python install - tailored to my non-QGIS work needs and !important - is 2.7.9 in C:\Python27.

Shapely was installed into C:\Python27\Lib\site-packages but contour was blind to anything outside of QGIS directory\apps\Python27\Lib\site-packages.

I had a shot at trying to install shapely to the QGIS-sub-version-specific version of Python while retaining my base Python as the one in the Windows environment variable PATH and PYTHONPATH: eventually I gave up and declared it a GIGANTIC PITFA. The hassle seemed to stem from the fact that the competing Python versions were both 2.7 variants.

For the present I've given up on a Pythonic solution, and instead have bat-ed a toggle for Windows PATH and PYTHONPATH: switch to QGIS' Python when QGIS starts, else revert to proper Python.

All just to run one plugin: plugin works real nice though - mah contours is real purdy.

If I get a chance to get a proper solution to my change-environment-variables-by-bat klunge, I'll update this answer.

Behold my contours... They sho' is purdy...

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.