facebookresearch / fastText

Library for fast text representation and classification.
https://fasttext.cc/
MIT License
25.85k stars 4.71k forks source link

No module named 'fasttext_pybind' #1225

Closed hiyamgh closed 2 years ago

hiyamgh commented 2 years ago

Hello,

I have installed g++ on windows an the follwoing are available:

C:\Users\hkg02\Downloads\fastText>gcc --version
gcc (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++ (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I have installed fasttext according to the docs specification for python module as follows:

$ git clone https://github.com/facebookresearch/fastText.git
$ cd fastText
$ pip install .

and the output was successful:

Processing c:\users\hkg02\downloads\fasttext
  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
Requirement already satisfied: pybind11>=2.2 in c:\program files\python37\lib\site-packages (from fasttext==0.9.2) (2.5.0)
Requirement already satisfied: setuptools>=0.7.0 in c:\program files\python37\lib\site-packages (from fasttext==0.9.2) (46.1.3)
Requirement already satisfied: numpy in c:\program files\python37\lib\site-packages (from fasttext==0.9.2) (1.17.2)
Building wheels for collected packages: fasttext
  Building wheel for fasttext (setup.py) ... done
  Created wheel for fasttext: filename=fasttext-0.9.2-cp37-cp37m-win_amd64.whl size=229726 sha256=27ae0b16aa8f99cb29d220deaced8c5631145958bcd214b1b3ca58f6b588c2eb
  Stored in directory: C:\Users\hkg02\AppData\Local\Temp\pip-ephem-wheel-cache-uceaqr_v\wheels\4d\f0\a9\b866288d57ab8b0ffcea5a368224986425dc1ccf0624f3130d
Successfully built fasttext
Installing collected packages: fasttext
Successfully installed fasttext-0.9.2

However, when I import it it gives me the following error:

import fasttext
model = fasttext.load_model('G:/fasttext_embeddings/ngrams4-size100-window3-mincount10-negative5-lr0.001/2009.bin')

Error:

Traceback (most recent call last):
  File "C:/Users/hkg02/Desktop/political_discourse_mining_hiyam/semantic_shifts/test.py", line 1, in <module>
    import fasttext
  File "C:\Users\hkg02\AppData\Local\Programs\Python\Python37\lib\site-packages\fasttext\__init__.py", line 12, in <module>
    from .FastText import train_supervised
  File "C:\Users\hkg02\AppData\Local\Programs\Python\Python37\lib\site-packages\fasttext\FastText.py", line 12, in <module>
    import fasttext_pybind as fasttext
ModuleNotFoundError: No module named 'fasttext_pybind'
hiyamgh commented 2 years ago

Problem Solved :)

It was a PyCharm issue. I am not sure why I had to go to:

File --> 
Settings -->
Project Interpreter -->
press on the '+' sign --> 
Search for 'fasttext' in available packages search bar --> 
install it 

But I'll leave this issue open for someone to better explain what happened.