-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Implement numpy hack in setup.py to enable install under Poetry #3363
Conversation
Thanks! Let's wait for @mpenkov 's review and we can merge. |
Btw I literally just copied the first fix I googled for haha, no idea if there's a more elegant way to do it, or really what any of the |
Also will resolve #3225 |
Hi Team, We also facing an issue with this: without this fix, gensim cannot be installed via poetry 1.2. Appreciating your help in advance. |
setup.py
Outdated
@@ -104,7 +104,15 @@ def finalize_options(self): | |||
build_ext.finalize_options(self) | |||
# Prevent numpy from thinking it is still in its setup process: | |||
# https://docs.python.org/2/library/__builtin__.html#module-__builtin__ | |||
__builtins__.__NUMPY_SETUP__ = False | |||
try: | |||
__builtins__.__NUMPY_SETUP__ = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This particular part appears to be for Python 2 - we don't need it, right?
setup.py
Outdated
import builtins | ||
builtins.__NUMPY_SETUP__ = False | ||
except: | ||
print("Skipping numpy hack; if installation fails, try installing numpy first") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exception can possibly get raised here?
Assuming that some exception can, then a explicit error message would be better:
print("Skipping numpy hack; if installation fails, try installing numpy first") | |
print("Skipping numpy hack; if gensim installation fails, try installing numpy first") |
Also, may as well output the reason why the hack failed (what exception was caught) and a trace.
Implement numpy hack in setup.py to enable install under Poetry piskvorky#3363
this code can never raise an exception, so we shouldn't be expecting them
Fixes #3362
Confirmed poetry install works on M1 mbp with this fix.
poetry add git+ssh://git@github.com:jaymegordo/gensim.git#fix_3362