Skip to content
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

OverflowError: Python int too large to convert to C long #392

Closed
msalameh83 opened this issue Jul 10, 2015 · 5 comments

Comments

@msalameh83
Copy link

commented Jul 10, 2015

Hi ,
I am still getting this error:
OverflowError: Python int too large to convert to C long
on line 112 of word2vec.py

I have tried solutions discussed earlier and changed the hash function, but it did not work.

Also, shouldn't line 119 be indented ?
Thanks

@gojomo

This comment has been minimized.

Copy link
Member

commented Jul 10, 2015

Yes, line 119 is under-indented – good catch, I'll fix.

I can force a similar error as you get on line 112 if I try numpy.random.randint(2**64), so I suspect your error is because on 32-bit python, 2**32 can cause a problem for numpy.random.randint().

Can you confirm you're on a 32-bit python? (What does python --version and python -c "import sys; print(sys.maxsize)" say?) Is moving to a 64-bit python an option?

This spot could (and probably should) be adapted to still work under 32-bit python. But, given the other spot you got the same error, and the possibility of other similar recurring problems elsewhere (because the developers and build/test machines are probably all 64-bit python), the approach likely to skip the most future problems would be to use a 64-bit python.

Also, if you're running these pure-python method implementations, your training will go at about 1/100th the speed compared to having the c-variants working. So getting that working might both sidestep this issue and offer other benefits.

@gojomo

This comment has been minimized.

Copy link
Member

commented Jul 11, 2015

The change made in 726102d may get you past this error; could you please try it? (Though, still, the main goal should be to get the c-extension code working.)

@piskvorky

This comment has been minimized.

Copy link
Member

commented Aug 2, 2015

@msalameh83 Can you please check the latest gensim fixed this? Did @gojomo 's answers (and questions) resolve the issue for you?

@ghost ghost referenced this issue Aug 2, 2015
@msalameh83

This comment has been minimized.

Copy link
Author

commented Aug 10, 2015

Sorry for late reply.
Yes it works now
Thanks

@piskvorky

This comment has been minimized.

Copy link
Member

commented Aug 11, 2015

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.