NickMichael
NickMichael

Reputation: 11

How to install gensim and run package in python?

i want to do in python 3.7.4:

and getting this Error:

i already tried:

using conda and pip

using local windows and windows server

multiple reinstallments of diffenent versions of packages (e.g. numpy and scipy)

from gensim.models import Word2Vec 

Traceback (most recent call last): File "c:/Users/Administrator/Documents/GitHub/contract-criteria-identifier-on-aws/schnelltest.py", line 1, in import gensim File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim__init__.py", line 5, in from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils # noqa:F401 File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\parsing__init__.py", line 4, in from .preprocessing import (remove_stopwords, strip_punctuation, strip_punctuation2, # noqa:F401 File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\parsing\preprocessing.py", line 42, in from gensim import utils File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\utils.py", line 40, in import scipy.sparse File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\sparse__init__.py", line 230, in from .csr import * File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\sparse\csr.py", line 13, in from ._sparsetools import (csr_tocsc, csr_tobsr, csr_count_blocks, ImportError: DLL load failed: The specified module could not be found. PS C:\Users\Administrator\Documents\GitHub\contract-criteria-identifier-on-aws> & C:/Users/Administrator/AppData/Local/Programs/Python/Python37/python.exe c:/Users/Administrator/Documents/GitHub/contract-criteria-identifier-on-aws/schnelltest.py Traceback (most recent call last): File "c:/Users/Administrator/Documents/GitHub/contract-criteria-identifier-on-aws/schnelltest.py", line 1, in import gensim File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim__init__.py", line 5, in from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils # noqa:F401 File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\parsing__init__.py", line 4, in from .preprocessing import (remove_stopwords, strip_punctuation, strip_punctuation2, # noqa:F401 File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\parsing\preprocessing.py", line 42, in from gensim import utils File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\utils.py", line 40, in import scipy.sparse File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\sparse__init__.py", line 230, in from .csr import * File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\scipy\sparse\csr.py", line 13, in from ._sparsetools import (csr_tocsc, csr_tobsr, csr_count_blocks, ImportError: DLL load failed: The specified module could not be found.

Upvotes: 1

Views: 1060

Answers (1)

gojomo
gojomo

Reputation: 54233

That error is actually suggesting some problem in scipy's installation – that's the source of the actual line of code where the DLL load failed error arises. You should try:

(1) uninstalling & reinstalling conda

(2) ensuring you've activated a "conda environment"

(3) manually conda-installing individually required packages, like scipy, and watching the output carefully for any warnings/errors

(4) when finally running your code, still ensuring you've activated the right conda environment

If you still have problems, expand your question with more specific details about how each part was installed, and whether there was reported success or failure at each step.

Notably, conda is usually very helpful in getting these packages working under Windows. But in general, they all get the most development, use, and quality-attention under more Unix/Linux-like systems. So if you have the option to not use Windows, everything may have a better chance of working, and when you hit problems, you'll have a larger body of prior docs/help to draw upon. (It all can still be made to work on Windows, but often requires using secondary or less-preferred installation/configuration options.)

Upvotes: 0

Related Questions