I am trying to use the SciPy package. I have installed it and had no obvious problems. However, when I try the following:

import scipy.integrate as spint

I get the following error

File "C:\Python32\lib\site-packages\scipy\integrate\__init__.py", line 7, in <module>
from .quadrature import *
File "C:\Python32\lib\site-packages\scipy\integrate\quadrature.py", line 5, in <module>
from scipy.special.orthogonal import p_roots
File "C:\Python32\lib\site-packages\scipy\special\__init__.py", line 9, in <module>
from ._cephes import *
ImportError: DLL load failed: The specified module could not be found.

Specifically, I am trying to use the simps function but I am getting nowhere. Can anybody help?

What version of Windows you have? The 32-bit or the 64-bit? It seems that the SciPy is not installed correctly for your system. I will try later on my computer.

Can you post the tiniest possible snippet that also causes the error?

Christoph Gohlke has put together an impressive collection of Windows binary installers of recent versions of scientific packages for Python, including amd64 versions of Numpy and Scipy compiled against Intel's MKL, and SciKits:

I am going to try and re-install and see what happens. HOWEVER, I also note that there may be something wrong with installing the non-64 bit because I am told that version 2.6 of Python needs to exist on the system but the current version of Python which can be downloaded is 2.7 (no?)

Hope you can help.

Issac

0

IssacJonesAuthor Commented:

p.s. It is the line

import scipy.integrate as spint

which fails.

I think you are right, there is something wrong in the installation. I will be interested to learn if it can be reproduced.

0

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

sorry, actually it is the following line that causes the problem:

Traceback (most recent call last):
File "C:\Users\David\Code\combinations4.py", line 38, in <module>
totalintegral = scipy.integrate.simps( x, y )
NameError: name 'scipy' is not defined

You say that you've installed it with no obvious problems. How did you install it? I notice from the SciPy website that they don't provide a standard Windows installer for Python 3.2. Did you build the source yourself?

When using "import scipy.integrate as spint", you actually make the alias to the scipy.integrate namespace. Or you have to "import scipy" or "import scipy.integrate" for you command, or you have to change your command to:

I have tried the following at the command line and still get an error message:

Python 3.2.1 (default, Jul 10 2011, 20:02:51) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import scipy.integrate
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import scipy.integrate
File "C:\Python32\lib\site-packages\scipy\integrate\__init__.py", line 7, in <module>
from .quadrature import *
File "C:\Python32\lib\site-packages\scipy\integrate\quadrature.py", line 5, in <module>
from scipy.special.orthogonal import p_roots
File "C:\Python32\lib\site-packages\scipy\special\__init__.py", line 9, in <module>
from ._cephes import *
ImportError: DLL load failed: The specified module could not be found.
>>>

I see, I am kidding. The scipy has the form of a package. The integrate is just a subpackage. I have no answer yet. I was able to simulate the same situation after installing the numpy and scipy on my machine.

I've now installed on another machine Python 2.7 and I still get the same problem!!!

This is the error code I get:

Traceback (most recent call last):
File "C:\Documents and Settings\Issac\My Documents\Dropbox\Python\Code\combinations4.py", line 36, in <module>
totalintegral = sp.integrate.simps( x, y )
AttributeError: 'module' object has no attribute 'integrate'

Note that I used

import scipy as sp

at the top of the file.

Am I doing something really obviously wrong???

Issac

0

IssacJonesAuthor Commented:

Hi pepr

To clarify, you have seen exactly the same problem?

Yes, I can confirm that. But I have never used SciPy before, and I actually do not know what I am doing. I also do not know whether it is installed correctly. I did use the Gohlke's NumPy and SciPy 64 bit (http://www.lfd.uci.edu/~gohlke/pythonlibs/).

c:\tmp>python3Python 3.2.1 (default, Jul 10 2011, 20:02:51) [MSC v.1500 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import scipy>>> scipy.integrate.simps()Traceback (most recent call last): File "<stdin>", line 1, in <module>AttributeError: 'module' object has no attribute 'integrate'>>> import scipy.integrateTraceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\Python32\lib\site-packages\scipy\integrate\__init__.py", line 7, in <module> from .quadrature import * File "c:\Python32\lib\site-packages\scipy\integrate\quadrature.py", line 5, in <module> from scipy.special.orthogonal import p_roots File "c:\Python32\lib\site-packages\scipy\special\__init__.py", line 9, in <module> from ._cephes import *ImportError: DLL load failed: Uvedený modul nebyl nalezen.>>>

c:\tmp>pythonPython 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import scipy>>> scipy.integrate.simps()Traceback (most recent call last): File "<stdin>", line 1, in <module>AttributeError: 'module' object has no attribute 'integrate'>>> import scipy.integrateTraceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\Python27\lib\site-packages\scipy\integrate\__init__.py", line 7, in <module> from quadrature import * File "c:\Python27\lib\site-packages\scipy\integrate\quadrature.py", line 5, in <module> from scipy.special.orthogonal import p_roots File "c:\Python27\lib\site-packages\scipy\special\__init__.py", line 9, in <module> from _cephes import *ImportError: DLL load failed: Uvedenr modul nebyl nalezen.>>>

Actually, the problem is probably with the _cephes and the errors can be related. When importing the module, the packages are initialized. The initialization failed.

0

IssacJonesAuthor Commented:

Hi pepr

I have had some success. If I use

from scipy import integrate

Then I can use

integrate.simpsn

can you do the same?

Issac

0

IssacJonesAuthor Commented:

Hi guys

Okay, I have managed to get it working. What I did was uninstall all the 64 bit stuff and installed the 32 bit versions. The python from ww.python.org and numpy and scipy from http://www.lfd.uci.edu/~gohlke/pythonlibs. In doing so, I can use

import scipy.integrate as spi

and then

spi.simpsn( etc.

Thanks for all your help. I'll allocate points shortly.

Issac

0

IssacJonesAuthor Commented:

Thanks guys

0

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Can you post the tiniest possible snippet that also causes the error?