Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues installing slycot via pip #155

Closed
PSchneider96 opened this issue May 17, 2021 · 5 comments
Closed

Issues installing slycot via pip #155

PSchneider96 opened this issue May 17, 2021 · 5 comments
Labels
build system Issues with compiling, linking and installing Slycot

Comments

@PSchneider96
Copy link

PSchneider96 commented May 17, 2021

Hello,

Currently trying to install slycot with "pip install slycot"

While running "pip install slycot", I get the following output:

================================================================================
_C:\Windows\system32>pip install slycot
Collecting slycot
  Using cached slycot-0.4.0.0.tar.gz (1.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: numpy in c:\users\psc\appdata\local\programs\python\python39\lib\site-packages (from slycot) (1.20.3)
Building wheels for collected packages: slycot
  Building wheel for slycot (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\psc\appdata\local\programs\python\python39\python.exe' 'c:\users\psc\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\psc\AppData\Local\Temp\tmp_pm1h_ju'
       cwd: C:\Users\psc\AppData\Local\Temp\pip-install-g41g7ty1\slycot_37cc017271c84d17ac02eef4e57cb82e
  Complete output (56 lines):
  Not searching for unused variables given on the command line.
  -- The C compiler identification is unknown
  CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
    The CMAKE_C_COMPILER:

      cl

    is not a full path and was not found in the PATH.

    To use the NMake generator with Visual C++, cmake must be run from a shell
    that can use the compiler cl from the command line.  This environment is
    unable to invoke the cl compiler.  To fix this problem, run cmake from the
    Visual Studio Command Prompt (vcvarsall.bat).

    Tell CMake where to find the compiler by setting either the environment
    variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
    the compiler, or to the compiler name if it is in the PATH.


  -- Configuring incomplete, errors occurred!
  See also "C:/Users/psc/AppData/Local/Temp/pip-install-g41g7ty1/slycot_37cc017271c84d17ac02eef4e57cb82e/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  See also "C:/Users/psc/AppData/Local/Temp/pip-install-g41g7ty1/slycot_37cc017271c84d17ac02eef4e57cb82e/_cmake_test_compile/build/CMakeFiles/CMakeError.log".
  FC ('-DCMAKE_Fortran_COMPILER=', 'c:/users/psc/appdata/local/programs/python/python39/Library/bin/flang.exe')
  F2PY ('-DF2PY_EXECUTABLE=', 'c:/users/psc/appdata/local/programs/python/python39/Scripts/f2py.exe')
  NUMPY_INCLUDE ('-DNumPy_INCLUDE_DIR=', 'c:/users/psc/appdata/local/programs/python/python39/Include')
  ['-DSLYCOT_VERSION:STRING=0.4.0', '-DGIT_REVISION:STRING=ac0944b363a6cfcc0c3d5128cdd484d74173aa3b', '-DISRELEASE:STRING=True', '-DFULL_VERSION=0.4.0.gitac0944b', '-GNMake Makefiles', '-DCMAKE_Fortran_COMPILER=c:/users/psc/appdata/local/programs/python/python39/Library/bin/flang.exe', '-DF2PY_EXECUTABLE=c:/users/psc/appdata/local/programs/python/python39/Scripts/f2py.exe', '-DNumPy_INCLUDE_DIR=c:/users/psc/appdata/local/programs/python/python39/Include', '-DCMAKE_Fortran_SIMULATE_VERSION=5.0.0', '-DCMAKE_Fortran_COMPILER_ID=Flang', '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON']


  --------------------------------------------------------------------------------
  -- Trying "NMake Makefiles (Visual Studio 15 2017 Win64 v141)" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "NMake Makefiles (Visual Studio 15 2017 Win64 v141)" generator - failure
  --------------------------------------------------------------------------------

  ********************************************************************************
  scikit-build could not get a working generator for your system. Aborting build.

  Building windows wheels for Python 3.9 requires Microsoft Visual Studio 2017.
  Get it with "Visual Studio 2017":

    https://visualstudio.microsoft.com/vs/

  ********************************************************************************
  ----------------------------------------
  ERROR: Failed building wheel for slycot
Failed to build slycot
ERROR: Could not build wheels for slycot which use PEP 517 and cannot be installed directly_
================================================================================

However, I cannot make sense of the output. I installed VS 2017 with the correct version v141.
(I run this code in cmd, VS, ... same issue)

Is there something else to do? Set path for VS or CMake,...?

Thanks!

@bnavigator
Copy link
Collaborator

Hi,

Because we do not provide Slycot wheels on PyPI, pip install slycot tries to compile the source distribution.

As the README says, compiling from source on Windows is tricky.

https://github.com/python-control/Slycot/blob/master/README.rst#with-setuptools-in-a-conda-environment-windows

If you choose to not use conda as your environment, it is even trickier to get all the build requirements: BLAS/LAPACK headers, Numpy and Python headers, and most importantly a working build toolchain where NMake can find the VS C compiler.

The error message should give you a pointer into the right direction:

   The CMAKE_C_COMPILER:

     cl

   is not a full path and was not found in the PATH.

   To use the NMake generator with Visual C++, cmake must be run from a shell
   that can use the compiler cl from the command line.  This environment is
   unable to invoke the cl compiler.  To fix this problem, run cmake from the
   Visual Studio Command Prompt (vcvarsall.bat).

   Tell CMake where to find the compiler by setting either the environment
   variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
   the compiler, or to the compiler name if it is in the PATH.

This is what the README is referring to by

On Windows, you need to install Microsoft Visual C++ 14.x provided e.g.
by Microsoft Visual Studio. To build, you'll need a command shell setup
for ... the Visual Studio build tools. See ... Microsoft Visual Studio setup for information on this.

Windows users are encouraged to make use of the pre-built packages on conda-forge.

@bnavigator bnavigator added the build system Issues with compiling, linking and installing Slycot label May 29, 2021
@bnavigator
Copy link
Collaborator

Closing, because this is not really a bug in Slycot.

@OrangeDog
Copy link

OrangeDog commented Dec 17, 2021

we do not provide Slycot wheels on PyPI

Could you? It would be very helpful and save a huge amount of effort of everyone trying to build it themselves.

There are some available here, for others who might be looking
https://www.lfd.uci.edu/~gohlke/pythonlibs/#slycot

@roryyorke
Copy link
Collaborator

We don't publish wheels because we don't know how to build them.

I've tried and failed to build wheels for Windows before; if I recall correctly one basically has to bundle a BLAS&LAPACK library in the wheel, and I couldn't figure out how to do it.

@bnavigator
Copy link
Collaborator

The wheels linked above also depend on a consistent environment with all those packages.

The situation might have changed for the better since the last time it was attempted to also build wheels for Slycot. NumPy publishes wheels on PyPI too. If someone can come up with a reliable method to publish wheels compatible with those, feel free to contribute.

I am not a big fan of Anaconda, but for Windows, it is the best thing you can get. It solves all the problems of getting a compiled Slycot working with a BLAS/LAPACK which is also compatible with the used NumPy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system Issues with compiling, linking and installing Slycot
Projects
None yet
Development

No branches or pull requests

4 participants