4

I am working with scipy trying to test out the Nelder-Mead simplex algorithm. I am exactly following the example code shown here: http://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html

This line causes an error:

from scipy.optimize import minimize

It says it cannot import name minimize. Am I importing something wrong?

Nick ODell
  • 15,465
  • 3
  • 32
  • 66
Tim Sotman
  • 43
  • 1
  • 1
  • 3

4 Answers4

6

You need Scipy version 0.11.0, the first beta was released some time ago.

If you don't have it, you should read the tutorial for the version of scipy you have, for example: http://docs.scipy.org/doc/scipy-0.10.1/reference/tutorial/optimize.html

pv.
  • 33,875
  • 8
  • 55
  • 49
0

On Debian-based systems:

$ apt-get show python-scipy

or

$ apt-get show python3-scipy
0

As pv. pointed out, you need to install a later version of scipy (and numpy to start with).

Follow the steps given here:

http://cwl.cx/posts/building-scipy-on-ubuntu-1204.html

However, instead of getting the latest git repository for numpy and scipy, get a stable version from sourceforge. That way you can work with a stable version.

Hari
  • 1,561
  • 4
  • 17
  • 26
0

If you use 0.18.1 you can write it as follows:

from scipy.optimize import minimize
Manfred Radlwimmer
  • 13,257
  • 13
  • 53
  • 62