Search code examples
pythonpipfasttext

pip install 2 packages from requirements one after the other


I want to install fasttext using pip. But fasttext needs Cython. The error can be seen here:

Complete output from command python setup.py egg_info:    
Traceback (most recent call last):      
  File "<string>", line 1, in <module>      
  File "/tmp/pip-install-3if14395/fasttext/setup.py", line 3, in <module>        
    from Cython.Build import cythonize    
ModuleNotFoundError: No module named 'Cython'

To solve this from the command line, I would do:

pip install Cython
pip install fasttext

and it would work.

But here, I need to install my packages from a single requirements.txt file like this: pip install -r requirements.txt.

If my requirements.txt file looks like this:

Cython
fasttext

It still gives me the error that fasttext needs Cython to be installed.

Is there a way, all in a single requirements.txt file, to ask pip to wait until Cython is installed to launch the fasttext install?


Solution

  • If you want to install fasttext try adding the following to your requirements.txt:

    numpy
    scipy
    pybind11
    git+https://github.com/facebookresearch/fastText.git