Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python stops working on loadmat

Tags:

python

scipy

I'm having trouble using SciPy's loadmat. while savemat seems to work fine, when I try to load any .mat file, the whole python simply stops working without even throwing an error. I'm using anaconda2 distro (python 2.7) with scipy 0.17.0.

from scipy import io
dict_a = {'a':[3, 9, 17, 15, 19]}
io.savemat('example.mat', dict_a)

mat = io.loadmat('example.mat')

This example crashes the python on the last line. I would be glad for any ideas.

like image 356
Oldrich Avatar asked Feb 06 '16 08:02

Oldrich


2 Answers

I encountered this issue after updating scipy. Downgrading scipy to 0.16.0 solved the issue.

conda install scipy==0.16.0

also see this post github

like image 112
jlarsch Avatar answered Nov 10 '22 09:11

jlarsch


The trouble seems to be caused by faulty version of Anaconda 2.5.0, after downgrading to Anaconda 2.4.1 (or upgrading to Anaconda3) loadmat works properly.

like image 35
Oldrich Avatar answered Nov 10 '22 11:11

Oldrich