Repository navigation
Description
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!
Activity
bnavigator commentedon Oct 17, 2023
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 slycotin a python shell?pichim commentedon Oct 17, 2023
@bnavigator Thank you for your response.
_wrapper.cp39-win_amd64.pydis listed, see below.Using Anaconda Power Shell Prompt as an administrator, activating the
envpichim and then starting a python shell i get the following error for the commandimport slycot:bnavigator commentedon Oct 18, 2023
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 commentedon 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 commentedon Oct 19, 2023
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 commentedon 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 commentedon Oct 19, 2023
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
(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:
pichim commentedon 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:
Surname Namepichim commentedon Oct 19, 2023
@bnavigator I also tested python 3.10 and 3.11 but mamba already failed here
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!
bnavigator commentedon Oct 19, 2023
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.
pichim commentedon 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 commentedon Oct 21, 2023
The new Slycot conda package is on conda-forge now.
1 remaining item
pichim commentedon Oct 21, 2023
@bnavigator i will test this asap! Cheers mate!
pichim commentedon 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:
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.
pichim commentedon 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 commentedon Oct 21, 2023
@bnavigator Ok, mamba is also working with directly with and python=3.11 and python=3.12
pichim commentedon Oct 21, 2023
@bnavigator To summarize this:
WSL Ubuntu 22.04 using conda:
Windows using conda:
Windows using conda, the workflow above and the files conda_slycot-pr220_py39_py311_win-64.zip:
Windows using mamba:
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 commentedon 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:
Now i can run the examples
cruise.ipynb,phaseplots.pyandrobustsiso.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 commentedon 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).
Better yet, if you already have a base install that fails to
import slycotafter 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!!Then test if
import slycotnow works.bnavigator commentedon Nov 13, 2023
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.
moorepants commentedon Nov 13, 2023
If you open an issue on the feedstock and ask the appropriate conda forge team for help, maybe they have some insight.
pichim commentedon May 9, 2024
just tested:
using miniforge3. so python 3.10 is now fully functional on windows (have not tested wsl)
bnavigator commentedon Jun 16, 2026
We now publish working Windows wheels and conda-forge should also be functional.