4

I have a reoccurring issue with importing the integrate module of scipy.

Periodically, I get the Error message "ImportError: cannot import name integrate". Usually, I use the statement import scipy.integrate to import the module.

Only using import scipy successfully imports scipy but without the integrate module.

The funny thing is that this behavior can change each time I start Python. So sometimes it works fine even when the same script is run.

Anybody has any suggestions?

user1984653
  • 530
  • 1
  • 5
  • 10
  • how did you install it? what does `from scipy import test; test()` show? – ev-br Dec 03 '13 at 23:38
  • Hello Zhenya, thanks for your answer. The command produces the following output. `Running unit tests for scipy` `NumPy version 1.8.0` `NumPy is installed in C:\Python27\lib\site-packages\numpy` `SciPy version 0.13.1` `SciPy is installed in scipy` `Python version 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)]` `nose version 1.3.0` After this statement I get the following error message: `WindowsError: [Error 3] The system cannot find the path specified: 'scipy/*.*'` – user1984653 Dec 04 '13 at 14:03

2 Answers2

0

I had the same problem.

My issue was that python-2.7 would not let me import scipy.integrate, but python-3.x would allow the import.

0

I'm not a professional, but I had the issue with importing of scipy.integrate package even after successful installing of scipy package via 'pip install scipy'. The Error was '

No module named 'scipy.special

'. I randomly solved the issue, maybe my solution will be applicable in your case.

Briefly: I use Python3 and for installing packages it is better to use 'pip3' command, not 'pip'.

More details: So initially, I had used 'pip install scipy' and this didn't work. When I tried to use 'pip3 install scipy', there was a message saying that all the requirement are satisfied, but scipy.integrate still was unavailable with the same Error. When I tried to uninstall scipy via 'pip uninstall scipy' there was a message that scipy is not installed (but actually, it still was installed). So I went to 'C:\Users\{username.username}\AppData\Local\Programs\Python\Python310\Lib\site-packages' and deleted the folder named 'scipy'. Thereafter, I reran the command 'pip3 install scipy' and everything was installed successfully and the following commands worked well in my Jupyter Notebook: '

import numpy as np
import scipy
import scipy.integrate as integrate
import scipy.special as special

'

The following functions became available: quad, dblquad, tplquad, odeint, ode via the:

from scipy.integrate import quad, dblquad, tplquad

and

from scipy.integrate import odeint, ode