0
votes

While trying to install the module PyPortfolioOpt, it failed because the Ecos and scs modules failed to build. I fixed the issue with Ecos by getting visual studio build tools but scs still keeps failing. I'm using a conda environment with python 3.8 and I tried conda install but it couldn't find the package in the default channels. Here is the error message:

C:\Users\Franklin Joe>pip install scs
Collecting scs
  Using cached scs-2.1.2.tar.gz (3.5 MB)
Requirement already satisfied: numpy>=1.7 in c:\programdata\anaconda3\lib\site-packages (from scs) (1.19.2)
Requirement already satisfied: scipy>=0.13.2 in c:\programdata\anaconda3\lib\site-packages (from scs) (1.5.2)
Building wheels for collected packages: scs
  Building wheel for scs (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Franklin Joe\\AppData\\Local\\Temp\\pip-install-ifm96i5v\\scs\\setup.py'"'"'; __file__='"'"'C:\\Users\\Franklin Joe\\AppData\\Local\\Temp\\pip-install-ifm96i5v\\scs\\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\Franklin Joe\AppData\Local\Temp\pip-wheel-z7f66io1'
       cwd: C:\Users\Franklin Joe\AppData\Local\Temp\pip-install-ifm96i5v\scs\
  Complete output (79 lines):
  Namespace(blas64=False, extraverbose=False, float32=False, gpu=False, int32=False, scs=False)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\scs
  copying src\__init__.py -> build\lib.win-amd64-3.8\scs
  running build_ext
  blas_mkl_info:
      libraries = ['mkl_rt']
      library_dirs = ['C:/ProgramData/Anaconda3\\Library\\lib']
      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
      include_dirs = ['C:/ProgramData/Anaconda3\\Library\\include']
  blas_opt_info:
      libraries = ['mkl_rt']
      library_dirs = ['C:/ProgramData/Anaconda3\\Library\\lib']
      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
      include_dirs = ['C:/ProgramData/Anaconda3\\Library\\include']
  lapack_mkl_info:
      libraries = ['mkl_rt']
      library_dirs = ['C:/ProgramData/Anaconda3\\Library\\lib']
      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
      include_dirs = ['C:/ProgramData/Anaconda3\\Library\\include']
  lapack_opt_info:
      libraries = ['mkl_rt']
      library_dirs = ['C:/ProgramData/Anaconda3\\Library\\lib']
      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
      include_dirs = ['C:/ProgramData/Anaconda3\\Library\\include']
  Could not locate executable g77
  Could not locate executable f77
  Could not locate executable ifort
  Could not locate executable ifl
  Could not locate executable f90
  Could not locate executable DF
  Could not locate executable efl
  Could not locate executable gfortran
  Could not locate executable f95
  Could not locate executable g95
  Could not locate executable efort
  Could not locate executable efc
  Could not locate executable flang
  don't know how to compile Fortran code on platform 'nt'
  C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
      Optimized (vendor) Blas libraries are not found.
      Falls back to netlib Blas library which has worse performance.
      A better performance should be easily gained by switching
      Blas library.
    if self._calc_info(blas):
  C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
      Blas (http://www.netlib.org/blas/) libraries not found.
      Directories to search for the libraries can be specified in the
      numpy/distutils/site.cfg file (section [blas]) or by setting
      the BLAS environment variable.
    if self._calc_info(blas):
  C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
      Blas (http://www.netlib.org/blas/) sources not found.
      Directories to search for the sources can be specified in the
      numpy/distutils/site.cfg file (section [blas_src]) or by setting
      the BLAS_SRC environment variable.
    if self._calc_info(blas):
  C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1748: 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))()
  C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1748: 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))()
  cl : Command line warning D9002 : ignoring unknown option '-O3'
  scsmodule.c
  c:\programdata\anaconda3\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
  error: Command "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYTHON -DCTRLC=1 -DDLONG=1 -DCOPYAMATRIX -Iscs/include -Iscs/linsys -Iscs/linsys/cpu/direct/ -Iscs/linsys/external/amd -Iscs/linsys/external/dqlql -IC:\ProgramData\Anaconda3\lib\site-packages\numpy\core\include -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include /Tcsrc/scsmodule.c /Fobuild\temp.win-amd64-3.8\Release\src/scsmodule.obj -O3" failed with exit status 2
  {}
  {}
  ----------------------------------------
  ERROR: Failed building wheel for scs
  Running setup.py clean for scs
