New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Int32 overflow when creating array from large list #5783
Comments
What numpy version? 32 or 64 bit? |
mh that needs more than 128gb ram to reproduce |
Python is 64bit so I assume numpy is also 64bit. I am encountering it on Ubuntu and yeah you need quite some memory to reproduce, so I guess my statement about easy to reproduce is wrong. |
best machine I have access to has 128gb which is probably just not enough there is a similar problem in python3 where range is a generator, array of small range expands the generator, |
The range function is not the issue. I first encountered this error when I tried to create an array of a very large hand-created list (actually while building a sparse scipy matrix). |
The error is very likely being raised when creating the array to fill with the sequence here. That points to the shape discovery code as the likely culprit. While it shouldn't be an issue if your C I don't have the RAM to even dream of attempting this... :-( |
nice find, that definitely looks wrong, int is 32 bit on all platforms I know of |
Right, it's |
Yeah, on Win64 long is 32 bit. On every other platform we care about, long On Wed, Apr 22, 2015 at 4:38 PM, Jaime notifications@github.com wrote:
Nathaniel J. Smith -- http://vorpus.org |
I found a couple other uses of |
I will try it out soon! |
I think this could be tested with more modest memory usage ("only" 16
|
If you avoid lists, you might get much more efficient, but it is still incredulously slow (python2 here):
The improved version is maybe this:
Seems to run into similar issues (only checked 1.8.2) and is instant of course. But with all this, I am not sure if we do not have some list fast paths here, so that we have to use lists and not some custom sequence-like types. |
@jaimefrio Seems to work! |
When trying to create an array from a huge list, I receive the following error:
ValueError: negative dimensions are not allowed
After some debugging, I found that it seems to be a problem with some INT32 overflow in the C code of numpy. So you can quite easily reproduce the error the following way:
The text was updated successfully, but these errors were encountered: