473,657 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error with: pickle.dumps(nu mpy.float32)

Hello,

I need to pickle the type numpy.float32 but encounter an error when I
try to do so. I am able to pickle the array itself, it is specifically
the type that I cannot pickle.

I am using:
Numpy version: 0.9.4
Python version: 2.4.3
Windows XP

Here is the code that reproduces the error:
_______________ _______________ ________
import numpy
import pickle

pickle.dumps(nu mpy.float32)

Output:
PicklingError: Can't pickle <type 'float32_arrtyp e'>: it's not found as
__builtin__.flo at32_arrtype
_______________ _______________ ________

Any suggestions would be much appreciated.

Thanks,

Iljya Kalai

Aug 15 '06 #1
3 3601
I have reproduced the error with Numpy 1.0b1

The output with v.1.0b1 reads:
PicklingError: Can't pickle <type 'float32scalar' >: it's not found as
__builtin__.flo at32scalar

Has anyone else encountered this?

Thanks,

Iljya

Iljya wrote:
Hello,

I need to pickle the type numpy.float32 but encounter an error when I
try to do so. I am able to pickle the array itself, it is specifically
the type that I cannot pickle.

I am using:
Numpy version: 0.9.4
Python version: 2.4.3
Windows XP

Here is the code that reproduces the error:
_______________ _______________ ________
import numpy
import pickle

pickle.dumps(nu mpy.float32)

Output:
PicklingError: Can't pickle <type 'float32_arrtyp e'>: it's not found as
__builtin__.flo at32_arrtype
_______________ _______________ ________

Any suggestions would be much appreciated.

Thanks,

Iljya Kalai
Aug 16 '06 #2
Iljya wrote:
I have reproduced the error with Numpy 1.0b1

The output with v.1.0b1 reads:
PicklingError: Can't pickle <type 'float32scalar' >: it's not found as
__builtin__.flo at32scalar

Has anyone else encountered this?

Thanks,

Iljya

Iljya wrote:
Hello,

I need to pickle the type numpy.float32 but encounter an error when I
try to do so. I am able to pickle the array itself, it is specifically
the type that I cannot pickle.

I am using:
Numpy version: 0.9.4
Python version: 2.4.3
Windows XP

Here is the code that reproduces the error:
_______________ _______________ ________
import numpy
import pickle

pickle.dumps(nu mpy.float32)

Output:
PicklingError: Can't pickle <type 'float32_arrtyp e'>: it's not found as
__builtin__.flo at32_arrtype
_______________ _______________ ________

Any suggestions would be much appreciated.

Thanks,

Iljya Kalai
This looks like a numpy bug. It seems that float32_arrtype 's name is
incomplete. Its tp_name field should start with a module name, but
since it doesn't, Python assumes that it is a builtin type:
>>import numpy
numpy.float32 .__module__
'__builtin__'

You should report this bug either to the numpy list:
https://lists.sourceforge.net/lists/...mpy-discussion

or to their bug tracker:
http://projects.scipy.org/scipy/numpy

Ziga

Aug 16 '06 #3
Thanks, Ziga

I have submitted the bug to http://projects.scipy.org/scipy/numpy

I am using the following workaround for now:
>>import numpy
import pickle
import __builtin__
__builtin__.f loat32_arrtype = numpy.float32
pickle.dumps( numpy.float32)
'c__builtin__\n float32_arrtype \np0\n.'

The name binding must also be present when unpickling.

Iljya Kalai

Ziga Seilnacht wrote:
Iljya wrote:
I have reproduced the error with Numpy 1.0b1

The output with v.1.0b1 reads:
PicklingError: Can't pickle <type 'float32scalar' >: it's not found as
__builtin__.flo at32scalar

Has anyone else encountered this?

Thanks,

Iljya

Iljya wrote:
Hello,
>
I need to pickle the type numpy.float32 but encounter an error when I
try to do so. I am able to pickle the array itself, it is specifically
the type that I cannot pickle.
>
I am using:
Numpy version: 0.9.4
Python version: 2.4.3
Windows XP
>
Here is the code that reproduces the error:
_______________ _______________ ________
import numpy
import pickle
>
pickle.dumps(nu mpy.float32)
>
Output:
PicklingError: Can't pickle <type 'float32_arrtyp e'>: it's not found as
__builtin__.flo at32_arrtype
_______________ _______________ ________
>
Any suggestions would be much appreciated.
>
Thanks,
>
Iljya Kalai

This looks like a numpy bug. It seems that float32_arrtype 's name is
incomplete. Its tp_name field should start with a module name, but
since it doesn't, Python assumes that it is a builtin type:
>import numpy
numpy.float32. __module__
'__builtin__'

You should report this bug either to the numpy list:
https://lists.sourceforge.net/lists/...mpy-discussion

or to their bug tracker:
http://projects.scipy.org/scipy/numpy

Ziga
Aug 16 '06 #4

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

Similar topics

20
2572
by: mclaugb | last post by:
Has anyone recompiled the Scientific Computing package using NumPy instead of Numeric? I need a least squares algorithm and a Newton Rhaphson algorithm which is contained in Numeric but all the documentation out there says that Numeric is crap and all code should be using NumPy. Thanks, Bryan
1
1519
by: drife | last post by:
Hello, I use the Python Numeric package extensively, and had been an avid user of the "old" scipy. In my view, both pieces of software are truly first rate, and have greatly improved my productivity in the area of scientific analysis. Thus, I was excited to make the transition to the new scipy core (numpy). Unfortunately, I am experiencing a problem that I cannot sort out. I am running Python 2.4.2 on a Debian box (V3.1), using
4
2653
by: sonjaa | last post by:
Hi last week I posted a problem with running out of memory when changing values in NumPy arrays. Since then I have tried many different approaches and work-arounds but to no avail. I was able to reduce the code (see below) to its smallest size and still have the problem, albeit at a slower rate. The problem appears to come
11
2185
by: Achim Domma | last post by:
Hi, I'm looking for quite some time now for a gui library for python, which allows me to display 3D graphics. Main OS is windows, Mac OS X and Linux would be nice to have. I want to use python 2.5. My first try was wx + pyOpenGL but there are no working binaries for python 2.5. I simply have to display some dialogs for data input and a 3D scene with lots of arrows. No fancy mesh and scene handling is needed. Is there an alternative to...
0
865
by: Robert Kern | last post by:
You will want to ask numpy questions on the numpy mailing list: http://www.scipy.org/Mailing_Lists I need a little more time to mull on your problem to give you an actual answer, but I hope I can do that over there instead of here. -- Robert Kern
0
1715
by: Gary Herron | last post by:
Marlin Rowley wrote: Numpy can do this for you. First, do you really mean the array to contain lists of one string each? If so: kludge here array(, dtype='|S1') array(, ,
5
6782
by: Marc Oldenhof | last post by:
Hello all, I'm pretty new to Python, but use it a lot lately. I'm getting a crazy error trying to do operations on a string list after importing numpy. Minimal example: Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) on win32 Type "help", "copyright", "credits" or "license" for more information.
0
1126
by: mrafi | last post by:
Hey All, I am working with numpy I have a data set with a lot of nan values, and i want to calculate standard deviation is there a direct function to do it for example nansum(or something like this), to calculate standard deviation ignoring nan values?? Thanks Rafi --
0
860
by: Robert Kern | last post by:
mrafi wrote: You will want to ask numpy questions on the numpy-discussion mailing list. http://www.scipy.org/Mailing_Lists scipy.stats.nanstd() implements this. Additionally, data.std() works unless if you need to apply the std() along just one axis. --
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8323
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.