Skip to content

Noo module named slycot #63

Description

@nilsmelchert

Hi,
I recently tried to install slycot via pip. Before that I installed the following dependencies:

  • pip install cmake
  • pip install scikit-build
  • sudo apt-get install libopenblas-dev

Everything installs without any errors, but when I am trying to import slycot, I get the following error message:

ModuleNotFoundError: No module named 'slycot'

Am I missing something?

Activity

  1. moorepants commented on May 18, 2019

    @moorepants
    Contributor

    pip install cmake

    Probably isn't doing what you think it should. You should apt install cmake.

  2. moorepants commented on May 18, 2019

    @moorepants
    Contributor

    I take that back. It actually seems like cmake is packaged for installation via pypi: https://pypi.org/project/cmake/

  3. nilsmelchert commented on May 18, 2019

    @nilsmelchert
    Author

    I also tried to install slycot from source which leads to the same issue.
    Cmake is of course installed on my system.

  4. moorepants commented on May 18, 2019

    @moorepants
    Contributor

    Are you sure you have installed the package into a directory that is on your path? Are you trying to import from the same Python executable that the package was installed alongside?

  5. jgspiro commented on May 20, 2019

    @jgspiro
    Contributor

    I fixed that, because I had the same issue : #62

  6. nilsmelchert commented on May 20, 2019

    @nilsmelchert
    Author
  7. roryyorke commented on May 25, 2019

    @roryyorke
    Collaborator

    I don't think we've fixed this. It's related to #3, and is at least partly addressed by #64.

  8. roryyorke commented on May 25, 2019

    @roryyorke
    Collaborator

    Ah-ha; the files have been installed in "slycot" off the virtual-env root, rather than in site-packages; I remember this happening on Windows when I was trying to build wheels there, but I thought it was a peculiarity of that environment. The result below is from an Ubuntu 18.04 system.

    If anyone knows why this would happen, please speak up. Do we need to teach scikit-build or CMake about the "normal" install directories, maybe?

    (slycot-via-pip) rory@rory-latitude:~$ pip show -f slycot
    Name: slycot
    Version: 0.3.4
    Summary: Slycot: a wrapper for the SLICOT control and systems library
    Home-page: https://github.com/python-control/Slycot
    Author: Enrico Avventi et al.
    Author-email: None
    License: GPL-2.0
    Location: /home/rory/.miniconda3/envs/slycot-via-pip/lib/python3.7/site-packages
    Requires: 
    Required-by: 
    Files:
      ../../../slycot/__init__.py
      ../../../slycot/__pycache__/__init__.cpython-37.pyc
      ../../../slycot/__pycache__/analysis.cpython-37.pyc
      ../../../slycot/__pycache__/examples.cpython-37.pyc
      ../../../slycot/__pycache__/math.cpython-37.pyc
      ../../../slycot/__pycache__/synthesis.cpython-37.pyc
      ../../../slycot/__pycache__/transform.cpython-37.pyc
      ../../../slycot/__pycache__/version.cpython-37.pyc
      ../../../slycot/_wrapper.so
      ../../../slycot/analysis.py
      ../../../slycot/examples.py
      ../../../slycot/math.py
      ../../../slycot/synthesis.py
      ../../../slycot/tests/__init__.py
      ../../../slycot/tests/__pycache__/__init__.cpython-37.pyc
      ../../../slycot/tests/__pycache__/test.cpython-37.pyc
      ../../../slycot/tests/__pycache__/test_sg02ad.cpython-37.pyc
      ../../../slycot/tests/__pycache__/test_sg03ad.cpython-37.pyc
      ../../../slycot/tests/__pycache__/test_tb05ad.cpython-37.pyc
      ../../../slycot/tests/__pycache__/test_td04ad.cpython-37.pyc
      ../../../slycot/tests/test.py
      ../../../slycot/tests/test_sg02ad.py
      ../../../slycot/tests/test_sg03ad.py
      ../../../slycot/tests/test_tb05ad.py
      ../../../slycot/tests/test_td04ad.py
      ../../../slycot/transform.py
      ../../../slycot/version.py
      slycot-0.3.4.dist-info/COPYING
      slycot-0.3.4.dist-info/INSTALLER
      slycot-0.3.4.dist-info/METADATA
      slycot-0.3.4.dist-info/RECORD
      slycot-0.3.4.dist-info/WHEEL
      slycot-0.3.4.dist-info/top_level.txt
    
    (slycot-via-pip) rory@rory-latitude:~$ python -c "import sys; print(sys.path)"
    ['', '/home/rory/.miniconda3/envs/slycot-via-pip/lib/python37.zip', '/home/rory/.miniconda3/envs/slycot-via-pip/lib/python3.7', '/home/rory/.miniconda3/envs/slycot-via-pip/lib/python3.7/lib-dynload', '/home/rory/.miniconda3/envs/slycot-via-pip/lib/python3.7/site-packages']
    
    
  9. roryyorke commented on May 25, 2019

    @roryyorke
    Collaborator

    With the diff below, I can build a wheel (python setup.py bdist_wheel), install it (pip install slycot-0.3.4.9-cp37-cp37m-linux_x86_64.whl), and then import slycot works, and pip show -f slycot is

    Name: slycot
    Version: 0.3.4.9
    Summary: Slycot: a wrapper for the SLICOT control and systems library
    Home-page: https://github.com/python-control/Slycot
    Author: Enrico Avventi et al.
    Author-email: None
    License: GPL-2.0
    Location: /home/rory/.miniconda3/envs/slycot-via-pip/lib/python3.7/site-packages
    Requires: 
    Required-by: 
    Files:
      slycot-0.3.4.9.dist-info/COPYING
      slycot-0.3.4.9.dist-info/INSTALLER
      slycot-0.3.4.9.dist-info/METADATA
      slycot-0.3.4.9.dist-info/RECORD
      slycot-0.3.4.9.dist-info/WHEEL
      slycot-0.3.4.9.dist-info/top_level.txt
      slycot/__init__.py
      slycot/__pycache__/__init__.cpython-37.pyc
      slycot/__pycache__/analysis.cpython-37.pyc
      slycot/__pycache__/examples.cpython-37.pyc
      slycot/__pycache__/math.cpython-37.pyc
      slycot/__pycache__/synthesis.cpython-37.pyc
      slycot/__pycache__/transform.cpython-37.pyc
      slycot/__pycache__/version.cpython-37.pyc
      slycot/_wrapper.so
      slycot/analysis.py
      slycot/examples.py
      slycot/math.py
      slycot/synthesis.py
      slycot/tests/__init__.py
      slycot/tests/__pycache__/__init__.cpython-37.pyc
      slycot/tests/__pycache__/test.cpython-37.pyc
      slycot/tests/__pycache__/test_sg02ad.cpython-37.pyc
      slycot/tests/__pycache__/test_sg03ad.cpython-37.pyc
      slycot/tests/__pycache__/test_tb05ad.cpython-37.pyc
      slycot/tests/__pycache__/test_td04ad.cpython-37.pyc
      slycot/tests/test.py
      slycot/tests/test_sg02ad.py
      slycot/tests/test_sg03ad.py
      slycot/tests/test_tb05ad.py
      slycot/tests/test_td04ad.py
      slycot/transform.py
      slycot/version.py
    
    diff --git a/CMakeLists.txt b/CMakeLists.txt
    index 63b32e0..67973f4 100644
    --- a/CMakeLists.txt
    +++ b/CMakeLists.txt
    @@ -8,6 +8,8 @@ endif()
     
     project(slycot VERSION ${SLYCOT_VERSION} LANGUAGES NONE)
     
    +find_package(PythonExtensions REQUIRED)
    +
     # Fortran detection fails on windows, use the CMAKE_C_SIMULATE flag to
     # force success
     if(WIN32)
    diff --git a/slycot/CMakeLists.txt b/slycot/CMakeLists.txt
    index 3207d92..7d8c377 100644
    --- a/slycot/CMakeLists.txt
    +++ b/slycot/CMakeLists.txt
    @@ -3,7 +3,6 @@
     #
     # RvP, 180710
     
    -
     set(FSOURCES
     
       src/AB01MD.f src/MA02AD.f src/MB03YT.f src/NF01BW.f src/SB10KD.f
    @@ -166,7 +165,7 @@ target_include_directories(
       ${PYTHON_INCLUDE_DIRS}
       )
     
    -install(TARGETS ${SLYCOT_MODULE} DESTINATION slycot)
    -install(FILES ${PYSOURCE} DESTINATION slycot)
    +install(TARGETS ${SLYCOT_MODULE} DESTINATION ${PYTHON_RELATIVE_SITE_PACKAGES_DIR}/slycot)
    +install(FILES ${PYSOURCE} DESTINATION ${PYTHON_RELATIVE_SITE_PACKAGES_DIR}/slycot)
     
     add_subdirectory(tests)
    diff --git a/slycot/tests/CMakeLists.txt b/slycot/tests/CMakeLists.txt
    index c97cb50..7de8521 100644
    --- a/slycot/tests/CMakeLists.txt
    +++ b/slycot/tests/CMakeLists.txt
    @@ -3,4 +3,4 @@ set(PYSOURCE
       __init__.py test.py test_sg02ad.py test_sg03ad.py test_tb05ad.py
       test_td04ad.py)
     
    -install(FILES ${PYSOURCE} DESTINATION slycot/tests)
    +install(FILES ${PYSOURCE} DESTINATION ${PYTHON_RELATIVE_SITE_PACKAGES_DIR}/slycot/tests)
  10. roryyorke commented on Jun 21, 2019

    @roryyorke
    Collaborator

    This is fixed in #67, for Linux and (I think) OSX. Hopefully soon available in 0.3.5 (#70).

    Please reopen if the bug is still there on 0.3.5.

  11. bnavigator commented on Jun 21, 2019

    @bnavigator
    Collaborator

    It's not mentioned in #67 but the fix is actually in commit 2e41c2f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions