uv icon indicating copy to clipboard operation
uv copied to clipboard

Can't install fasttext with uv

Open ivanychev opened this issue 1 year ago • 3 comments

Reproduce:

python -m venv venv  # Python 3.10
source venv/bin/activate
uv pip install fasttext==0.9.2

Error:

error: Failed to download and build: fasttext==0.9.2
  Caused by: Failed to build: fasttext==0.9.2
  Caused by: Build backend failed to determine metadata through `prepare_metadata_for_build_wheel`:
--- stdout:

--- stderr:
/private/var/folders/m0/mgh9dmxj53s9ytmy_m0zvfqm0000gn/T/.tmpZAGWL2/.venv/bin/python: No module named pip
Traceback (most recent call last):
  File "<string>", line 38, in __init__
ModuleNotFoundError: No module named 'pybind11'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 10, in <module>
  File "/private/var/folders/m0/mgh9dmxj53s9ytmy_m0zvfqm0000gn/T/.tmpZAGWL2/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
    self.run_setup()
  File "/private/var/folders/m0/mgh9dmxj53s9ytmy_m0zvfqm0000gn/T/.tmpZAGWL2/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 480, in run_setup
    super().run_setup(setup_script=setup_script)
  File "/private/var/folders/m0/mgh9dmxj53s9ytmy_m0zvfqm0000gn/T/.tmpZAGWL2/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
    exec(code, locals())
  File "<string>", line 72, in <module>
  File "<string>", line 41, in __init__
RuntimeError: pybind11 install failed.
—

ivanychev avatar Feb 16 '24 07:02 ivanychev

FYI,

uv pip install pybind11
uv pip install fasttext==0.9.2

also fails with the same error

ivanychev avatar Feb 16 '24 07:02 ivanychev

I think the problem here is that fasttext sort of "secretly" depends on pip: https://github.com/facebookresearch/fastText/blob/b733943e84263f432fa47588643822194ee03dd1/setup.py#L40. But it's not declared as a build dependency.

charliermarsh avatar Feb 16 '24 16:02 charliermarsh

This may need to be fixed in fasttext itself, or we'd have to special-case fasttext in uv.

charliermarsh avatar Feb 16 '24 16:02 charliermarsh

This has been fixed on fasttext's side by adding a pyproject.toml, uv pip install "fasttext @ git+https://github.com/facebookresearch/fastText" installs succesfully.

konstin avatar Feb 21 '24 13:02 konstin