Sklearn is an open source Python library that implements a range of machine learning, preprocessing, cross-validation and visualization algorithms. To analyze data with machine learning, sklearn is often used to approach. Although I already have experience installing sklearn library on Windows, this time I encountered problems installing on my new computer.
Problem 1. pip install sklearn/scipy failed
$ pip install sklearn
failed building wheel for scikit-learn
So I check the requirements on the sklearn official site and found that I didn’t install scipy before.
Scikit-learn requires:
Python (>= 2.6 or >= 3.3),
NumPy (>= 1.6.1),
SciPy (>= 0.9).
Since sklearn needs the dependency of scipy
, I need to install scipy before installing sklearn. However, teh same error occurs.
$ pip install sklearn
failed building wheel for scikit-learn
To solve this problem, I need to download the needed wheel manually and install it by the following command:
$ pip install <filename>.whl
- Python Wheels Download Sites
- Numpy
- Scipy
- Sklearn
Problem 2. filename.whl
is not a supported wheel on this platform
To check which version of wheel should be downloaded and installed, you can input the following python commands in shell:
>>> import pip;
>>> print(pip.pep425tags.get_supported())
[('cp36', 'cp36m', 'win32'), ('cp36', 'none', 'win32'), ('py3', 'none', 'win32'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('py36', 'none', 'any'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')][('cp36', 'cp36m', 'win32'), ('cp36', 'none', 'win32'), ('py3', 'none', 'win32'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('py36', 'none', 'any'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')][('cp36', 'cp36m', 'win32'), ('cp36', 'none', 'win32'), ('py3', 'none', 'win32'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('py36', 'none', 'any'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]
Make sure that every tag section(separated by ‘-‘) in your wheel file name is included in the supported tags.
Successfully Installed
After install numpy, scipy, and sklearn respectively from wheel, sklearn is successfully installed.
$ pip install numpy-1.12.1+mkl-cp36-cp36m-win32.whl
$ pip install scipy-0.19.0-cp36-cp36m-win32.whl
$ pip install scikit_learn-0.18.1-cp36-cp36m-win32.whl
Issue
I want to get into ML and am trying to install scikit via pip.
I have pandas, numpy and scipy installed and can use them.
I also have cython installed.
I am using the latest python version 3.10.1.
I upgraded the setuptools and did the same for pip.
For my project its important to use opensource libaries.
What am I missing?
Many Thanks in advance.
The following messages I get:
C:Usersmorit>pip install scikit-learn
Collecting scikit-learn
Using cached scikit-learn-1.0.1.tar.gz (6.6 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
After installing Microsoft Visiual C++ latest version. Unfortunate I still can not install scikit.
C:Usersmorit>pip install scikit-learn
Collecting scikit-learn
Using cached scikit-learn-1.0.1.tar.gz (6.6 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: 'C:UsersmoritAppDataLocalProgramsPythonPython310python.exe' 'C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py' prepare_metadata_for_build_wheel 'C:UsersmoritAppDataLocalTemptmpwrdv342v'
cwd: C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_7638cf0d3e734f2d96e709bd91706393
Complete output (56 lines):
Partial import of sklearn during the build process.
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj
test_program.c
test_program.c(1): fatal error C1083: Datei (Include) kann nicht ge”ffnet werden: "stdio.h": No such file or directory
Traceback (most recent call last):
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 401, in compile
self.spawn(args)
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 507, in spawn
return super().spawn(cmd)
File "C:UsersmoritAppDataLocalTemppip-build-env-o9bfbedmoverlayLibsite-packagesnumpydistutilsccompiler.py", line 88, in <lambda>
m = lambda self, *args, **kw: func(self, *args, **kw)
File "C:UsersmoritAppDataLocalTemppip-build-env-o9bfbedmoverlayLibsite-packagesnumpydistutilsccompiler.py", line 171, in CCompiler_spawn
raise DistutilsExecError('Command "%s" failed with exit status %d%s' %
distutils.errors.DistutilsExecError: Command "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj" failed with exit status 2
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 363, in <module>
main()
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 164, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "C:UsersmoritAppDataLocalTemppip-build-env-o9bfbedmoverlayLibsite-packagessetuptoolsbuild_meta.py", line 174, in prepare_metadata_for_build_wheel
self.run_setup()
File "C:UsersmoritAppDataLocalTemppip-build-env-o9bfbedmoverlayLibsite-packagessetuptoolsbuild_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "C:UsersmoritAppDataLocalTemppip-build-env-o9bfbedmoverlayLibsite-packagessetuptoolsbuild_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 319, in <module>
setup_package()
File "setup.py", line 315, in setup_package
setup(**metadata)
File "C:UsersmoritAppDataLocalTemppip-build-env-o9bfbedmoverlayLibsite-packagesnumpydistutilscore.py", line 135, in setup
config = configuration()
File "setup.py", line 201, in configuration
config.add_subpackage("sklearn")
File "C:UsersmoritAppDataLocalTemppip-build-env-o9bfbedmoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 1016, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "C:UsersmoritAppDataLocalTemppip-build-env-o9bfbedmoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 982, in get_subpackage
config = self._get_configuration_from_setup_py(
File "C:UsersmoritAppDataLocalTemppip-build-env-o9bfbedmoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 924, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "sklearnsetup.py", line 85, in configuration
cythonize_extensions(top_path, config)
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_7638cf0d3e734f2d96e709bd91706393sklearn_build_utils__init__.py", line 47, in cythonize_extensions
basic_check_build()
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_7638cf0d3e734f2d96e709bd91706393sklearn_build_utilspre_build_helpers.py", line 113, in basic_check_build
compile_test_program(code)
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_7638cf0d3e734f2d96e709bd91706393sklearn_build_utilspre_build_helpers.py", line 70, in compile_test_program
ccompiler.compile(
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 403, in compile
raise CompileError(msg)
distutils.errors.CompileError: Command "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj" failed with exit status 2
----------------------------------------
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: 'C:UsersmoritAppDataLocalProgramsPythonPython310python.exe' 'C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py' prepare_metadata_for_build_wheel 'C:UsersmoritAppDataLocalTemptmpwrdv342v' Check the logs for full command output.
Using cached scikit-learn-1.0.tar.gz (7.8 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: 'C:UsersmoritAppDataLocalProgramsPythonPython310python.exe' 'C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py' prepare_metadata_for_build_wheel 'C:UsersmoritAppDataLocalTemptmpfrvhwkio'
cwd: C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_6f5ce3b939c44daebde31f82bdc425f1
Complete output (56 lines):
Partial import of sklearn during the build process.
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj
test_program.c
test_program.c(1): fatal error C1083: Datei (Include) kann nicht ge”ffnet werden: "stdio.h": No such file or directory
Traceback (most recent call last):
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 401, in compile
self.spawn(args)
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 507, in spawn
return super().spawn(cmd)
File "C:UsersmoritAppDataLocalTemppip-build-env-pyad4_ysoverlayLibsite-packagesnumpydistutilsccompiler.py", line 88, in <lambda>
m = lambda self, *args, **kw: func(self, *args, **kw)
File "C:UsersmoritAppDataLocalTemppip-build-env-pyad4_ysoverlayLibsite-packagesnumpydistutilsccompiler.py", line 171, in CCompiler_spawn
raise DistutilsExecError('Command "%s" failed with exit status %d%s' %
distutils.errors.DistutilsExecError: Command "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj" failed with exit status 2
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 363, in <module>
main()
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 164, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "C:UsersmoritAppDataLocalTemppip-build-env-pyad4_ysoverlayLibsite-packagessetuptoolsbuild_meta.py", line 174, in prepare_metadata_for_build_wheel
self.run_setup()
File "C:UsersmoritAppDataLocalTemppip-build-env-pyad4_ysoverlayLibsite-packagessetuptoolsbuild_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "C:UsersmoritAppDataLocalTemppip-build-env-pyad4_ysoverlayLibsite-packagessetuptoolsbuild_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 319, in <module>
setup_package()
File "setup.py", line 315, in setup_package
setup(**metadata)
File "C:UsersmoritAppDataLocalTemppip-build-env-pyad4_ysoverlayLibsite-packagesnumpydistutilscore.py", line 135, in setup
config = configuration()
File "setup.py", line 201, in configuration
config.add_subpackage("sklearn")
File "C:UsersmoritAppDataLocalTemppip-build-env-pyad4_ysoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 1016, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "C:UsersmoritAppDataLocalTemppip-build-env-pyad4_ysoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 982, in get_subpackage
config = self._get_configuration_from_setup_py(
File "C:UsersmoritAppDataLocalTemppip-build-env-pyad4_ysoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 924, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "sklearnsetup.py", line 85, in configuration
cythonize_extensions(top_path, config)
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_6f5ce3b939c44daebde31f82bdc425f1sklearn_build_utils__init__.py", line 47, in cythonize_extensions
basic_check_build()
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_6f5ce3b939c44daebde31f82bdc425f1sklearn_build_utilspre_build_helpers.py", line 113, in basic_check_build
compile_test_program(code)
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_6f5ce3b939c44daebde31f82bdc425f1sklearn_build_utilspre_build_helpers.py", line 70, in compile_test_program
ccompiler.compile(
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 403, in compile
raise CompileError(msg)
distutils.errors.CompileError: Command "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj" failed with exit status 2
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/e1/4d/15c3542a17eebf61e48bd71dc55b5f3b5031f1cd0dc4aad1ff9ac9651e49/scikit-learn-1.0.tar.gz#sha256=776800194e757cd212b47cd05907e0eb67a554ad333fe76776060dbb729e3427 (from https://pypi.org/simple/scikit-learn/) (requires-python:>=3.7). Command errored out with exit status 1: 'C:UsersmoritAppDataLocalProgramsPythonPython310python.exe' 'C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py' prepare_metadata_for_build_wheel 'C:UsersmoritAppDataLocalTemptmpfrvhwkio' Check the logs for full command output.
Using cached scikit-learn-0.24.2.tar.gz (7.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: 'C:UsersmoritAppDataLocalProgramsPythonPython310python.exe' 'C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py' prepare_metadata_for_build_wheel 'C:UsersmoritAppDataLocalTemptmpncoezmhd'
cwd: C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_52d98203cf264f69aa4bc128ae995672
Complete output (56 lines):
Partial import of sklearn during the build process.
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj
test_program.c
test_program.c(1): fatal error C1083: Datei (Include) kann nicht ge”ffnet werden: "stdio.h": No such file or directory
Traceback (most recent call last):
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 401, in compile
self.spawn(args)
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 507, in spawn
return super().spawn(cmd)
File "C:UsersmoritAppDataLocalTemppip-build-env-vyx5hgpqoverlayLibsite-packagesnumpydistutilsccompiler.py", line 88, in <lambda>
m = lambda self, *args, **kw: func(self, *args, **kw)
File "C:UsersmoritAppDataLocalTemppip-build-env-vyx5hgpqoverlayLibsite-packagesnumpydistutilsccompiler.py", line 171, in CCompiler_spawn
raise DistutilsExecError('Command "%s" failed with exit status %d%s' %
distutils.errors.DistutilsExecError: Command "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj" failed with exit status 2
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 363, in <module>
main()
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 164, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "C:UsersmoritAppDataLocalTemppip-build-env-vyx5hgpqoverlayLibsite-packagessetuptoolsbuild_meta.py", line 174, in prepare_metadata_for_build_wheel
self.run_setup()
File "C:UsersmoritAppDataLocalTemppip-build-env-vyx5hgpqoverlayLibsite-packagessetuptoolsbuild_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "C:UsersmoritAppDataLocalTemppip-build-env-vyx5hgpqoverlayLibsite-packagessetuptoolsbuild_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 301, in <module>
setup_package()
File "setup.py", line 297, in setup_package
setup(**metadata)
File "C:UsersmoritAppDataLocalTemppip-build-env-vyx5hgpqoverlayLibsite-packagesnumpydistutilscore.py", line 135, in setup
config = configuration()
File "setup.py", line 188, in configuration
config.add_subpackage('sklearn')
File "C:UsersmoritAppDataLocalTemppip-build-env-vyx5hgpqoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 1016, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "C:UsersmoritAppDataLocalTemppip-build-env-vyx5hgpqoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 982, in get_subpackage
config = self._get_configuration_from_setup_py(
File "C:UsersmoritAppDataLocalTemppip-build-env-vyx5hgpqoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 924, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "sklearnsetup.py", line 83, in configuration
cythonize_extensions(top_path, config)
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_52d98203cf264f69aa4bc128ae995672sklearn_build_utils__init__.py", line 45, in cythonize_extensions
basic_check_build()
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_52d98203cf264f69aa4bc128ae995672sklearn_build_utilspre_build_helpers.py", line 106, in basic_check_build
compile_test_program(code)
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_52d98203cf264f69aa4bc128ae995672sklearn_build_utilspre_build_helpers.py", line 66, in compile_test_program
ccompiler.compile(['test_program.c'], output_dir='objects',
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 403, in compile
raise CompileError(msg)
distutils.errors.CompileError: Command "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj" failed with exit status 2
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/05/04/507280f20fafc8bc94b41e0592938c6f4a910d0e066be7c8ff1299628f5d/scikit-learn-0.24.2.tar.gz#sha256=d14701a12417930392cd3898e9646cf5670c190b933625ebe7511b1f7d7b8736 (from https://pypi.org/simple/scikit-learn/) (requires-python:>=3.6). Command errored out with exit status 1: 'C:UsersmoritAppDataLocalProgramsPythonPython310python.exe' 'C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py' prepare_metadata_for_build_wheel 'C:UsersmoritAppDataLocalTemptmpncoezmhd' Check the logs for full command output.
Using cached scikit-learn-0.24.1.tar.gz (7.4 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting threadpoolctl>=2.0.0
Using cached threadpoolctl-3.0.0-py3-none-any.whl (14 kB)
Requirement already satisfied: scipy>=0.19.1 in c:usersmoritappdatalocalprogramspythonpython310libsite-packages (from scikit-learn) (1.7.3)
Collecting joblib>=0.11
Using cached joblib-1.1.0-py2.py3-none-any.whl (306 kB)
Requirement already satisfied: numpy>=1.13.3 in c:usersmoritappdatalocalprogramspythonpython310libsite-packages (from scikit-learn) (1.21.4)
Building wheels for collected packages: scikit-learn
Building wheel for scikit-learn (pyproject.toml) ... error
ERROR: Command errored out with exit status 1:
command: 'C:UsersmoritAppDataLocalProgramsPythonPython310python.exe' 'C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py' build_wheel 'C:UsersmoritAppDataLocalTemptmpglardw38'
cwd: C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_81eb5676473f436f8db81ae9696fde4d
Complete output (58 lines):
Partial import of sklearn during the build process.
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj
test_program.c
test_program.c(1): fatal error C1083: Datei (Include) kann nicht ge”ffnet werden: "stdio.h": No such file or directory
Traceback (most recent call last):
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 401, in compile
self.spawn(args)
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 507, in spawn
return super().spawn(cmd)
File "C:UsersmoritAppDataLocalTemppip-build-env-bst370zdoverlayLibsite-packagesnumpydistutilsccompiler.py", line 88, in <lambda>
m = lambda self, *args, **kw: func(self, *args, **kw)
File "C:UsersmoritAppDataLocalTemppip-build-env-bst370zdoverlayLibsite-packagesnumpydistutilsccompiler.py", line 171, in CCompiler_spawn
raise DistutilsExecError('Command "%s" failed with exit status %d%s' %
distutils.errors.DistutilsExecError: Command "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj" failed with exit status 2
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 363, in <module>
main()
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:UsersmoritAppDataLocalProgramsPythonPython310libsite-packagespip_vendorpep517in_process_in_process.py", line 261, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "C:UsersmoritAppDataLocalTemppip-build-env-bst370zdoverlayLibsite-packagessetuptoolsbuild_meta.py", line 230, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "C:UsersmoritAppDataLocalTemppip-build-env-bst370zdoverlayLibsite-packagessetuptoolsbuild_meta.py", line 215, in _build_with_temp_dir
self.run_setup()
File "C:UsersmoritAppDataLocalTemppip-build-env-bst370zdoverlayLibsite-packagessetuptoolsbuild_meta.py", line 267, in run_setup
super(_BuildMetaLegacyBackend,
File "C:UsersmoritAppDataLocalTemppip-build-env-bst370zdoverlayLibsite-packagessetuptoolsbuild_meta.py", line 158, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 306, in <module>
setup_package()
File "setup.py", line 302, in setup_package
setup(**metadata)
File "C:UsersmoritAppDataLocalTemppip-build-env-bst370zdoverlayLibsite-packagesnumpydistutilscore.py", line 135, in setup
config = configuration()
File "setup.py", line 188, in configuration
config.add_subpackage('sklearn')
File "C:UsersmoritAppDataLocalTemppip-build-env-bst370zdoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 1016, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "C:UsersmoritAppDataLocalTemppip-build-env-bst370zdoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 982, in get_subpackage
config = self._get_configuration_from_setup_py(
File "C:UsersmoritAppDataLocalTemppip-build-env-bst370zdoverlayLibsite-packagesnumpydistutilsmisc_util.py", line 924, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "sklearnsetup.py", line 83, in configuration
cythonize_extensions(top_path, config)
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_81eb5676473f436f8db81ae9696fde4dsklearn_build_utils__init__.py", line 45, in cythonize_extensions
basic_check_build()
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_81eb5676473f436f8db81ae9696fde4dsklearn_build_utilspre_build_helpers.py", line 106, in basic_check_build
compile_test_program(code)
File "C:UsersmoritAppDataLocalTemppip-install-g1j5fcmiscikit-learn_81eb5676473f436f8db81ae9696fde4dsklearn_build_utilspre_build_helpers.py", line 66, in compile_test_program
ccompiler.compile(['test_program.c'], output_dir='objects',
File "C:UsersmoritAppDataLocalProgramsPythonPython310libdistutils_msvccompiler.py", line 403, in compile
raise CompileError(msg)
distutils.errors.CompileError: Command "C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.30.30705include /Tctest_program.c /Foobjectstest_program.obj" failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for scikit-learn
Failed to build scikit-learn
ERROR: Could not build wheels for scikit-learn, which is required to install pyproject.toml-based projects
Solution
You have to fix this error:
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
You can fix it by following these links:
Visual Studio Tools
Microsoft Visual C++ Redistributable Latest Supported Downloads
Answered By — Thekingis007
ERROR: Command errored out with exit status 1:
command: 'c:usersessaappdatalocalprogramspythonpython39python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Essa\AppData\Local\Temp\pip-install-pfs4kvqz\kiwisolver\setup.py'"'"'; __file__='"'"'C:\Users\Essa\AppData\Local\Temp\pip-install-pfs4kvqz\kiwisolver\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:UsersEssaAppDataLocalTemppip-pip-egg-info-32z60gh3'
cwd: C:UsersEssaAppDataLocalTemppip-install-pfs4kvqzkiwisolver
Complete output (44 lines):
WARNING: The wheel package is not available.
ERROR: Command errored out with exit status 1:
command: 'c:usersessaappdatalocalprogramspythonpython39python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Essa\AppData\Local\Temp\pip-wheel-0tfb7rx6\cppy\setup.py'"'"'; __file__='"'"'C:\Users\Essa\AppData\Local\Temp\pip-wheel-0tfb7rx6\cppy\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersEssaAppDataLocalTemppip-wheel-opuxdhh5'
cwd: C:UsersEssaAppDataLocalTemppip-wheel-0tfb7rx6cppy
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for cppy
ERROR: Failed to build one or more wheels
Traceback (most recent call last):
File "c:usersessaappdatalocalprogramspythonpython39libsite-packagessetuptoolsinstaller.py", line 128, in fetch_build_egg
subprocess.check_call(cmd)
File "c:usersessaappdatalocalprogramspythonpython39libsubprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['c:\users\essa\appdata\local\programs\python\python39\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\Users\Essa\AppData\Local\Temp\tmp0z8qlgha', '--quiet', 'cppy>=1.1.0']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:UsersEssaAppDataLocalTemppip-install-pfs4kvqzkiwisolversetup.py", line 59, in <module>
setup(
File "c:usersessaappdatalocalprogramspythonpython39libsite-packagessetuptools__init__.py", line 164, in setup
_install_setup_requires(attrs)
File "c:usersessaappdatalocalprogramspythonpython39libsite-packagessetuptools__init__.py", line 159, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "c:usersessaappdatalocalprogramspythonpython39libsite-packagessetuptoolsdist.py", line 699, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "c:usersessaappdatalocalprogramspythonpython39libsite-packagespkg_resources__init__.py", line 779, in resolve
dist = best[req.key] = env.best_match(
File "c:usersessaappdatalocalprogramspythonpython39libsite-packagespkg_resources__init__.py", line 1064, in best_match
return self.obtain(req, installer)
File "c:usersessaappdatalocalprogramspythonpython39libsite-packagespkg_resources__init__.py", line 1076, in obtain
return installer(requirement)
File "c:usersessaappdatalocalprogramspythonpython39libsite-packagessetuptoolsdist.py", line 758, in fetch_build_egg
return fetch_build_egg(self, req)
File "c:usersessaappdatalocalprogramspythonpython39libsite-packagessetuptoolsinstaller.py", line 130, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['c:\users\essa\appdata\local\programs\python\python39\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\Users\Essa\AppData\Local\Temp\tmp0z8qlgha', '--quiet', 'cppy>=1.1.0']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
This topic has been deleted. Only users with topic management privileges can see it.
@sreu13 said in leaf disease detection using keras:
AttributeError: ‘LabelBinarizer’ object has no attribute ‘classes_’
Hi, Can you try downgrade the scikit by typing
pip install scikit-learn==0.15.2
and are you following any guide or something, if yes can you share that also?
@salmanfaris said in leaf disease detection using keras:
pip install scikit-learn==0.15.2
tried downgrading, but came up with this error.
ERROR: Failed building wheel for scikit-learn
and I’ve been following Kaggle kernel,
link-https://www.kaggle.com/emmarex/plant-disease-detection-using-keras
I think you need to use the fit or fit_transform function before you predict the classes and use the Binarizer. Have a look at scikit’s official documentation for the same.
@SuperGops
i’ve entered this code,
def fit_transform(self, n_classes):
but as I run it, I get the indentation Error given below
File»C:/Users/admin/Desktop/plant_disease_classification/plant_disease_classification/untitled1.py», line 42
label_binarizer = LabelBinarizer()
^
IndentationError: expected an indented block
@sreu13
fit and fit_transform are actually inbuilt functions found in the scikit-learn library. So I’d suggest you fit your model with the available data using those functions whose application can be found on scikit-learn’s documentation and then proceed with the Binarizer.
@SuperGops
so basically ,i’ll have to restart and retrain the model with fit_transform?
Could you please follow my steps:
- Uninstall your current Python 3.7 version
- Install Python 3.6.5
- If you are using spyder editor make a change to vscode.
- Go to integrated terminal of vscode and create a virtual environment
python -m venv venv
- Activate your virtual environment
.venvScriptsactivate
- Create a requirements.txt over your current working directory. Contents for requirements.txt given below:
h5py==2.8.0
imutils==0.5.1
Keras==2.2.4
Keras-Applications==1.0.6
Keras-Preprocessing==1.0.5
kiwisolver==1.0.1
matplotlib==3.0.2
numpy==1.15.3
opencv-contrib-python==3.4.3.18
Pillow==5.3.0
PyWavelets==1.0.1
scikit-image==0.14.1
scikit-learn==0.20.0
scipy==1.1.0
six==1.11.0
sklearn==0.0
tensorboard==1.12.0
tensorflow==1.12.0
termcolor==1.1.0
toolz==0.9.0
- Then install necessary packages using requirements.txt file
pip install -r requirements.txt
- Then run your code within this venv and say what happened as reply here.
@SuperGops
i also have another pickle file «label_transform», which I got as an output from referring the initial code from gaggle, is there any use of this file?
label_binarizer = LabelBinarizer()
image_labels = label_binarizer.fit_transform(label_list)
pickle.dump(label_binarizer,open('label_transform.pkl', 'wb'))
n_classes = len(label_binarizer.classes_)
Kaggle >https://www.kaggle.com/emmarex/plant-disease-detection-using-keras/data
@arunksoman
i’ll follow this proceedure, but would I be able to deploy this code in raspberry pi 4?