简体   繁体   中英

Pip hangs and errors out when installing sklearn

I just got a new M1 Max MacBook Pro and I'm trying to install some essential python libraries to it. Pandas installed just fine but sklearn hangs really bad and then gives a massive error.

What I've tried: pip3 install sklearn and pip install sklearn
The error message is UNBELIEVABLY long. Here is the last seemingly parsable part of it:

/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/system_info.py:1858: 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 "<string>", line 1, in <module>
        File "/private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-install-bq_6j9py/scipy_f3e554e9307743fd9a601d545335a0a7/setup.py", line 492, in <module>
          setup_package()
        File "/private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-install-bq_6j9py/scipy_f3e554e9307743fd9a601d545335a0a7/setup.py", line 488, in setup_package
          setup(**metadata)
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/distutils/core.py", line 135, in setup
          config = configuration()
        File "/private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-install-bq_6j9py/scipy_f3e554e9307743fd9a601d545335a0a7/setup.py", line 395, in configuration
          raise NotFoundError(msg)
      numpy.distutils.system_info.NotFoundError: No lapack/blas resources found. Note: Accelerate is no longer supported.

      ----------------------------------------
      ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-install-bq_6j9py/scipy_f3e554e9307743fd9a601d545335a0a7/setup.py'"'"'; __file__='"'"'/private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-install-bq_6j9py/scipy_f3e554e9307743fd9a601d545335a0a7/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-record-_r3hwab1/install-record.txt --single-version-externally-managed --prefix /private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-build-env-4qfk0eep/overlay --compile --install-headers /private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-build-env-4qfk0eep/overlay/include/python3.10/scipy Check the logs for full command output.
      ----------------------------------------
    WARNING: Discarding https://files.pythonhosted.org/packages/62/7c/596ff7b32f655f379d3abdfa82607e5cb3b70f46baad4604706511cfeb85/scikit-learn-1.0.1.tar.gz#sha256=ac2ca9dbb754d61cfe1c83ba8483498ef951d29b93ec09d6f002847f210a99da (from https://pypi.org/simple/scikit-learn/) (requires-python:>=3.7). Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 /private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-standalone-pip-ij4zyayw/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /private/var/folders/tc/fyyvwny94vxbjt8jkbh3dsw80000gn/T/pip-build-env-4qfk0eep/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.28.5' 'oldest-supported-numpy; python_version!='"'"'3.7'"'"' or platform_machine=='"'"'aarch64'"'"' or platform_system=='"'"'AIX'"'"' or platform_python_implementation == '"'"'PyPy'"'"'' 'numpy==1.14.6; python_version=='"'"'3.7'"'"' and platform_machine!='"'"'aarch64'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'scipy>=1.1.0' Check the logs for full command output.
      Using cached scikit-learn-1.0.tar.gz (7.8 MB)
      Installing build dependencies ... /

As you can see at the bottom, it tries to continue with no success.

Solved by using pip install sci-kitlearn instead of sklearn . Sorry, could have sworn it was sklearn !

I am facing same problem on python 3.10+ and 3.9+ version

Then I switch python version 3.8+ and its working fine

If your using conda then you can simply create a new environment

conda create -n yourenvname python=3.8

Then Activate your new environment

conda actiavate yourenvname 

Then Install sklearn:

pip install sci-kitlearn

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM