[Numpy-discussion] persistent ImportError: No module named multiarray when moving cPickle files between machines

Pauli Virtanen pav+sp@iki...
Thu Nov 5 14:29:03 CST 2009


Thu, 05 Nov 2009 12:11:32 -0800, Reckoner wrote:

> Pauli :
> 
> Thanks for your reply. Using 'wb' instead of 'w' for the file mode
> evidently makes this problem go away.
> 
> The mystery is that why does this work with plain lists *and* 'w' and
> not with numpy arrays and 'w'. In other words, why is it that
> numpy.array needs the binary mode while list does not?

Requiring binary is not specific to numpy, but just probably the fact 
that when you have \r\n linefeeds, pickle ends up trying to load a module 
called

	"numpy.core.multiarray\r"

which does not exists. Same thing happens with any other types -- it's 
just that lists are builtin types and don't need any modules loaded to 
unpickle properly.

> Also, for my own edification, how did you know that my "pickle files
> produced on Windows were contaminated by \r\n line  feeds".

I looked in the two files you attached on Numpy trac, and noticed that 
they were different (sha1sum).

-- 
Pauli Virtanen



More information about the NumPy-Discussion mailing list