epfml / sent2vec

General purpose unsupervised sentence representations
Other
1.19k stars 256 forks source link

module 'sent2vec' has no attribute 'Sent2vecModel' #43

Closed mar00nie closed 6 years ago

mar00nie commented 6 years ago

Hi, I used a new server to run the code in jupyter notebook and the line "model = sent2vec.Sent2vecModel()" produces the error "module 'sent2vec' has no attribute 'Sent2vecModel'" once again. This time recloning the repository doesn't work anymore. And yes I reinstalled Cython but it doesn't help.

mar00nie commented 6 years ago

Looks like I have to run:

python setup.py build_ext pip install .

in the terminal each time before importing sent2vec in the notebook, even if it was already installed before.

patilaum commented 5 years ago

Getting the same error and this is not working for me. The python module is not getting generated. I ran these commands and following file is being produced sent2vec.cpython-35m-x86_64-linux-gnu.so and sent to /usr/local/lib/python-3.5/dist-packages/

following is the log of pip3 install . Processing /home/aum/ezDI/main_code/sent2vec Installing collected packages: sent2vec Running setup.py install for sent2vec ... done Successfully installed sent2vec-0.0.0

SenNath commented 5 years ago

Try running the python script from inside the cloned Sent2vec package directory. That might help!

gregbellingham commented 4 years ago

For those wishing to run a Python script from a working directory other than the cloned one, I found a work-around solution. Combining answers from @mar00nie and @SenNath:

cd <directory-of-cloned-sent2vec>
python setup.py build_ext --inplace
cp sent2vec.so <directory-of-your-own-script>

This will copy a local .so file to your script directory and Python will then find the model class.

BramVanroy commented 3 years ago

This still is an issue.

Stannislav commented 3 years ago

Note that if you install sent2vec using

$ pip install sent2vec

then you'll get the wrong package. This is because the package sent2vec on PyPI is a totally different package with the same name.

The correct way of installing sent2vec is to clone their repository here https://github.com/epfml/sent2vec and to follow the instructions in the README file