explosion / spaCy

💫 Industrial-strength Natural Language Processing (NLP) in Python
https://spacy.io
MIT License
30.23k stars 4.4k forks source link

Numpy build dependency is causing install errors #13624

Closed percevalw closed 1 month ago

percevalw commented 2 months ago

How to reproduce the behaviour

Hi, it seems that the latest spacy release has bumped the numpy build dependency:

[build-system]
requires = [
    "setuptools",
    "cython>=0.25,<3.0",
    "cymem>=2.0.2,<2.1.0",
    "preshed>=3.0.2,<3.1.0",
    "murmurhash>=0.28.0,<1.1.0",
    "thinc>=8.3.0,<8.4.0",
    "numpy>=2.0.0,<2.1.0; python_version < '3.9'",
    "numpy>=2.0.0,<2.1.0; python_version >= '3.9'",
]

(from pyproject.toml in the pypi source distribution)

These requirements are not the same as the one on the main branch of your repo: https://github.com/explosion/spaCy/blob/30f1f33e78e123d8ba9cf10ee8edb98a5a5e7170/pyproject.toml#L1C1-L12C40

breaking installations for earlier python versions (I think numpy 2.0 is only py > 3.10 ?), see below:

Notice:  A new release of pip is available: 23.0.1 -> 24.0
Notice:  To update, run: pip install --upgrade pip
error: Failed to build: `edsnlp @ file:///home/runner/work/edsnlp/edsnlp`
  Caused by: Failed to install requirements from `build-system.requires` (install)
  Caused by: Failed to prepare distributions
  Caused by: Failed to fetch wheel: spacy==3.8.0
  Caused by: Failed to install requirements from `build-system.requires` (resolve)
  Caused by: No solution found when resolving: setuptools, cython>=0.25, <3.0, cymem>=2.0.2, <2.1.0, preshed>=3.0.2, <3.1.0, murmurhash>=0.28.0, <1.1.0, thinc>=8.3.0, <8.4.0, numpy>=2.0.0, <2.1.0 ; python_full_version < '3.9', numpy>=2.0.0, <2.1.0 ; python_full_version >= '3.9'
  Caused by: Because only the following versions of numpy{python_full_version < '3.9'} are available:
    numpy{python_full_version < '3.9'}<=2.0.0
    numpy{python_full_version < '3.9'}==2.0.1
    numpy{python_full_version < '3.9'}==2.0.2
    numpy{python_full_version < '3.9'}>2.1.0
and the current Python version (3.7.17) does not satisfy Python>=3.8, we can conclude that numpy{python_full_version < '3.9'}>=2.0.0,<2.1.0 is incompatible.
And because you require numpy{python_full_version < '3.9'}>=2.0.0,<2.1.0, we can conclude that your requirements are unsatisfiable.

Your Environment

honnibal commented 2 months ago

There was a problem with the metadata on that release. It shouldn't list support for older Pythons. I've yanked the release and am rebuilding.

Python only allows you to have one version of each library in the tree at once, and spaCy cannot support both numpy v1 and numpy v2 as they're binary incompatible. We need to update the pin to allow people to use spaCy with other libraries that require numpy v2. If numpy v2 doesn't support Python 3.8, this means spaCy can't support it either.

The only solution is to update your Python, or continue using the version of spaCy that's been working for you.

Python versions release every year now, which means the build matrix will grow quickly for libraries like numpy and spaCy that need to build wheels for each version of Python. This means libraries have to prune support for older Pythons, and you'll need to update your Python version periodically in order to keep using new library releases in the ML/data stack.

honnibal commented 1 month ago

New release v3.8 is up, which should fix the problem.

github-actions[bot] commented 2 weeks ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.