473,897 Members | 3,187 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 3622
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
2596
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
1532
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
2666
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
2206
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
872
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
1740
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
6799
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
1136
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
868
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
9990
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
9837
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
11250
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10939
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
10476
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
5872
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6073
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4697
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3299
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.