Reputation: 10131
I'm trying to generate the value of the pdf of a multivariate distribution with scipy. This is the import
statement in my script:
from scipy.stats import multivariate_normal
but it's throwing an ImportError
:
ImportError: cannot import name multivariate_normal
Everything else is working normally.
Upvotes: 4
Views: 8730
Reputation: 532
Quick Fix [not recommended]
I upgraded numpy first, and then scipy. After that, I was able to import multivariate_normal from scipy.stats
pip install numpy --upgrade --user
pip install scipy --upgrade --user
Upvotes: 0
Reputation: 119
If you're using version 0.13.3 you can upgrade at the command line with pip install scipy --upgrade
Upvotes: 5
Reputation: 505
I had this issue on my Ubuntu 14.04 and python 2.7. I resolved it by following the steps given here . The problem arises because the scipy must be atleast 0.14 for stats package to work. Just doing sudo pip install scipy --upgrade
did not work for me. I had to upgrade the numpy and then try to upgrade the scipy, because scipy is dependent on numpy. We also need to update the build dependencies.Below are the steps I followed to fix it
Step 1) First need to make sure all scipy dependencies are installed properly
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
Step 2) Make sure the numpy, which scipy is dependent on is up-to-date
sudo pip install numpy --upgrade
Step 3) Make sure all the build dependencies of scipy is available
sudo apt-get build-dep python-scipy
Step 4) Rerun the upgrade
sudo pip install scipy --upgrade
Upvotes: 0