facebookresearch / fastText

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

Declare a build dependency on `pip` #1365

Open AlexWaygood opened 4 months ago

AlexWaygood commented 4 months ago

Currently installing fasttext with uv fails, as fasttext's setup.py file tries to use pip to install pybind11 if it is not already installed. uv does not, by default, include pip in new virtual environments:

% uv venv new-venv                 
Using Python 3.12.2 interpreter at: /Users/alexw/.pyenv/versions/3.12.2/bin/python3
Creating virtualenv at: new-venv
Activate with: source new-venv/bin/activate
% source new-venv/bin/activate     
(new-venv) % uv pip install fasttext
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 extra requires with `build_wheel()`:
--- stdout:

--- stderr:
/Users/alexw/Library/Caches/uv/.tmp2ZDKtZ/.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 14, in <module>
  File "/Users/alexw/Library/Caches/uv/.tmp2ZDKtZ/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alexw/Library/Caches/uv/.tmp2ZDKtZ/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
    self.run_setup()
  File "/Users/alexw/Library/Caches/uv/.tmp2ZDKtZ/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 487, in run_setup
    super().run_setup(setup_script=setup_script)
  File "/Users/alexw/Library/Caches/uv/.tmp2ZDKtZ/.venv/lib/python3.12/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.
---

This PR makes fasttext installable with uv by adding pip as a build dependency.

facebook-github-bot commented 4 months ago

Hi @AlexWaygood!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!