Whenever I pip install mlrose, it is showing me the following error. I am new to machine learning, so a detailed explaination will be appreciated.
Microsoft Windows [Version 10.0.17134.1069] (c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\admin>pip install mlrose
Collecting mlrose
Using cached https://files.pythonhosted.org/packages/0d/f8/79e77a40f6e8988e3ecc9ead8a28024ee43df9c99fce2209037c9e6f9e4a/mlrose-1.3.0-py3-none-any.whl
Requirement already satisfied: scipy in c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages (from mlrose) (1.3.2)
Requirement already satisfied: numpy in c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages (from mlrose) (1.17.4)
Processing c:\users\admin\appdata\local\pip\cache\wheels\76\03\bb\589d421d27431bcd2c6da284d5f2286c8e3b2ea3cf1594c074\sklearn-0.0-py2.py3-none-any.whl
Collecting scikit-learn
Using cached https://files.pythonhosted.org/packages/1e/ce/9d8c88e68af0a5b5c5d78d8d2b7bcadfd45e1d6afc863ccb9aee30765b06/scikit-learn-0.21.3.tar.gz
Requirement already satisfied: joblib>=0.11 in c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages (from scikit-learn->sklearn->mlrose) (0.14.0)
Building wheels for collected packages: scikit-learn
Building wheel for scikit-learn (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\admin\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-install-8ooeas1k\\scikit-learn\\setup.py'"'"'; __file__='"'"'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-install-8ooeas1k\\scikit-learn\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-wheel-jm5hdzgz' --python-tag cp38
cwd: C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\
Complete output (37 lines):
Partial import of sklearn during the build process.
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\setup.py", line 290, in <module>
setup_package()
File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\setup.py", line 286, in setup_package
setup(**metadata)
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\numpy\distutils\core.py", line 137, in setup
config = configuration()
File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\setup.py", line 174, in configuration
config.add_subpackage('sklearn')
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\numpy\distutils\misc_util.py", line 1033, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\numpy\distutils\misc_util.py", line 999, in get_subpackage
config = self._get_configuration_from_setup_py(
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\numpy\distutils\misc_util.py", line 941, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "sklearn\setup.py", line 76, in configuration
maybe_cythonize_extensions(top_path, config)
File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\sklearn\_build_utils\__init__.py", line 42, in maybe_cythonize_extensions
with_openmp = check_openmp_support()
File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\sklearn\_build_utils\openmp_helpers.py", line 83, in check_openmp_support
ccompiler.compile(['test_openmp.c'], output_dir='objects',
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 171, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 1075, in __init__
self.si = SystemInfo(self.ri, vc_ver)
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 547, in __init__
vc_ver or self._find_latest_available_vs_ver())
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 561, in _find_latest_available_vs_ver
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Failed building wheel for scikit-learn
Running setup.py clean for scikit-learn
Failed to build scikit-learn
Installing collected packages: scikit-learn, sklearn, mlrose
Running setup.py install for scikit-learn ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\admin\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-install-8ooeas1k\\scikit-learn\\setup.py'"'"'; __file__='"'"'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-install-8ooeas1k\\scikit-learn\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-record-x04bx8yu\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\
Complete output (37 lines):
Partial import of sklearn during the build process.
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\setup.py", line 290, in <module>
setup_package()
File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\setup.py", line 286, in setup_package
setup(**metadata)
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\numpy\distutils\core.py", line 137, in setup
config = configuration()
File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\setup.py", line 174, in configuration
config.add_subpackage('sklearn')
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\numpy\distutils\misc_util.py", line 1033, in add_subpackage
config_list = self.get_subpackage(subpackage_name, subpackage_path,
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\numpy\distutils\misc_util.py", line 999, in get_subpackage
config = self._get_configuration_from_setup_py(
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\numpy\distutils\misc_util.py", line 941, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "sklearn\setup.py", line 76, in configuration
maybe_cythonize_extensions(top_path, config)
File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\sklearn\_build_utils\__init__.py", line 42, in maybe_cythonize_extensions
with_openmp = check_openmp_support()
File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-8ooeas1k\scikit-learn\sklearn\_build_utils\openmp_helpers.py", line 83, in check_openmp_support
ccompiler.compile(['test_openmp.c'], output_dir='objects',
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 171, in msvc14_get_vc_env
return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 1075, in __init__
self.si = SystemInfo(self.ri, vc_ver)
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 547, in __init__
vc_ver or self._find_latest_available_vs_ver())
File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\msvc.py", line 561, in _find_latest_available_vs_ver
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\admin\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-install-8ooeas1k\\scikit-learn\\setup.py'"'"'; __file__='"'"'C:\\Users\\Public\\Documents\\Wondershare\\CreatorTemp\\pip-install-8ooeas1k\\scikit-learn\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-record-x04bx8yu\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
What do I do?
Your error says:
Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
What it is telling you is that you need to have Microsoft Visual C++ 14.0
installed on your machine in order to install your module. It is the standard toolchain to compile c/cpp source code for windows platforms. This is needed if you try to install a python module from source that has some parts written in c/cpp for speed that need to be compiled.
Getting an installation from source working for complicated modules can be a pain, esspecially on windows, but fortunately, you have Options:
Usually many well known packages provide whl
files, which are pre-compiled versions of the module and can be readily installed without the need to compile anything on your Computer. In your case, you can see from the output, that mlrose
is actually downloaded as a whl
file
Using cached https://files.pythonhosted.org/packages/0d/f8/79e77a40f6e8988e3ecc9ead8a28024ee43df9c99fce2209037c9e6f9e4a/mlrose-1.3.0-py3-none-any.whl
However scikit-learn
(which is a dependency) is downloaded as source code, instead of a whl
file:
Using cached https://files.pythonhosted.org/packages/1e/ce/9d8c88e68af0a5b5c5d78d8d2b7bcadfd45e1d6afc863ccb9aee30765b06/scikit-learn-0.21.3.tar.gz
And during its compilation, the error pops up that you don't have the neccessary compiler installed. If you check the pypi page , you can see that for your python version (python 3.8) there are no whl files available, they only go up to cp37
(=python 3.7).
Python 3.8 is rather new, therefore there are not always official pre-built whl files available. Now you could either:
My suggestion would be to go with #3 if you just want to have an installation running as quickly and worry free as possible and don't care if you have python 3.7 or python 3.8
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.