senarvi / theanolm

TheanoLM is a recurrent neural network language modeling tool implemented using Theano
Apache License 2.0
81 stars 29 forks source link

ImportError: No module named 'scipy.sparse' #33

Closed amrmalkhatib closed 6 years ago

amrmalkhatib commented 6 years ago

First of all, I want to thank you for building theanolm, and I really appreciate your efforts.

I need your help in solving the following problem. I am trying to train a model with the following command: theanolm train model.h5 --training-set test.txt

but I'm getting the following error:

File "/usr/local/bin/theanolm", line 4, in import('pkg_resources').run_script('TheanoLM==1.3.0', 'theanolm') File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 719, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1504, in run_script exec(code, namespace, namespace) File "/usr/local/lib/python3.5/dist-packages/TheanoLM-1.3.0-py3.5.egg/EGG-INFO /scripts/theanolm", line 11, in from theanolm.backend import NumberError, TheanoConfigurationError File "/usr/local/lib/python3.5/dist-packages/TheanoLM-1.3.0-py3.5.egg/theanolm /init.py", line 7, in from theanolm.vocabulary import Vocabulary File "/usr/local/lib/python3.5/dist-packages/TheanoLM-1.3.0-py3.5.egg/theanolm /vocabulary/init.py", line 7, in from theanolm.vocabulary.statistics import compute_word_counts, BigramStatis tics File "/usr/local/lib/python3.5/dist-packages/TheanoLM-1.3.0-py3.5.egg/theanolm /vocabulary/statistics.py", line 8, in from scipy.sparse import dok_matrix ImportError: No module named 'scipy.sparse'

Although all dependencies and scipy 1.0.0 are already installed, it can't find 'scipy.sparse' module.

How can it be solved?

senarvi commented 6 years ago

Hi! It looks like scipy.sparse should be in scipy 1.0.0. For a quick workaround, you could just comment that import, because scipy is only needed for the word class tool. Did you install it with PIP? Generally I think Anaconda is working better: http://theanolm.readthedocs.io/en/latest/installation.html#anaconda

amrmalkhatib commented 6 years ago

Thank you very much, your work around has succeeded. I have installed the scipy with PIP3, and I've looked up for scipy.sparse and it has to be in scipy 1.0.0. but somehow it could'nt be found.