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

ValueError in import gensim.downloader #48

Open
oleggrigoryev opened this issue Sep 12, 2021 · 7 comments
Open

ValueError in import gensim.downloader #48

oleggrigoryev opened this issue Sep 12, 2021 · 7 comments

Comments

@oleggrigoryev
Copy link

oleggrigoryev commented Sep 12, 2021

I had an error when try to import downloader module. I upgraded gensim to v4.1.0 and numpy to v1.21.2. But it doesn't work.

input: import gensim.downloader as api
output:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-30-3080edd5e090> in <module>
----> 1 import gensim.downloader as api
      2 #gt25 = api.load('glove-twitter-25')

~/opt/anaconda3/envs/praktikum/lib/python3.7/site-packages/gensim/__init__.py in <module>
      9 import logging
     10 
---> 11 from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils  # noqa:F401
     12 
     13 

~/opt/anaconda3/envs/praktikum/lib/python3.7/site-packages/gensim/corpora/__init__.py in <module>
      4 
      5 # bring corpus classes directly into package namespace, to save some typing
----> 6 from .indexedcorpus import IndexedCorpus  # noqa:F401 must appear before the other classes
      7 
      8 from .mmcorpus import MmCorpus  # noqa:F401

~/opt/anaconda3/envs/praktikum/lib/python3.7/site-packages/gensim/corpora/indexedcorpus.py in <module>
     12 import numpy
     13 
---> 14 from gensim import interfaces, utils
     15 
     16 logger = logging.getLogger(__name__)

~/opt/anaconda3/envs/praktikum/lib/python3.7/site-packages/gensim/interfaces.py in <module>
     17 import logging
     18 
---> 19 from gensim import utils, matutils
     20 
     21 

~/opt/anaconda3/envs/praktikum/lib/python3.7/site-packages/gensim/matutils.py in <module>
   1022 try:
   1023     # try to load fast, cythonized code if possible
-> 1024     from gensim._matutils import logsumexp, mean_absolute_difference, dirichlet_expectation
   1025 
   1026 except ImportError:

~/opt/anaconda3/envs/praktikum/lib/python3.7/site-packages/gensim/_matutils.pyx in init gensim._matutils()

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
@mpenkov
Copy link
Collaborator

mpenkov commented Sep 12, 2021

Please show the output of:

pip freeze
python --version
pip --version

@oleggrigoryev
Copy link
Author

@mpenkov, here is:

