Search code examples
python-3.xinstallationanacondasvd

Anaconda prompt won't download sparsesvd - Command errored out with exit status 1


In Python, I want to use the sparsesvd package. Following the installation instructions, I ran the following line:

pip install sparsesvd

Initially, this seems to work:

Collecting sparsesvd
  Using cached https://files.pythonhosted.org/packages/65/d9/c2545987871e27cad5969799a1d45073321a2904ac4dcb18bc0f1fe16ecc/sparsesvd-0.2.2.tar.gz
Requirement already satisfied: scipy>=0.6.0 in c:\users\USER_NAME\appdata\local\continuum\anaconda3\lib\site-packages (from sparsesvd) (1.4.1)
Requirement already satisfied: cython in c:\users\USER_NAME\appdata\local\continuum\anaconda3\lib\site-packages (from sparsesvd) (0.29.14)
Requirement already satisfied: numpy>=1.13.3 in c:\users\USER_NAME\appdata\local\continuum\anaconda3\lib\site-packages (from scipy>=0.6.0->sparsesvd) (1.19.1)
Building wheels for collected packages: sparsesvd

But then an error shows:

Building wheel for sparsesvd (setup.py) ... error

ERROR: Command errored out with exit status 1:
   command: 'C:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER_NAME\\AppData\\Local\\Temp\\pip-install-88oyknio\\sparsesvd\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER_NAME\\AppData\\Local\\Temp\\pip-install-88oyknio\\sparsesvd\\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\USER_NAME\AppData\Local\Temp\pip-wheel-57sqoa2_' --python-tag cp37
       cwd: C:\Users\USER_NAME\AppData\Local\Temp\pip-install-88oyknio\sparsesvd\
  Complete output (18 lines):
  running bdist_wheel
  running build
  running build_ext
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  cythoning sparsesvd.pyx to sparsesvd.c
  C:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\USER_NAME\AppData\Local\Temp\pip-install-88oyknio\sparsesvd\sparsesvd.pxd
    tree = Parsing.p_module(s, pxd, full_module_name)
  warning: sparsesvd.pxd:7:31: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
  warning: sparsesvd.pxd:7:40: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
  building 'sparsesvd' extension
  creating build
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  creating build\temp.win-amd64-3.7\Release\SVDLIBC
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\core\include -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\include -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\include -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE -IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt /Tcsparsesvd.c /Fobuild\temp.win-amd64-3.7\Release\sparsesvd.obj
  sparsesvd.c
  c:\users\USER_NAME\appdata\local\continuum\anaconda3\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
  error: Command "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\core\include -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\include -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\include -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE -IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt /Tcsparsesvd.c /Fobuild\temp.win-amd64-3.7\Release\sparsesvd.obj" failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for sparsesvd
  Running setup.py clean for sparsesvd
Failed to build sparsesvd
Installing collected packages: sparsesvd
  Running setup.py install for sparsesvd ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER_NAME\\AppData\\Local\\Temp\\pip-install-88oyknio\\sparsesvd\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER_NAME\\AppData\\Local\\Temp\\pip-install-88oyknio\\sparsesvd\\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\USER_NAME\AppData\Local\Temp\pip-record-47i_nbhg\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\USER_NAME\AppData\Local\Temp\pip-install-88oyknio\sparsesvd\
    Complete output (14 lines):
    running install
    running build
    running build_ext
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    skipping 'sparsesvd.c' Cython extension (up-to-date)
    building 'sparsesvd' extension
    creating build
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\SVDLIBC
    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\core\include -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\include -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\include -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE -IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt /Tcsparsesvd.c /Fobuild\temp.win-amd64-3.7\Release\sparsesvd.obj
    sparsesvd.c
    c:\users\USER_NAME\appdata\local\continuum\anaconda3\include\pyconfig.h(203): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
    error: Command "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\core\include -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\include -IC:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\include -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE -IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE -IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt /Tcsparsesvd.c /Fobuild\temp.win-amd64-3.7\Release\sparsesvd.obj" failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\USER_NAME\AppData\Local\Continuum\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\USER_NAME\\AppData\\Local\\Temp\\pip-install-88oyknio\\sparsesvd\\setup.py'"'"'; __file__='"'"'C:\\Users\\USER_NAME\\AppData\\Local\\Temp\\pip-install-88oyknio\\sparsesvd\\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\USER_NAME\AppData\Local\Temp\pip-record-47i_nbhg\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

What can I do to install this package?


Solution

  • After I downloaded the Visual Studios build tools it worked for me