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

AttributeError: 'dict' object has no attribute '__NUMPY_SETUP__' #3225

Closed
icanhasmath opened this issue Aug 31, 2021 · 9 comments · Fixed by #3416
Closed

AttributeError: 'dict' object has no attribute '__NUMPY_SETUP__' #3225

icanhasmath opened this issue Aug 31, 2021 · 9 comments · Fixed by #3416

Comments

@icanhasmath
Copy link

icanhasmath commented Aug 31, 2021

Building gensim from source on Python 3.9 I consistently get this error:

  File "setup.py", line 108, in finalize_options
    __builtins__.__NUMPY_SETUP__ = False
AttributeError: 'dict' object has no attribute '__NUMPY_SETUP__'

My current workaround is this:
https://github.com/RaRe-Technologies/gensim/blob/919b4154a5696a544b87f792992f25f5e4d59d3e/setup.py#L109

        try:
            __builtins__.__NUMPY_SETUP__ = False
        except AttributeError:
            print("Cannot set '__builtins__.__NUMPY_SETUP__ = False' This is not needed if numpy is already installed.")
@mpenkov
Copy link
Collaborator

mpenkov commented Dec 4, 2021

What platform?

@icanhasmath
Copy link
Author

Windows.

@jaymegordo
Copy link
Contributor

+1 same thing on mac M1

@icanhasmath
Copy link
Author

Noting this thread may be relevant: pyvista/pyacvd#23 (comment)
They dropped the __builtins__.__NUMPY_SETUP__ as outdated.

@hangingman
Copy link

This problem is fixed in gensim4, but is there any backport release ?
I want to use gensim3 instead of gensim4.
I'm happy if gensim 3.8.4 is released for backport , which will be resolved this __NUMPY_SETUP__ issue.

@hangingman
Copy link

I write this for those who missed reading it;

Gensim is being continuously tested under all supported Python versions. Support for Python 2.7 was dropped in gensim 4.0.0 – install gensim 3.8.3 if you must use Python 2.7.

@gojomo
Copy link
Collaborator

gojomo commented Apr 16, 2024

No further 3.8.x releases are expected, so you'd have to backport any fixes, or apply workarounds, on your own.

But also: improvements in a number of aspects of Gensim mean any such custom efforts might be better exerted porting code/models to use Gensim 4.x.

Further, any specific barriers you're facing, in upgrading to 4.x, that can be well-described could potentially get code/doc help in a future 4.x release – potentialy of public value to many users – while fixing things for a 4-year-old release on a Python (3.9) that is itself within 18mo of end-of-life may only have idiosyncratic private value to you.

@hangingman
Copy link

@gojomo Thank you for your explanation.
Finally, I've used Python 3.8 + gensim3, then the problem is resolved.

In the first place why I'm using gensim3, because I would like to avoid the error of #3127 (I think, the issue point is the Doc2Vec model trained by gensim3 can't be used by gensim4.) .
Then, I've encountered this #3225 because of I'm using latest python and gensim.

Further, any specific barriers you're facing, in upgrading to 4.x, that can be well-described could potentially get code/doc help in a future 4.x release – potentialy of public value to many users

In this point of view, I expect you to described how to resolve a issue , such a #3127. I speculate there is only one way (?). This is to say; training model by gensim4.

@gojomo
Copy link
Collaborator

gojomo commented Apr 17, 2024

@hangingman - Thanks, could you add a comment on #3127 describing the way you're seeing that problem? (Specifically: whether you're hitting the first variant originally reported – the model loads but then errors on subsequent use – or a failure-on-load, perhaps with exact same stack as others have shown? If you know the exact version(s) in which your model was created or successfuly loaded/used, those would be good to know, too.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants