473,394 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Numpy and cPickle

Hi

If I cPickle a numpy array under Linux and un-cPickle it under Solaris
10, my arrays seem to be transposed. Is there any way to get the same
behavior on both platforms without testing which platform the python
script runs on and then transposing the array?

I am using python 2.4.2 and numpy 0.9.6 on both machines.

Thanks in advance

Martin
Apr 13 '06 #1
4 2528
Martin Manns wrote:
Hi

If I cPickle a numpy array under Linux and un-cPickle it under Solaris
10, my arrays seem to be transposed. Is there any way to get the same
behavior on both platforms without testing which platform the python
script runs on and then transposing the array?

I am using python 2.4.2 and numpy 0.9.6 on both machines.


Transposed? That's odd. There was a byteorder issue with pickles going across
differently-endianed platforms that was fixed in the past few days. Could you
come up with a small bit of code that shows the problem and post it and the
incorrect output to the bug tracker?

http://projects.scipy.org/scipy/numpy/newticket

Thank you!

--
Robert Kern
ro*********@gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Apr 13 '06 #2
Robert Kern wrote:
Martin Manns wrote:

If I cPickle a numpy array under Linux and un-cPickle it under Solaris
10, my arrays seem to be transposed.

Transposed? That's odd. There was a byteorder issue with pickles going across
differently-endianed platforms that was fixed in the past few days. Could you
come up with a small bit of code that shows the problem and post it and the
incorrect output to the bug tracker?


Sorry, I my ad-hoc small example does not reproduce the error even
though the files generated on both platforms differ. I will try to set
up the code tomorrow.

Thank you though for the fast response

Martin
Apr 13 '06 #3
Martin Manns wrote:
Robert Kern wrote:
Martin Manns wrote:

If I cPickle a numpy array under Linux and un-cPickle it under Solaris
10, my arrays seem to be transposed.

Transposed? That's odd. There was a byteorder issue with pickles going across
differently-endianed platforms that was fixed in the past few days. Could you
come up with a small bit of code that shows the problem and post it and the
incorrect output to the bug tracker?


Sorry, I my ad-hoc small example does not reproduce the error even
though the files generated on both platforms differ. I will try to set
up the code tomorrow.


Somehow, the bug does not show up any more. I believe it was due to the
numpy version that is fetched by cPickle. Is there any way to control
(or even determine), which library version cPickle grabs for unpickling
a numpy array (numpy, scipy, etc)?

Apr 16 '06 #4
Mr. M wrote:
Somehow, the bug does not show up any more. I believe it was due to the
numpy version that is fetched by cPickle. Is there any way to control
(or even determine), which library version cPickle grabs for unpickling
a numpy array (numpy, scipy, etc)?


You can import the appropriate module first. Then it will be in sys.modules and
be picked up during unpickling. You may have to do some sys.path manipulation if
you have more than one version lieing about on your filesystem.

--
Robert Kern
ro*********@gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Apr 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Richard Kessler | last post by:
I am attempting a GUI using BOA Constructor. I have some simple code to pickle an object, but for some reason when I use cPickle it hangs the system, but pickle works just fine. I do not have a...
2
by: sh | last post by:
Hi guys, Well, I have a (maybe dumb) question. I want to write my own little blog using Python (as a fairly small but doable project for myself to learn more deaply Python in a web context). ...
5
by: Alex Polite | last post by:
I need to put recursive data structures on disc and found out that cPickle doesn't like recursion. What are my options? alex -- Alex Polite http://polite.se
1
by: A.B., Khalid | last post by:
I wonder if someone can explain what is wrong here. I am pickling a list of dictionaries (see code attached) and unpickling it back using the HIGHEST_PROTOCOL of pickle and cPickle. I am getting an...
5
by: Marcus Lowland | last post by:
Hello, I'm fairly new to python and have read about and wanted to begin experimenting with cpickle. As I understand, this should be a native module in the python library. I have python 2.3 and now...
4
by: Mingus Tsai | last post by:
Hello- please help with unpickling problem: I am using Python version 2.3.4 with IDLE version 1.0.3 on a Windows XPhome system. My problem is with using cPickle to deserialize my pickled...
1
by: Carl J. Van Arsdall | last post by:
Hey everyone, cPickle is raising an ImportError that I just don't quite understand. Before I paste the code, let me explain the application. Basically the part of the application that failed is a...
5
by: robert | last post by:
Turning algs for old NumPy modules into numpy code I suffer from this: Upon further processing of returns of numpy calculations, lots of data in an apps object tree will become elementary numpy...
5
by: Victor Kryukov | last post by:
Hello list, The following behavior is completely unexpected. Is it a bug or a by- design feature? Regards, Victor. -----------------
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.