Failed to build scs
Installing collected packages: scs
    Running setup.py install for scs ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Franklin Joe\\AppData\\Local\\Temp\\pip-install-ifm96i5v\\scs\\setup.py'"'"'; __file__='"'"'C:\\Users\\Franklin Joe\\AppData\\Local\\Temp\\pip-install-ifm96i5v\\scs\\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\Franklin Joe\AppData\Local\Temp\pip-record-tqjx263c\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\ProgramData\Anaconda3\Include\scs'
         cwd: C:\Users\Franklin Joe\AppData\Local\Temp\pip-install-ifm96i5v\scs\
    Complete output (79 lines):
    Namespace(blas64=False, extraverbose=False, float32=False, gpu=False, int32=False, scs=False)
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\scs
    copying src\__init__.py -> build\lib.win-amd64-3.8\scs
    running build_ext
    blas_mkl_info:
        libraries = ['mkl_rt']
        library_dirs = ['C:/ProgramData/Anaconda3\\Library\\lib']
        define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
        include_dirs = ['C:/ProgramData/Anaconda3\\Library\\include']
    blas_opt_info:
        libraries = ['mkl_rt']
        library_dirs = ['C:/ProgramData/Anaconda3\\Library\\lib']
        define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
        include_dirs = ['C:/ProgramData/Anaconda3\\Library\\include']
    lapack_mkl_info:
        libraries = ['mkl_rt']
        library_dirs = ['C:/ProgramData/Anaconda3\\Library\\lib']
        define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
        include_dirs = ['C:/ProgramData/Anaconda3\\Library\\include']
    lapack_opt_info:
        libraries = ['mkl_rt']
        library_dirs = ['C:/ProgramData/Anaconda3\\Library\\lib']
        define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
        include_dirs = ['C:/ProgramData/Anaconda3\\Library\\include']
    Could not locate executable g77
    Could not locate executable f77
    Could not locate executable ifort
    Could not locate executable ifl
    Could not locate executable f90
    Could not locate executable DF
    Could not locate executable efl
    Could not locate executable gfortran
    Could not locate executable f95
    Could not locate executable g95
    Could not locate executable efort
    Could not locate executable efc
    Could not locate executable flang
    don't know how to compile Fortran code on platform 'nt'
    C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
        Optimized (vendor) Blas libraries are not found.
        Falls back to netlib Blas library which has worse performance.
        A better performance should be easily gained by switching
        Blas library.
      if self._calc_info(blas):
    C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      if self._calc_info(blas):
    C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1914: UserWarning:
        Blas (http://www.netlib.org/blas/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [blas_src]) or by setting
        the BLAS_SRC environment variable.
      if self._calc_info(blas):
    C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1748: 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))()
    C:\ProgramData\Anaconda3\lib\site-packages\numpy\distutils\system_info.py:1748: 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))()
    cl : Command line warning D9002 : ignoring unknown option '-O3'
    scsmodule.c
    c:\programdata\anaconda3\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
    error: Command "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYTHON -DCTRLC=1 -DDLONG=1 -DCOPYAMATRIX -Iscs/include -Iscs/linsys -Iscs/linsys/cpu/direct/ -Iscs/linsys/external/amd -Iscs/linsys/external/dqlql -IC:\ProgramData\Anaconda3\lib\site-packages\numpy\core\include -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include /Tcsrc/scsmodule.c /Fobuild\temp.win-amd64-3.8\Release\src/scsmodule.obj -O3" failed with exit status 2
    {}
    {}
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Franklin Joe\\AppData\\Local\\Temp\\pip-install-ifm96i5v\\scs\\setup.py'"'"'; __file__='"'"'C:\\Users\\Franklin Joe\\AppData\\Local\\Temp\\pip-install-ifm96i5v\\scs\\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\Franklin Joe\AppData\Local\Temp\pip-record-tqjx263c\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\ProgramData\Anaconda3\Include\scs' Check the logs for full command output.
1

1 Answers

1
votes

I have faced the exact same issue on a conda environment. My python version is 3.7.9 It seems it has something to do with the conda environment(not sure though)

I have tried using conda to install the packages by,

conda install -c anaconda ecos
conda install -c conda-forge scs

This solved my issue.