-
-
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
gensim installed with pip on Mac with python 3.7 not finding C extension #2802
Comments
same problem in the same system, I solved the issue by |
Some things to try:
then
(Worked for me) |
@hsimpson22 there are two separate issues here:
For 2), can you post your installation log? What did In particular, I'd expect OSX to install Gensim from the pre-compiled py3.7 wheel, so you don't need any C compiler. Your |
I got the same error too. In my case it is not a problem since I'm not going to train anything. But I found this issue, so here is some info: When importing gensim I get a warning: I re-installed it using https://gist.github.com/polyrand/057d44c4a65e342630ca4f4e42e2883e Let me know if you need anything else. |
I am getting the same error as well |
@polyrand the smart_open.gcs warning is not relevant, you may ignore it. If you're interested, it got fixed in the smart_open repo (https://github.com/RaRe-Technologies/smart_open/blob/develop/CHANGELOG.md). |
In my case it did not say anything special, just that it installed the wheel version 🤷♂️ My guess would be that it has something to do with the Mac OS version, because I run 10.14.6 on really old hardware (2009), @hsimpson22 writes 10.14.5.. is there a wheel without optimized w2v? 🧐 |
@krisdigital @hsimpson22 Can you try installing from the .tar.gz sources? I.e. not from the precompiled wheel. You'll need a working compiler but at least you'll see exactly how the compilation goes. It's possible there's some binary incompatibility on account of your older OS version. |
@piskvorky That is what I did and it worked! #2802 (comment) The numpy step is probably not needed.. |
I cannot reproduce the problem locally on my setup, identical to that of @hsimpson22:
|
I tried again and it uses Using the wheel I get the error again during training.. |
Luckily, I have an old Macbook! Still on 10.11.6 El Capitan :) Running Training a word2vec model from the examples: from gensim.models import Word2Vec
from gensim.test.utils import common_texts
model = Word2Vec(common_texts, size=100, window=5, min_count=1, workers=4)
/Volumes/work/workspace/vew/tst/lib/python3.7/site-packages/gensim/models/base_any2vec.py:743: UserWarning: C extension not loaded, training will be slow. Install a C compiler and reinstall gensim for fast training.
"C extension not loaded, training will be slow. " So, I can confirm the issue. After much pomp, the automated wheels testing process is not catching even critical compilation issues like this. import numpy; print("NumPy", numpy.__version__)
NumPy 1.18.3
import scipy; print("SciPy", scipy.__version__)
SciPy 1.4.1
import gensim; print("gensim", gensim.__version__)
gensim 3.8.1
from gensim.models import word2vec;print("FAST_VERSION", word2vec.FAST_VERSION)
FAST_VERSION -1 |
I remember El Capitan :) Good times.. So then it seems to be a problem with older hardware independent from the macOS version 🤔 |
I have a 2018 macbook pro running mac os catalina 10.15.4 and I am running into the same issue where it does not find the c compiler. The installation looks normal and I tried @krisdigital 's suggestion to install with the extra arguments |
@amehtaSF You say it does not work running |
I confirm installing from source with pip install gensim --no-cache-dir --no-binary gensim fixed this. It's only the precompiled (OSX only? all?) wheels that are at fault. |
@krisdigital Ah I apologize! I just tried again and it is now working. I had initially only re-run the import statement for gensim and it didn't work, but this time I completely restarted PyCharm and it did work after I did that. Thank you for your help!! |
I also confirm gensim 3.8.1 didn't have this problem – the precompiled OSX wheel works. It must be something recent. @mpenkov this may be blocking for 3.8.3. Please let me know when the final wheels are ready. I'd like to try them manually first, before the "public" release. |
@piskvorky The wheels output from the latest gensim-wheels are in s3://gensim-wheels. You can obtain a wheel by using e.g.
(Ignore wheels from other gensim versions in that S3 bucket) |
@piskvorky I already fix that & add sanity checking in wheel building (build fails if "bad" fast version), so, it should work right now |
Awesome. I confirm @menshikh-iv can you link to your fix of this bug here? Just for completeness & archival – I'll close this ticket. |
@piskvorky of course,
Also, "bad" fast version related issue #2794 |
@piskvorky @mpenkov yesterday I also fixed issue related to |
Problem description
I am trying to train a w2v model on my local machine (Mac OS 10.14.5), but I am getting message about needing to install C compiler:
Steps/code/corpus to reproduce
any call to gensim.models.Word2Vec
I am working in a python3 virtual env (name =
py3
)I tried the following to fix:
pip install --upgrade gensim
response is :
pip uninstall gensim; pip install gensim
this installed that same version
3.8.2
neither solved the problem .
I know installing conda might fix as it did for user guo18306671737 in #2572 but I don't use conda anymore as it has caused issues for me with paths etc. so would really like pip install to work for me -- for that user looks like the problem was attributed to being Windows specific but I am on a Mac so thought it's worth letting you know at least --- that user was also on Python 3.7
Versions
on CLI & in PyCharm (both with virtual env py3):
in jupyter notebook, with either Python3 or py3 kernel selected:
so, strangely, the gensim version pip says it installed (
3.8.2
), the version in CLI/PyCharm (3.8.1
) and version in jupyter notebook kernel (3.2.0
) all do not match .. not sure why .. in my notebook I had to prepend the path to/Users/hsimpson/envs/py3/lib/python3.7/site-packages
(where pip says it's installing gensim 3.8.2) in order to get spacy to be imported, but it still says it's runninggensim 3.2.0
however since both
3.8.1
and3.2.0
versions say FAST_VERSION -1 not sure if that mattersThe text was updated successfully, but these errors were encountered: