2

I am trying to install flair library for a python project on my Macbook M1. https://pypi.org/project/flair/

But when I run pip3 install flair on my terminal, here is the output:

    DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Collecting flair
  Using cached flair-0.11.3-py3-none-any.whl (401 kB)
Collecting torch!=1.8,>=1.5.0
  Using cached torch-1.12.0-cp39-none-macosx_11_0_arm64.whl (48.9 MB)
Collecting segtok>=1.5.7
  Using cached segtok-1.5.11-py3-none-any.whl (24 kB)
Collecting janome
  Using cached Janome-0.4.2-py2.py3-none-any.whl (19.7 MB)
Collecting huggingface-hub
  Using cached huggingface_hub-0.8.1-py3-none-any.whl (101 kB)
Collecting transformers>=4.0.0
  Using cached transformers-4.20.1-py3-none-any.whl (4.4 MB)
Collecting konoha<5.0.0,>=4.0.0
  Using cached konoha-4.6.5-py3-none-any.whl (20 kB)
Collecting matplotlib>=2.2.3
  Using cached matplotlib-3.5.2-cp39-cp39-macosx_11_0_arm64.whl (7.2 MB)
Collecting langdetect
  Using cached langdetect-1.0.9.tar.gz (981 kB)
  Preparing metadata (setup.py) ... done
Collecting lxml
  Using cached lxml-4.9.1.tar.gz (3.4 MB)
  Preparing metadata (setup.py) ... done
Collecting ftfy
  Using cached ftfy-6.1.1-py3-none-any.whl (53 kB)
Collecting sqlitedict>=1.6.0
  Using cached sqlitedict-2.0.0.tar.gz (46 kB)
  Preparing metadata (setup.py) ... done
Collecting scikit-learn>=0.21.3
  Using cached scikit-learn-1.1.1.tar.gz (6.8 MB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [218 lines of output]
      Collecting setuptools<60.0
        Using cached setuptools-59.8.0-py3-none-any.whl (952 kB)
      Collecting wheel
        Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
      Collecting Cython>=0.28.5
        Using cached Cython-0.29.30-py2.py3-none-any.whl (985 kB)
      Collecting oldest-supported-numpy
        Using cached oldest_supported_numpy-2022.5.28-py3-none-any.whl (3.9 kB)
      Collecting scipy>=1.3.2
        Using cached scipy-1.8.1.tar.gz (38.2 MB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Preparing metadata (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [187 lines of output]
            setup.py:486: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /private/var/folders/v2/7wf2b26s6m50wcsqxl2q18gh0000gn/T/pip-modern-metadata-2gzh39dg'), proceeding with generating Cython sources and expanding templates
              warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
            Running from SciPy source directory.
            Running scipy/linalg/_generate_pyx.py
            Running scipy/special/_generate_pyx.py
            Running scipy/stats/_generate_pyx.py
            Processing scipy/cluster/_vq.pyx
            Processing scipy/cluster/_optimal_leaf_ordering.pyx
            Processing scipy/cluster/_hierarchy.pyx
            Processing scipy/ndimage/src/_cytest.pyx
            Processing scipy/ndimage/src/_ni_label.pyx
            Processing scipy/linalg/cython_lapack.pyx
            Processing scipy/linalg/_matfuncs_sqrtm_triu.pyx
            Processing scipy/linalg/_cythonized_array_utils.pyx
            Processing scipy/linalg/_solve_toeplitz.pyx
            Processing scipy/linalg/cython_blas.pyx
            Processing scipy/linalg/_decomp_update.pyx.in
            Processing scipy/optimize/_group_columns.pyx
            Processing scipy/optimize/_bglu_dense.pyx
            Processing scipy/optimize/_trlib/_trlib.pyx
            Processing scipy/optimize/_highs/cython/src/_highs_constants.pyx
            Processing scipy/optimize/_highs/cython/src/_highs_wrapper.pyx
            Processing scipy/optimize/_lsq/givens_elimination.pyx
            Processing scipy/optimize/cython_optimize/_zeros.pyx.in
            Processing scipy/optimize/tnc/_moduleTNC.pyx
            Processing scipy/io/matlab/_streams.pyx
            Processing scipy/io/matlab/_mio_utils.pyx
            Processing scipy/io/matlab/_mio5_utils.pyx
            Processing scipy/_lib/_ccallback_c.pyx
            Processing scipy/_lib/_test_deprecation_def.pyx
            Processing scipy/_lib/_test_deprecation_call.pyx
            Processing scipy/_lib/messagestream.pyx
            Processing scipy/special/_ufuncs_cxx.pyx
            Processing scipy/special/cython_special.pyx
            Processing scipy/special/_ellip_harm_2.pyx
            Processing scipy/special/_comb.pyx
            Processing scipy/special/_test_round.pyx
            Processing scipy/special/_ufuncs.pyx
            Processing scipy/fftpack/convolve.pyx
            Processing scipy/interpolate/interpnd.pyx
            Processing scipy/interpolate/_bspl.pyx
            Processing scipy/interpolate/_ppoly.pyx
            Processing scipy/sparse/_csparsetools.pyx.in
            Processing scipy/sparse/csgraph/_shortest_path.pyx
            Processing scipy/sparse/csgraph/_traversal.pyx
            Processing scipy/sparse/csgraph/_flow.pyx
            Processing scipy/sparse/csgraph/_tools.pyx
            Processing scipy/sparse/csgraph/_matching.pyx
            Processing scipy/sparse/csgraph/_reordering.pyx
            Processing scipy/sparse/csgraph/_min_spanning_tree.pyx
            Processing scipy/spatial/_qhull.pyx
            Processing scipy/spatial/_ckdtree.pyx
            Processing scipy/spatial/_voronoi.pyx
            Processing scipy/spatial/_hausdorff.pyx
            Processing scipy/spatial/transform/_rotation.pyx
            Processing scipy/signal/_max_len_seq_inner.pyx
            Processing scipy/signal/_peak_finding_utils.pyx
            Processing scipy/signal/_upfirdn_apply.pyx
            Processing scipy/signal/_spectral.pyx
            Processing scipy/signal/_sosfilt.pyx
            Processing scipy/stats/_stats.pyx
            Processing scipy/stats/_qmc_cy.pyx
            Processing scipy/stats/_biasedurn.pyx
            Processing scipy/stats/_sobol.pyx
            Processing scipy/stats/_boost/src/beta_ufunc.pyx
            Processing scipy/stats/_boost/src/nbinom_ufunc.pyx
            Processing scipy/stats/_boost/src/hypergeom_ufunc.pyx
            Processing scipy/stats/_boost/src/binom_ufunc.pyx
            Processing scipy/stats/_unuran/unuran_wrapper.pyx
            warning: unuran_wrapper.pyx:470:21: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
            warning: unuran_wrapper.pyx:470:28: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
            warning: unuran_wrapper.pyx:470:36: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
            warning: unuran_wrapper.pyx:515:21: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
            warning: unuran_wrapper.pyx:515:28: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
            warning: unuran_wrapper.pyx:515:36: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
            warning: unuran_wrapper.pyx:1469:21: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
            warning: unuran_wrapper.pyx:1469:28: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
            warning: unuran_wrapper.pyx:1469:36: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
            /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/config/_apply_pyprojecttoml.py:196: UserWarning: `install_requires` overwritten in `pyproject.toml` (dependencies)
              warnings.warn(msg)
            Cythonizing sources
            lapack_opt_info:
            lapack_mkl_info:
            customize UnixCCompiler
              libraries mkl_rt not found in ['/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
              NOT AVAILABLE
      
            openblas_lapack_info:
              libraries openblas not found in ['/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
              NOT AVAILABLE
      
            openblas_clapack_info:
              libraries openblas,lapack not found in ['/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
              NOT AVAILABLE
      
            flame_info:
              libraries flame not found in ['/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
              NOT AVAILABLE
      
            atlas_3_10_threads_info:
            Setting PTATLAS=ATLAS
              libraries lapack_atlas not found in /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib
              libraries tatlas,tatlas not found in /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib
              libraries lapack_atlas not found in /usr/local/lib
              libraries tatlas,tatlas not found in /usr/local/lib
              libraries lapack_atlas not found in /usr/lib
              libraries tatlas,tatlas not found in /usr/lib
            <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
              NOT AVAILABLE
      
            atlas_3_10_info:
              libraries lapack_atlas not found in /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib
              libraries satlas,satlas not found in /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib
              libraries lapack_atlas not found in /usr/local/lib
              libraries satlas,satlas not found in /usr/local/lib
              libraries lapack_atlas not found in /usr/lib
              libraries satlas,satlas not found in /usr/lib
            <class 'numpy.distutils.system_info.atlas_3_10_info'>
              NOT AVAILABLE
      
            atlas_threads_info:
            Setting PTATLAS=ATLAS
              libraries lapack_atlas not found in /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib
              libraries ptf77blas,ptcblas,atlas not found in /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib
              libraries lapack_atlas not found in /usr/local/lib
              libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
              libraries lapack_atlas not found in /usr/lib
              libraries ptf77blas,ptcblas,atlas not found in /usr/lib
            <class 'numpy.distutils.system_info.atlas_threads_info'>
              NOT AVAILABLE
      
            atlas_info:
              libraries lapack_atlas not found in /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib
              libraries f77blas,cblas,atlas not found in /opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib
              libraries lapack_atlas not found in /usr/local/lib
              libraries f77blas,cblas,atlas not found in /usr/local/lib
              libraries lapack_atlas not found in /usr/lib
              libraries f77blas,cblas,atlas not found in /usr/lib
            <class 'numpy.distutils.system_info.atlas_info'>
              NOT AVAILABLE
      
            lapack_info:
              libraries lapack not found in ['/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib']
              NOT AVAILABLE
      
            /private/var/folders/v2/7wf2b26s6m50wcsqxl2q18gh0000gn/T/pip-build-env-zph8xyrx/overlay/lib/python3.9/site-packages/numpy/distutils/system_info.py:1849: 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))()
            lapack_src_info:
              NOT AVAILABLE
      
            /private/var/folders/v2/7wf2b26s6m50wcsqxl2q18gh0000gn/T/pip-build-env-zph8xyrx/overlay/lib/python3.9/site-packages/numpy/distutils/system_info.py:1849: 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))()
              NOT AVAILABLE
      
            Traceback (most recent call last):
              File "/var/folders/v2/7wf2b26s6m50wcsqxl2q18gh0000gn/T/tmp9s9e9n6f_in_process.py", line 363, in <module>
                main()
              File "/var/folders/v2/7wf2b26s6m50wcsqxl2q18gh0000gn/T/tmp9s9e9n6f_in_process.py", line 345, in main
                json_out['return_val'] = hook(**hook_input['kwargs'])
              File "/var/folders/v2/7wf2b26s6m50wcsqxl2q18gh0000gn/T/tmp9s9e9n6f_in_process.py", line 164, in prepare_metadata_for_build_wheel
                return hook(metadata_directory, config_settings)
              File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/build_meta.py", line 188, in prepare_metadata_for_build_wheel
                self.run_setup()
              File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/build_meta.py", line 281, in run_setup
                super(_BuildMetaLegacyBackend,
              File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/build_meta.py", line 174, in run_setup
                exec(compile(code, __file__, 'exec'), locals())
              File "setup.py", line 628, in <module>
                setup_package()
              File "setup.py", line 624, in setup_package
                setup(**metadata)
              File "/private/var/folders/v2/7wf2b26s6m50wcsqxl2q18gh0000gn/T/pip-build-env-zph8xyrx/overlay/lib/python3.9/site-packages/numpy/distutils/core.py", line 135, in setup
                config = configuration()
              File "setup.py", line 526, 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.
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: metadata-generation-failed
      
      × Encountered error while generating package metadata.
      ╰─> See above for output.

I am running it on my macbook m1 air. Tried installing it on Google Collab and it works over there. Is it a mac specific issue? Any solution to this problem will help. I have also tried 'pip install flair'

  • Is lapack installed? Have you tried installing it though brew or [macports](https://ports.macports.org/port/lapack/) first? That seems to be where pip is upset. Then sometimes you need to tell pip where source libraries are. Mind you this could be M1 specific. – JL Peyret Jul 05 '22 at 06:26
  • This is an example of letting pip “know where things are”. https://stackoverflow.com/a/70439868 Maybe this helps in case no one else is more specific about your problem. Hopefully somebody will have a better idea. Welcome aboard. – JL Peyret Jul 05 '22 at 06:35
  • Building SciPy seems to be the problem. But there exist binary packages for Apple ARM, so you should be able to install it. Try with `python3.9 -m pip install scipy --only-binary=:all:`. If that works, you should be able to install flair. – 9769953 Jul 05 '22 at 08:54
  • @9769953 now I am getting a different error: " Building wheel for tokenizers (pyproject.toml) did not run successfully." – Aditya Mishra Jul 05 '22 at 12:24
  • Is that error when you install the binary version of scipy? – 9769953 Jul 05 '22 at 13:47
  • Running "brew install cmake; brew install gperftools; brew install pkg-config" on the default terminal fixed it for me. See https://github.com/google/sentencepiece/issues/378. – Tom J Nov 24 '22 at 03:49

0 Answers0