Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
6.74k stars 873 forks source link

SciPy 1.6.1 dependency build failed #1189

Closed dokterbob closed 1 week ago

dokterbob commented 1 month ago

Describe the bug While building main according to the contribution instructions, poetry install errors with build errors on scipy.

This makes it harder to contribute.

To Reproduce Steps to reproduce the behaviour:

  1. git clone https://github.com/Chainlit/chainlit.git
  2. cd chainlit/backend
  3. poetry install --with mypy (it's tests which triggers the scipy requirement)
  4. See console log below

Expected behavior A clear and concise description of what you expected to happen.

Console log

% poetry install --with tests
Installing dependencies from lock file

Package operations: 41 installs, 0 updates, 0 removals

  - Installing scipy (1.6.1): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel

  setup.py:563: DeprecationWarning: 

    `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
    of the deprecation of `distutils` itself. It will be removed for
    Python >= 3.12. For older Python versions it will remain present.
    It is recommended to use `setuptools < 60.0` for those Python versions.
    For more details, see:
      https://numpy.org/devdocs/reference/distutils_status_migration.html 

    from numpy.distutils.core import setup
  Running from SciPy source directory.
  INFO: lapack_opt_info:
  INFO: lapack_armpl_info:
  INFO: customize UnixCCompiler
  INFO:   libraries armpl_lp64_mp not found in ['/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib', '/usr/local/lib', '/usr/lib']
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: lapack_mkl_info:
  INFO:   libraries mkl_rt not found in ['/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib', '/usr/local/lib', '/usr/lib']
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: lapack_ssl2_info:
  INFO:   libraries fjlapackexsve not found in ['/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib', '/usr/local/lib', '/usr/lib']
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: openblas_lapack_info:
  INFO:   libraries openblas not found in ['/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib', '/usr/local/lib', '/usr/lib']
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: openblas_clapack_info:
  INFO:   libraries openblas,lapack not found in ['/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib', '/usr/local/lib', '/usr/lib']
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: flame_info:
  INFO:   libraries flame not found in ['/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib', '/usr/local/lib', '/usr/lib']
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: accelerate_info:
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: atlas_3_10_threads_info:
  INFO: Setting PTATLAS=ATLAS
  INFO:   libraries tatlas,tatlas not found in /private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib
  INFO:   libraries tatlas,tatlas not found in /usr/local/lib
  INFO:   libraries tatlas,tatlas not found in /usr/lib
  INFO: <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: atlas_3_10_info:
  INFO:   libraries satlas,satlas not found in /private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib
  INFO:   libraries satlas,satlas not found in /usr/local/lib
  INFO:   libraries satlas,satlas not found in /usr/lib
  INFO: <class 'numpy.distutils.system_info.atlas_3_10_info'>
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: atlas_threads_info:
  INFO: Setting PTATLAS=ATLAS
  INFO:   libraries ptf77blas,ptcblas,atlas not found in /private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib
  INFO:   libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
  INFO:   libraries ptf77blas,ptcblas,atlas not found in /usr/lib
  INFO: <class 'numpy.distutils.system_info.atlas_threads_info'>
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: atlas_info:
  INFO:   libraries f77blas,cblas,atlas not found in /private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib
  INFO:   libraries f77blas,cblas,atlas not found in /usr/local/lib
  INFO:   libraries f77blas,cblas,atlas not found in /usr/lib
  INFO: <class 'numpy.distutils.system_info.atlas_info'>
  INFO:   NOT AVAILABLE
  INFO: 
  INFO: lapack_info:
  INFO:   libraries lapack not found in ['/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib', '/usr/local/lib', '/usr/lib']
  INFO:   NOT AVAILABLE
  INFO: 
  /private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib/python3.10/site-packages/numpy/distutils/system_info.py:1974: UserWarning: 
      Lapack (http://www.netlib.org/lapack/) libraries not found.
      Directories to search for the libraries can be specified in the
      numpy/distutils/site.cfg file (section [lapack]) or by setting
      the LAPACK environment variable.
    return getattr(self, '_calc_info_{}'.format(name))()
  INFO: lapack_src_info:
  INFO:   NOT AVAILABLE
  INFO: 
  /private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib/python3.10/site-packages/numpy/distutils/system_info.py:1974: UserWarning: 
      Lapack (http://www.netlib.org/lapack/) sources not found.
      Directories to search for the sources can be specified in the
      numpy/distutils/site.cfg file (section [lapack_src]) or by setting
      the LAPACK_SRC environment variable.
    return getattr(self, '_calc_info_{}'.format(name))()
  INFO:   NOT AVAILABLE
  INFO: 
  Traceback (most recent call last):
    File "/usr/local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/usr/local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 216, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 202, in _build_with_temp_dir
      self.run_setup()
    File "/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 253, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 588, in <module>
      setup_package()
    File "setup.py", line 584, in setup_package
      setup(**metadata)
    File "/private/var/folders/nf/_b_ryz1s1zb2s69zxq2rrlh00000gn/T/tmpttmya6me/.venv/lib/python3.10/site-packages/numpy/distutils/core.py", line 135, in setup
      config = configuration()
    File "setup.py", line 499, in configuration
      raise NotFoundError(msg)
  numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK libraries found. Note: Accelerate is no longer supported.
  To build Scipy from sources, BLAS & LAPACK libraries need to be installed.
  See site.cfg.example in the Scipy source directory and
  https://docs.scipy.org/doc/scipy/reference/building/index.html for details.

  at /usr/local/lib/python3.10/site-packages/poetry/installation/chef.py:164 in _prepare
      160│ 
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│ 
      163│             if error is not None:
    → 164│                 raise error from None
      165│ 
      166│             return path
      167│ 
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with scipy (1.6.1) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "scipy (==1.6.1)"'.

Desktop:

Observations:

scipy >= 1.5.0 is pulled in through scikit-learn >=1.0.0 by farm-haystack 1.18.0 which is a test dependency.

dokterbob commented 1 month ago

Possibly related: https://github.com/python-poetry/poetry/issues/5628#issuecomment-1129422709

dokterbob commented 1 month ago

I can confirm that changing the Python requirement in pyproject.toml to either one of the following values solves the issue: