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

Windows setup via conda-forge not working ImportError: DLL load failed while importing _wrapper #219

Open
pichim opened this issue Oct 17, 2023 · 23 comments
Labels
build system Issues with compiling, linking and installing Slycot

Comments

@pichim
Copy link

pichim commented Oct 17, 2023

Hi everybody

I would like to test and evaluate the package to eventually leave Matlab behind for my control systems class. Currently I'm using Windows 10. To make the error reproducible i created a fresh and clean local user and installed miniconda3 and vscode only.

The exact commands in miniconda3 were:

conda update -n base -c defaults conda
conda create --name pichim
conda activate pichim
conda install -c conda-forge control slycot numpy scipy matplotlib ipykernel

I then run vscode with the python and jupyter extensions (packs) with the conda enviroment pichim. The example phaseplots.py is working fine, others using more sophisticated tooling from python-control including slycot do not. E.g. cruise.ipynb is working fine, whereas robustsiso.py do not.

I get the error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File [c:\Users\pichim\miniconda3\envs\pichim\lib\site-packages\control\statesp.py:1547](file:///C:/Users/pichim/miniconda3/envs/pichim/lib/site-packages/control/statesp.py:1547), in _convert_to_statespace(sys, use_prefix_suffix)
   1546 try:
-> 1547     from slycot import td04ad
   1549     # Change the numerator and denominator arrays so that the transfer
   1550     # function matrix has a common denominator.
   1551     # matrices are also sized/padded to fit td04ad

File [c:\Users\pichim\miniconda3\envs\pichim\lib\site-packages\slycot\__init__.py:16](file:///C:/Users/pichim/miniconda3/envs/pichim/lib/site-packages/slycot/__init__.py:16)
     11 else:
     12 
     13     # import slycot.examples
     14 
     15     # Analysis routines (15/40 wrapped)
---> 16     from .analysis import ab01nd, ab05md, ab05nd, ab07nd, ab08nd, ab08nz
     17     from .analysis import ab09ad, ab09ax, ab09bd, ab09md, ab09nd

File [c:\Users\pichim\miniconda3\envs\pichim\lib\site-packages\slycot\analysis.py:22](file:///C:/Users/pichim/miniconda3/envs/pichim/lib/site-packages/slycot/analysis.py:22)
     20 import numpy as np
---> 22 from . import _wrapper
     23 from .exceptions import raise_if_slycot_error, SlycotParameterError

ImportError: DLL load failed while importing _wrapper: The specified module could not be found.
...
   1582     # the squeeze
   1583     A, B, C, D = \
   1584         sp.signal.tf2ss(squeeze(sys.num), squeeze(sys.den))

TypeError: No support for MIMO without slycot
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?e2d3b551-dd88-41f7-90f8-e6ba35d27e94) or open in a [text editor](command:workbench.action.openLargeOutput?e2d3b551-dd88-41f7-90f8-e6ba35d27e94). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...

Listing the packages from the conda environment with conda list -n pichim produces the following output:

# packages in environment at C:\Users\pichim\miniconda3\envs\pichim:
#
# Name                    Version                   Build  Channel
asttokens                 2.4.0              pyhd8ed1ab_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    conda-forge
backports.functools_lru_cache 1.6.5              pyhd8ed1ab_0    conda-forge
brotli                    1.1.0                hcfcfb64_1    conda-forge
brotli-bin                1.1.0                hcfcfb64_1    conda-forge
ca-certificates           2023.7.22            h56e8100_0    conda-forge
certifi                   2023.7.22          pyhd8ed1ab_0    conda-forge
clang                     17.0.2               h3dc180e_0    conda-forge
clang-17                  17.0.2          default_heb8d277_0    conda-forge
clangxx                   17.0.2          default_heb8d277_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
comm                      0.1.4              pyhd8ed1ab_0    conda-forge
compiler-rt               17.0.2               h91493d7_1    conda-forge
compiler-rt_win-64        17.0.2               h91493d7_1    conda-forge
contourpy                 1.1.1            py39h1f6ef14_1    conda-forge
control                   0.9.4              pyhd8ed1ab_0    conda-forge
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
debugpy                   1.8.0            py39h99910a6_1    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
exceptiongroup            1.1.3              pyhd8ed1ab_0    conda-forge
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
fonttools                 4.43.1           py39ha55989b_0    conda-forge
freetype                  2.12.1               hdaf720e_2    conda-forge
icu                       68.2                 h0e60522_0    conda-forge
importlib-metadata        6.8.0              pyha770c72_0    conda-forge
importlib-resources       6.1.0              pyhd8ed1ab_0    conda-forge
importlib_metadata        6.8.0                hd8ed1ab_0    conda-forge
importlib_resources       6.1.0              pyhd8ed1ab_0    conda-forge
intel-openmp              2023.2.0         h57928b3_50496    conda-forge
ipykernel                 6.25.2             pyh60829e3_0    conda-forge
ipython                   8.16.1             pyh5737063_0    conda-forge
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
jpeg                      9e                   hcfcfb64_3    conda-forge
jupyter_client            8.4.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.4.0            py39hcbf5309_0    conda-forge
kiwisolver                1.4.5            py39h1f6ef14_1    conda-forge
lerc                      3.0                  hd77b12b_0
libblas                   3.9.0              19_win64_mkl    conda-forge
libbrotlicommon           1.1.0                hcfcfb64_1    conda-forge
libbrotlidec              1.1.0                hcfcfb64_1    conda-forge
libbrotlienc              1.1.0                hcfcfb64_1    conda-forge
libcblas                  3.9.0              19_win64_mkl    conda-forge
libclang                  11.1.0          default_h5c34c98_1    conda-forge
libdeflate                1.17                 h2bbff1b_1
libflang                  17.0.2               h63175ca_0    conda-forge
libhwloc                  2.9.3           default_haede6df_1009    conda-forge
libiconv                  1.17                 h8ffe710_0    conda-forge
liblapack                 3.9.0              19_win64_mkl    conda-forge
libpng                    1.6.39               h19919ed_0    conda-forge
libsodium                 1.0.18               h8d14728_1    conda-forge
libsqlite                 3.43.2               hcfcfb64_0    conda-forge
libtiff                   4.5.1                hd77b12b_0
libwebp                   1.3.2                hcfcfb64_1    conda-forge
libwebp-base              1.3.2                hcfcfb64_0    conda-forge
libxml2                   2.11.5               hc3477c8_1    conda-forge
libzlib                   1.2.13               hcfcfb64_5    conda-forge
matplotlib                3.8.0            py39hcbf5309_2    conda-forge
matplotlib-base           3.8.0            py39hf19769e_2    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
mkl                       2023.2.0         h6a75c08_50496    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
nest-asyncio              1.5.8              pyhd8ed1ab_0    conda-forge
numpy                     1.26.0           py39hddb5d58_0    conda-forge
openjpeg                  2.5.0                ha2aaf27_2    conda-forge
openssl                   1.1.1w               hcfcfb64_0    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    10.0.1           py39h045eedc_0
pip                       23.3               pyhd8ed1ab_0    conda-forge
platformdirs              3.11.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.39             pyha770c72_0    conda-forge
prompt_toolkit            3.0.39               hd8ed1ab_0    conda-forge
psutil                    5.9.5            py39ha55989b_1    conda-forge
pthreads-win32            2.9.1                hfa6e2cd_3    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pygments                  2.16.1             pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.1              pyhd8ed1ab_0    conda-forge
pyqt                      5.12.3           py39hb0d2dfa_4    conda-forge
pyqt5-sip                 4.19.18                  pypi_0    pypi
pyqtchart                 5.12                     pypi_0    pypi
pyqtwebengine             5.12.1                   pypi_0    pypi
python                    3.9.18               h6244533_0
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.9                      2_cp39    conda-forge
pywin32                   306              py39h99910a6_2    conda-forge
pyzmq                     25.1.1           py39hea35a22_1    conda-forge
qt                        5.12.9               h5909a2a_4    conda-forge
scipy                     1.11.3           py39hddb5d58_1    conda-forge
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
slycot                    0.5.4            py39h73a3b6d_1    conda-forge
sqlite                    3.43.2               hcfcfb64_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
tbb                       2021.10.0            h91493d7_1    conda-forge
tk                        8.6.13               hcfcfb64_0    conda-forge
tornado                   6.3.3            py39ha55989b_1    conda-forge
traitlets                 5.11.2             pyhd8ed1ab_0    conda-forge
typing-extensions         4.8.0                hd8ed1ab_0    conda-forge
typing_extensions         4.8.0              pyha770c72_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
unicodedata2              15.1.0           py39ha55989b_0    conda-forge
vc                        14.3                h64f974e_17    conda-forge
vc14_runtime              14.36.32532         hdcecf7f_17    conda-forge
vs2015_runtime            14.36.32532         h05e6639_17    conda-forge
wcwidth                   0.2.8              pyhd8ed1ab_0    conda-forge
wheel                     0.41.2             pyhd8ed1ab_0    conda-forge
xz                        5.4.2                h8cc25b3_0
zeromq                    4.3.4                h0e60522_1    conda-forge
zipp                      3.17.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               hcfcfb64_5    conda-forge
zstd                      1.5.5                h12be248_0    conda-forge
  • I also tried it with Pycharm on my default account, but the error was the same.
  • I know I managed to get the examples running in the past :-)
  • I already spent quit a bit of time browsing the internet for a solution, so I thought I would raise an Issue

I greatly appreciate what you are doing, big respect!

@bnavigator
Copy link
Collaborator

Could you please list the contents of c:\Users\pichim\miniconda3\envs\pichim\lib\site-packages\slycot` ? It should contain _wrapper.cp39-win_amd64.pyd.

Also, what happens if you just import slycot in a python shell?

@bnavigator bnavigator transferred this issue from python-control/python-control Oct 17, 2023
@pichim
Copy link
Author

pichim commented Oct 17, 2023

@bnavigator Thank you for your response. _wrapper.cp39-win_amd64.pyd is listed, see below.

    Directory: C:\Users\pichim\miniconda3\envs\pichim\Lib\site-packages\slycot


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        17/10/2023     08:28                tests
d-----        17/10/2023     08:28                __pycache__
-a----        06/10/2023     07:03          85946 analysis.py
-a----        06/10/2023     07:03           9082 examples.py
-a----        06/10/2023     07:03           8737 exceptions.py
-a----        06/10/2023     07:03          30976 math.py
-a----        06/10/2023     07:03         107860 synthesis.py
-a----        06/10/2023     07:03          55443 transform.py
-a----        06/10/2023     07:03            427 version.py
-a----        06/10/2023     07:03        7667200 _wrapper.cp39-win_amd64.pyd
-a----        06/10/2023     07:03           1546 __init__.py

Using Anaconda Power Shell Prompt as an administrator, activating the env pichim and then starting a python shell i get the following error for the command import slycot:

(pichim) PS C:\Windows\system32> python
Python 3.9.18 (main, Sep 11 2023, 13:30:38) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import slycot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\pichim\miniconda3\envs\pichim\lib\site-packages\slycot\__init__.py", line 16, in <module>
    from .analysis import ab01nd, ab05md, ab05nd, ab07nd, ab08nd, ab08nz
  File "C:\Users\pichim\miniconda3\envs\pichim\lib\site-packages\slycot\analysis.py", line 22, in <module>
    from . import _wrapper
ImportError: DLL load failed while importing _wrapper: The specified module could not be found.

@bnavigator
Copy link
Collaborator

I could reproduce this on my win10 virtual machine with an old miniconda installation. I tried upgrading and re-installing to no avail. A switch and pin to openblas was impossible due to some resolver conflicts. This may or may not be a bug in conda. Feel free to report it there.

@pichim
Copy link
Author

pichim commented Oct 19, 2023

@bnavigator thanks a lot! i just red through conda-forge/blas-feedstock#106.
tbh this is going way deeper into technical details than i'am able to follow. i also see that it is marked as closed.

i know i had python-control running on a windows machine about 1.5 years ago. and on our school we are trying to move away from Matlab. And since a lot of our students use windows it would be absolutely crucial that the tooling for control systems is working with windows either with pycharm or vscode and conda i think.

So my question is, what is the current status and how can i support you?

Again: I greatly appreciate your help and are really great full for your effort.

If its somehow possible to use conda forge to install all relevant packages with an older version I would greatly appreciate if you could point me to a website or anything that describes how.

@bnavigator
Copy link
Collaborator

Unfortunately I am lost myself. I have been at war with the conda resolver for way too long. Apparently the build on Windows creates a library (the _wrapper...pyd) which depends on other libraries that are not found or installed.

@pichim
Copy link
Author

pichim commented Oct 19, 2023

@bnavigator do you think it would be worth creating an issue here: https://github.com/conda-forge/staged-recipes/issues?
Or if you knew a better place, just point me to it and i will help as much as I can.

@bnavigator
Copy link
Collaborator

No I don't think that would be the right place.

Please try to use this package as workaround and switch to openblas instead of mkl. It worked on my machine:

conda_slycot-pr220_py39_py311_win-64.zip

  1. unzip
  2. make a new environment, installing NumPy, SciPy, etc and stick to OpenBLAS:
mamba create -n slycot-pr220 numpy scipy control matplotlib ipykernel "libblas=*=*openblas" python=3.9
mamba install -n  slycot-pr220 .\slycot-0.5.4-py39_ga14ce93_40.tar.bz2
mamba activate slycot-pr220
python -c "import slycot; print(slycot.__version__)"
0.5.5.dev40+ga14ce93

(I used Python 3.9 because you have it in your original environment. Python 3.9 went out of SPEC0 this month, so you should upgrade soon.)

Test if it works:

mamba install pytest
pytest --pyargs slycot
(slycot-pr220) C:\Users\benji>pytest --pyargs slycot
=================================================================== test session starts ====================================================================
platform win32 -- Python 3.9.18, pytest-7.4.2, pluggy-1.3.0
rootdir: C:\Users\benji
collected 131 items

miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_ab01.py .                                                                            [  0%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_ab04md.py ..                                                                         [  2%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_ab08n.py ..                                                                          [  3%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_ab13bd.py ....                                                                       [  6%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_ab13md.py .......                                                                    [ 12%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_ag08bd.py ....                                                                       [ 15%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_analysis.py ...................                                                      [ 29%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_examples.py .............                                                            [ 39%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_exceptions.py ...                                                                    [ 41%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_mb.py ..............                                                                 [ 52%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_mc.py ...                                                                            [ 54%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_sb.py .............................                                                  [ 77%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_sb10yd.py ......                                                                     [ 81%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_sg02ad.py .                                                                          [ 82%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_sg03ad.py ...                                                                        [ 84%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_tb05ad.py ......                                                                     [ 89%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_td04ad.py .......                                                                    [ 94%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_tg01ad.py .                                                                          [ 95%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_tg01fd.py ..                                                                         [ 96%]
miniforge3\envs\slycot-pr220\lib\site-packages\slycot\tests\test_transform.py ....                                                                    [100%]

===================================================================== warnings summary =====================================================================
miniforge3/envs/slycot-pr220/lib/site-packages/slycot/tests/test_sb10yd.py::Test_sb10yd::test_sb10yd_disc_exec
miniforge3/envs/slycot-pr220/lib/site-packages/slycot/tests/test_sb10yd.py::Test_sb10yd::test_sb10yd_disc_allclose
  C:\Users\benji\miniforge3\envs\slycot-pr220\lib\site-packages\scipy\signal\_filter_design.py:1746: BadCoefficients: Badly conditioned filter coefficients (numerator): the results may be meaningless
    warnings.warn("Badly conditioned filter coefficients (numerator): the "

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================= 131 passed, 2 warnings in 4.02s ==============================================================

@pichim
Copy link
Author

pichim commented Oct 19, 2023

@bnavigator thank you very much! I tried to make this work with miniconda3 but quickly moved to miniforge.

I will summarize what you recommended in case an other windows user wants to repeat it:

  1. Install miniforge (mamba) from here: https://github.com/conda-forge/miniforge#mambaforge. I did install it as an administrator, because my windows user contains a space, e.g. Surname Name
  2. Run the Miniforge prompt as an administrator
  3. Update mamba:
mamba update -n base -c defaults mamba
  1. Create new environment and install packages:
mamba create -n <new environment> pytest numpy scipy control matplotlib ipykernel "libblas=*=*openblas" python=3.9
  1. Download conda_slycot-pr220_py39_py311_win-64.zip, extract it and place it in a folder so that the path does not contain any spaces
  2. Install it:
mamba install -n <new environment> C:\slycot\conda_slycot-pr220_py39_py311_win-64\win-64\slycot-0.5.4-py39_ga14ce93_40.tar.bz2
  1. Activate the environment:
mamba activate <new environment>
  1. Now you should be able to pytest slycot with:
pytest --pyargs slycot

@pichim
Copy link
Author

pichim commented Oct 19, 2023

@bnavigator I also tested python 3.10 and 3.11 but mamba already failed here

mamba create -n <new environment> pytest numpy scipy control matplotlib ipykernel "libblas=*=*openblas" python=3.XX

for 3.10 and 3.11.

Running the command without any argument for python results in python 3.9.

Would be great if the above would also work for never versions of python at one point in time for windows users.

Until then I'm more than happy that I can now use python-control. This is awesome!

@pichim pichim closed this as completed Oct 19, 2023
@bnavigator
Copy link
Collaborator

Glad it is working for you. When we merge conda-forge/slycot-feedstock#65 the workaround to switch to openblas should also be possible for all supported python versions with published conda-forge slycot packages.

I am still not sure why the DLL can not be loaded with MKL libraries, but honestly I am tired of tracking it down using the inferior Windows and conda tooling.

@bnavigator bnavigator reopened this Oct 19, 2023
@pichim
Copy link
Author

pichim commented Oct 19, 2023

@bnavigator nice, happy to test if you ping me.
and your point is absolutly understandabale. im just glad there is people like you making this work for people like me not really understanding all too much about whats all behind a project like this... on the other hand i would assume that python-control will get a lot more attention over time and therefor it would be really cool if this is working in the future as well. Edit: For windows users :-)

@bnavigator
Copy link
Collaborator

The new Slycot conda package is on conda-forge now.

@bnavigator
Copy link
Collaborator

The new Slycot conda package works on my Win10 VM both with mkl and openblas libraries (Python 3.12).

🎉

@pichim
Copy link
Author

pichim commented Oct 21, 2023

@bnavigator i will test this asap! Cheers mate!

@pichim
Copy link
Author

pichim commented Oct 21, 2023

@bnavigator this is not related to windows directly. i'm experimenting with wsl ubuntu 22.04 and found that I could leave cygwin and msys2 behind when using vscode :-). of course i'm also testing python-control.

Atm the following commands are resulting in a working conda environment:

conda create -n control-env python=3.11
conda install -c conda-forge pytest numpy scipy control slycot matplotlib ipykernel

but with python 3.12 the package instalaton fails. i have no idea if this is only with wsl or in general on linux distributions. I just thought maybe worth mentioning. I will now test with conda on windows.

Edit:
I just tested on both sides (windows and wsl) with miniconda3 using conda.

The above is only working if you force python=3.11. Creating a new environment without an argument creates now python 3.12, and then the package installation fails for me.

Edit:
robust_siso.py is not working with the above installation procedure on windows, only on windows.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File [c:\ProgramData\miniconda3\envs\control-env\Lib\site-packages\control\robust.py:185](file:///C:/ProgramData/miniconda3/envs/control-env/Lib/site-packages/control/robust.py:185), in hinfsyn(P, nmeas, ncon)
    184 try:
--> 185     from slycot import sb10ad
    186 except ImportError:

File [c:\ProgramData\miniconda3\envs\control-env\Lib\site-packages\slycot\__init__.py:16](file:///C:/ProgramData/miniconda3/envs/control-env/Lib/site-packages/slycot/__init__.py:16)
     11 else:
     12 
     13     # import slycot.examples
     14 
     15     # Analysis routines (15/40 wrapped)
---> 16     from .analysis import ab01nd, ab05md, ab05nd, ab07nd, ab08nd, ab08nz
     17     from .analysis import ab09ad, ab09ax, ab09bd, ab09md, ab09nd

File [c:\ProgramData\miniconda3\envs\control-env\Lib\site-packages\slycot\analysis.py:22](file:///C:/ProgramData/miniconda3/envs/control-env/Lib/site-packages/slycot/analysis.py:22)
     20 import numpy as np
---> 22 from . import _wrapper
     23 from .exceptions import raise_if_slycot_error, SlycotParameterError

ImportError: DLL load failed while importing _wrapper: The specified module could not be found.

During handling of the above exception, another exception occurred:
...
--> 187     raise ControlSlycot("can't find slycot subroutine sb10ad")
    189 n = np.size(P.A, 0)
    190 m = np.size(P.B, 1)

ControlSlycot: can't find slycot subroutine sb10ad

@pichim
Copy link
Author

pichim commented Oct 21, 2023

@bnavigator The workflow with the files conda_slycot-pr220_py39_py311_win-64.zip, mamba and python=3.11 is now working.

@pichim
Copy link
Author

pichim commented Oct 21, 2023

@bnavigator Ok, mamba is also working with directly with and python=3.11 and python=3.12

mamba create -n control-env2 pytest numpy scipy control matplotlib ipykernel slycot python=3.11
mamba create -n control-env3 pytest numpy scipy control matplotlib ipykernel slycot python=3.12

@pichim
Copy link
Author

pichim commented Oct 21, 2023

@bnavigator To summarize this:

WSL Ubuntu 22.04 using conda:

  • Working for python 3.11:
conda create -n <new-environment> -c conda-forge pytest numpy scipy control matplotlib ipykernel slycot python=3.11
  • Not working for python 3.12, package installation can not be resolved (or something):
conda create -n <new-environment> -c conda-forge pytest numpy scipy control matplotlib ipykernel slycot python=3.11

Windows using conda:

  • Not working, ControlSlycot: can't find slycot subroutine sb10ad:
conda create -n <new-environment> -c conda-forge pytest numpy scipy control matplotlib ipykernel slycot python=3.11
  • Not working, package installation can not be resolved (or something):
conda create -n <new-environment> -c conda-forge pytest numpy scipy control matplotlib ipykernel slycot python=3.11

Windows using conda, the workflow above and the files conda_slycot-pr220_py39_py311_win-64.zip:

  • Working for python=3.9 and python=3.12

Windows using mamba:

  • Working for python 3.11 and 3.12, below the example for 3.12:
mamba create -n <new-environment> pytest numpy scipy control matplotlib ipykernel slycot python=3.12

So I would assume using mamba would also work for 3.12 on wsl. I will swap to mamba for now and use wsl in parallel also with mamba.

Would be great if at one point in time the README.md of python-control and python-control slycot would get an extra entry with a description for windows users and maybe also a list with the last tested version and the exact tools that where tested to do this (both for linux users and windows users). Just an idea, i mean i have no idea about all that.

My brain hurts now a bit...

@pichim
Copy link
Author

pichim commented Oct 22, 2023

@bnavigator Ok, i cleaned up my mess, deinstalled everything that i think is not needed, started from scratch and tried only what i think is working and usefull for other users in the future.

The following is working for me on windows10 as well as on wsl ubuntu 22.04 on windows10 where i use on both sides https://github.com/conda-forge/miniforge only conda to manage virtual environments and packages:

conda update --all
conda create -n control-env-3-12 pytest numpy scipy control matplotlib ipykernel slycot python=3.12

Now i can run the examples cruise.ipynb, phaseplots.py and robustsiso.py.

But in the end with this workflow pyhon-control can now be used on windows10 as well as wsl on windows10 using miniforge for packaging and vscode for execution.

Thank you very much!

@urogers
Copy link

urogers commented Nov 12, 2023

@pichim and @bnavigator Thank you both for all this effort, it has been a life saver. Similar to pichim, we are using this for a Controls course, so this has been a major problems with students on different Anaconda versions (Python 3.9 works, 3.10 & 3.11 fail).

For those that may read this later, I've updated @pichim's example slightly for those completely new to Conda channels. This is an example for Python 3.11, and also works for Python 3.10 (obvious changes required).

conda config --add channels conda-forge
conda update --all
conda create -n control_311 pytest numpy scipy sympy control matplotlib ipykernel slycot mplcursors python=3.11

Better yet, if you already have a base install that fails to import slycot after slycot and control have already been installed, you can run the following. Most likely it will work on an environment (env) as well, but that has not tested. Given the latest push of Slycot to Conda by @bnavigator, it makes sense that it would work, preserving any special configuration you may have created = Awesome!!

conda update --all
conda update -n base -c defaults conda
conda install conda-forge slycot

Then test if import slycot now works.

@bnavigator
Copy link
Collaborator

Thank you for your feedback! As mentioned before, I am at a loss how to debug the windows DLL loader issues and have no idea how to find the cause why some (old?) conda packages do not work anymore. Any suggestions welcome.

@bnavigator bnavigator reopened this Nov 13, 2023
@moorepants
Copy link
Contributor

If you open an issue on the feedstock and ask the appropriate conda forge team for help, maybe they have some insight.

@bnavigator bnavigator added the build system Issues with compiling, linking and installing Slycot label Jan 8, 2024
@pichim
Copy link
Author

pichim commented May 9, 2024

just tested:

conda update --all 
conda create -n control-env-3-10 pytest numpy scipy control matplotlib ipykernel slycot python=3.10

using miniforge3. so python 3.10 is now fully functional on windows (have not tested wsl)

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