appnope @ file:///Users/runner/miniforge3/conda-bld/appnope_1610094688183/work
attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1620387926260/work
backcall @ file:///home/conda/feedstock_root/build_artifacts/backcall_1592338393461/work
backports.functools-lru-cache @ file:///home/conda/feedstock_root/build_artifacts/backports.functools_lru_cache_1618230623929/work
beautifulsoup4==4.8.0
bleach @ file:///home/conda/feedstock_root/build_artifacts/bleach_1629908509068/work
brotlipy==0.7.0
catboost==0.26.1
certifi==2021.5.30
cffi @ file:///Users/runner/miniforge3/conda-bld/cffi_1625835480320/work
chardet @ file:///Users/runner/miniforge3/conda-bld/chardet_1602255311078/work
click==8.0.1
cryptography @ file:///Users/runner/miniforge3/conda-bld/cryptography_1616851693031/work
cycler==0.10.0
DAWG-Python==0.7.2
decorator @ file:///home/conda/feedstock_root/build_artifacts/decorator_1621187651333/work
defusedxml @ file:///home/conda/feedstock_root/build_artifacts/defusedxml_1615232257335/work
docopt==0.6.2
entrypoints @ file:///home/conda/feedstock_root/build_artifacts/entrypoints_1605121927639/work/dist/entrypoints-0.3-py2.py3-none-any.whl
filelock==3.0.12
gensim==4.1.0
graphviz==0.17
huggingface-hub==0.0.16
idna==2.8
importlib-metadata @ file:///Users/runner/miniforge3/conda-bld/importlib-metadata_1630267512322/work
ipykernel==5.1.4
ipython==7.11.1
ipython-genutils==0.2.0
ipywidgets @ file:///home/conda/feedstock_root/build_artifacts/ipywidgets_1630470352784/work
jedi @ file:///Users/runner/miniforge3/conda-bld/jedi_1605054671552/work
Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1621419064915/work
joblib==1.0.1
json5 @ file:///home/conda/feedstock_root/build_artifacts/json5_1600692310011/work
jsonschema @ file:///home/conda/feedstock_root/build_artifacts/jsonschema_1614815863336/work
jupyter==1.0.0
jupyter-client==5.3.1
jupyter-console==6.0.0
jupyter-core==4.5.0
jupyterlab==1.0.2
jupyterlab-server==1.0.0
jupyterlab-widgets @ file:///home/conda/feedstock_root/build_artifacts/jupyterlab_widgets_1630474294342/work
kiwisolver==1.3.2
MarkupSafe @ file:///Users/runner/miniforge3/conda-bld/markupsafe_1621455729133/work
matplotlib==3.1.0
mistune @ file:///Users/runner/miniforge3/conda-bld/mistune_1624941340745/work
mkl-fft==1.3.0
mkl-random==1.1.1
mkl-service==2.3.0
nbconvert==5.6.1
nbformat @ file:///home/conda/feedstock_root/build_artifacts/nbformat_1617383142101/work
nltk==3.4.1
notebook @ file:///opt/concourse/worker/volumes/live/83d697c1-36fc-425f-4bd2-94b832dd29b9/volume/notebook_1595951656072/work
numpy==1.21.2
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1625323647219/work
pandas==0.25.1
pandocfilters==1.4.2
parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1595548966091/work
patsy==0.5.1
pexpect @ file:///home/conda/feedstock_root/build_artifacts/pexpect_1602535608087/work
pickleshare @ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1602536217715/work
plotly==4.1.0
prometheus-client @ file:///home/conda/feedstock_root/build_artifacts/prometheus_client_1622586138406/work
prompt-toolkit==2.0.10
psycopg2-binary==2.8.4
ptyprocess @ file:///home/conda/feedstock_root/build_artifacts/ptyprocess_1609419310487/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1593275161868/work
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1629119114968/work
pymorphy2==0.8
pymorphy2-dicts==2.4.393442.3710985
pymystem3==0.2.0
pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1608055815057/work
pyparsing==2.4.7
PyQt5==5.12.3
PyQt5_sip==4.19.18
PyQtChart==5.12
PyQtWebEngine==5.12.1
pyrsistent @ file:///Users/runner/miniforge3/conda-bld/pyrsistent_1624984581490/work
PySocks @ file:///Users/runner/miniforge3/conda-bld/pysocks_1610291468418/work
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work
pytz==2021.1
PyYAML==5.4.1
pyzmq @ file:///Users/runner/miniforge3/conda-bld/pyzmq_1628232946840/work
qtconsole @ file:///home/conda/feedstock_root/build_artifacts/qtconsole_1625023841584/work
QtPy @ file:///home/conda/feedstock_root/build_artifacts/qtpy_1630767961547/work
regex==2020.4.4
requests==2.22.0
retrying==1.3.3
sacremoses==0.0.45
scikit-learn==0.21.2
scipy==1.4.1
seaborn==0.9.0
Send2Trash @ file:///home/conda/feedstock_root/build_artifacts/send2trash_1628511208346/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
smart-open==5.2.1
soupsieve==2.2.1
SQLAlchemy==1.3.11
statsmodels==0.10.1
terminado @ file:///Users/runner/miniforge3/conda-bld/terminado_1629328214192/work
testpath @ file:///home/conda/feedstock_root/build_artifacts/testpath_1621261527237/work
tokenizers==0.10.3
torch @ file:///opt/concourse/worker/volumes/live/ce36451d-3e06-4b8b-7906-520747b751e1/volume/pytorch_1596721440076/work
tornado @ file:///Users/runner/miniforge3/conda-bld/tornado_1625489080309/work
tqdm==4.62.2
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1630423529112/work
transformers==4.10.2
typing-extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1622748266870/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1603125704209/work
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1600965781394/work
webencodings==0.5.1
widgetsnbextension @ file:///Users/runner/miniforge3/conda-bld/widgetsnbextension_1605475528405/work
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1625284368454/work
Python 3.7.10
pip 21.2.4 from /Users/elizaveta/opt/anaconda3/envs/praktikum/lib/python3.7/site-packages/pip (python 3.7)

@mpenkov
Copy link
Collaborator

mpenkov commented Sep 12, 2021

Also, what platform? MacOS, Linux, Windows? I suspect MacOS from the pathnames, but would like to be sure.

Do previous gensim versions exhibit the same problem?

@oleggrigoryev
Copy link
Author

oleggrigoryev commented Sep 12, 2021

Also, what platform? MacOS, Linux, Windows? I suspect MacOS from the pathnames, but would like to be sure.

MacOS 10.14.6

Do previous gensim versions exhibit the same problem?

Yes, they do. I found a recommendation for upgrade version of Gensim and Numpy and did it. But the problem still remains.

It can be important: I'm using local Jupiter Notebook for code.

@oleggrigoryev
Copy link
Author

@mpenkov do you have any idea for solve the problem?

@mpenkov
Copy link
Collaborator

mpenkov commented Sep 13, 2021

Not immediately, no. I need to reproduce your problem first, but I've got a lot on my to-do list at the moment, and can't say when I will get around to it.

In the meanwhile, you could try rebuilding gensim from source (instead of using the wheel) - that may help.

@mpenkov
Copy link
Collaborator

mpenkov commented Sep 28, 2021

Can you try with gensim 4.1.2? pip install -U gensim

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

No branches or pull requests

2 participants