3

I've been using QGIS with the Semi-Automatic Classification plugin (SCP) at work, and am attempting to install and use it at home. Unfortunately, I am encountering an error which causes QGIS to crash when installing, disabling, or uninstalling SCP.

Upon opening QGIS 2.18.6, I get the following messages:

Semi-Automatic Classification Plugin: Please, restart QGIS for executing the Semi-Automatic Classification Plugin. Possible missing dependecies: SciPy

Semi-Automatic Classification Plugin: Please, restart QGIS for executing the Semi-Automatic Classification Plugin

From investigating the plugin's source, it looks like it is trying the following import before throwing the SciPy dependency exception:

import scipy.stats.distributions as statdistr

I tried the same import from the OSGeo4W Shell, and get the following traceback:

Taceback (most recen call last):
  File "<stdin>", line 1, in <module>
  File "C:\OSGEO4~1\apps\Python27\lib\site-packages\scipy\stats\__init__.py", line 334,
    in <module> from .stats import *
  File "C:\OSGEO4~1\apps\Python27\lib\site-packages\scipy\stats\stats.py", line 181,
    in <module> import scipy.special as special
  File "C:\OSGEO4~1\apps\Python27\lib\site-packages\scipy\special\__init__.py", line 546,
    in <module> from ._ufuncs import *

Additionally, doing a pip list does not display scipy but does display numpy and matplotlib, the other two dependencies for the plugin.

I've attempted to reinstall QGIS and supporting apps / libraries using the advanced and express installers, but run into the same problem each time I try to install SCP. The error also causes QGIS to crash and write a minidump on close. I'm also using Windows 10.


I am able to import scipy from the OSGeo4W Shell, but any module imports do not work, i.e. import scipy.stats or import scipy.linalg

How can I resolve this specific Scipy dependency issue within QGIS?

3
  • Welcome to GIS SE! As a new user be sure to take the Tour where you will see that there should be only one question asked per question under our focussed Q&A format.
    – PolyGeo
    Commented Apr 8, 2017 at 5:35
  • I thought I'd update with my solution for this issue, as it may help others in the future. I was able to resolve the Scipy dependency by forgoing the installation of Scipy through the OSGeo4W advanced installer, and instead installing it directly via Pip and a Scipy .whl.
    – Nick
    Commented Apr 8, 2017 at 18:18
  • I'll re-open your question do that you can provide that as a self-answer to your question.
    – PolyGeo
    Commented Apr 8, 2017 at 19:57

1 Answer 1

6

Was able to resolve the issue by forgoing the installation of Scipy through the OSGeo4W advanced installer, and instead installing it directly via Pip (installed via OSGeo4W) and a Scipy .whl gotten from:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

I grabbed:

numpy‑1.12.1+mkl‑cp27‑cp27m‑win_amd64.whl and scipy‑0.19.0‑cp27‑cp27m‑win_amd64.whl

Then used the OSGeo4W Shell to install directly:

pip install "C:\path\to\numpy‑1.12.1+mkl‑cp27‑cp27m‑win_amd64.whl"
pip install "C:\path\to\scipy‑0.19.0‑cp27‑cp27m‑win_amd64.whl"

I wanted to make sure that the Numpy installation was also correct because it is a dependency for Scipy, so that's the reason for installing both.

2
  • I had exactly the same problem yesterday after using the OSGeo4W installer. A couple of weeks ago the install worked fine with the OSGeo4W libraries, so I wonder if they've changed their packages recently. Either way, thank you for sharing your solution! Commented Apr 10, 2017 at 10:05
  • this worked for me on qgis2.18.13
    – Elio Diaz
    Commented Oct 3, 2017 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.