Repository navigation
Issue with slycot/_wrapper.so #121
Description
Activity
I can confirm this error on python3.4 using conda (using ubuntu linux). It works correctly using python3.5 (installed via conda), so appears to be something unique to the python3.4 conda build?
A bit more info: the problem seems to be in the version of
numpythat is getting loaded byconda. Usingipython, I get the following error:In [1]: import slycot --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9 --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-1-5cdaeed6bdd3> in <module>() ----> 1 import slycot /home/ubuntu/miniconda3/envs/python3.4/lib/python3.4/site-packages/slycot/__init__.py in module>() 14 15 # Analysis routines (6/40 wrapped) ---> 16 from .analysis import ab01nd,ab05md,ab05nd,ab07nd,ab08nd, ab09ad, \ 17 ab09ax, ab09bd 18 /home/ubuntu/miniconda3/envs/python3.4/lib/python3.4/site-packages/slycot/analysis.py in <module>() 19 # MA 02110-1301, USA. 20 ---> 21 from . import _wrapper 22 import warnings 23 ImportError: numpy.core.multiarray failed to import@TMorville can you give a bit more info on how you installed python-control? Was it via conda, pip or source?
I was able to get
python-controlandlqrto work (tested usingexamples/pvtol-lqr) by uninstallingcontrolusingconda uninstall controland then installing the
python-controlpackage from source:git clone https://github.com/python-control/python-control.git cd python-control python setup.py installThis let me use the
condaversion ofslycot(so no FORTRAN compiler required) but the latest version ofnumpy(so no issues with the version error).Python is anaconda build, slycot and control was installed with pip. My PATHs are correct and which python yields correct lib. Also I've tried to build control from source as you suggested, but with the same error as I posted above. I've never seen the error related to numpy.
I did a bit more checking and have reproduced this error in an anaconda build on my mac, using the
control-0.7.0install instructions. It looks like the issue that I ran into is that there were missing libraries that causedslycotto fail, which then generated the errors above.Slycotwas installed via pip, but looks like the required libraries didn't copy over.@TMorville: what OS are you using? We may need to redo the
slycotbuilds onpython.orgto get pip working correctly. (@cwrowley: will need your help with this, since I am not listed as a maintainer forslycot).@murrayrm I'm on OS X, Sierra 10.12.2. Slycot is 0.2.0 and Control is 0.7.0. Let me know if I can do anything else.
@TMorville: OK, I have a possible fix but need some help in trying it out. First, you need to uninstall the current
slycotinstallation that you have installed with pip:pip uninstall slycotNow re-install slycot using conda:
conda install -c python-control -c cyclus slycotThis command should install
slycot-0.3.0from the python-control channel andlapack-3.5.0from the cyclus channel (who has compiled this standard library for osx).Once you have done this, you should be able to
import slycotand also run LQR usingcontrol.lqr(). In particular, the filepython-control/examples/pvtol-lqr.pyfrom thepython-controlsource distribution ran when I tested this process on my mac using a Python 3.4 anaconda environment.Let me know if all of that works. If so, you are good to go and I'll document this fix in the (to be created) troubleshooting section of the user manual.
@murrayrm implemented as you suggested. Still does not work I'm afraid.
import slycotTraceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/username/anaconda/lib/python3.4/site-packages/slycot/__init__.py", line 16, in <module> from .analysis import ab01nd,ab05md,ab05nd,ab07nd,ab08nd, \ File "/Users/username/anaconda/lib/python3.4/site-packages/slycot/analysis.py", line 21, in <module> from . import _wrapper ImportError: dlopen(/Users/username/anaconda/lib/python3.4/site-packages/slycot/_wrapper.so, 2): Library not loaded: /opt/local/lib/libgcc/libgfortran.3.dylib Referenced from: /Users/username/anaconda/lib/python3.4/site-packages/slycot/_wrapper.so Reason: image not foundAnd trying to use
lqr()yieldsTraceback (most recent call last): File "/Users/username/anaconda/lib/python3.4/site-packages/control/statefbk.py", line 188, in lqr from slycot import sb02md File "/Users/username/anaconda/lib/python3.4/site-packages/slycot/__init__.py", line 16, in <module> from .analysis import ab01nd,ab05md,ab05nd,ab07nd,ab08nd, \ File "/Users/username/anaconda/lib/python3.4/site-packages/slycot/analysis.py", line 21, in <module> from . import _wrapper ImportError: dlopen(/Users/username/anaconda/lib/python3.4/site-packages/slycot/_wrapper.so, 2): Library not loaded: /opt/local/lib/libgcc/libgfortran.3.dylib Referenced from: /Users/username/anaconda/lib/python3.4/site-packages/slycot/_wrapper.so Reason: image not foundStrange. Can you try setting up a clean environment and then doing an install. Here are the commands that I used (and that worked on my machine):
conda create -n python3.4-slycot-test python=3.4 source activate python3.4-slycot-test conda install numpy scipy matplotlib conda install -c python-control -c cyclus slycot controlLet me know if that generates the same error. If so, I'll have to figure out what to uninstall from my test environment to recreate the problem.
The original path of
slycotshown in the error message of the opening post is in an Anaconda directory.@TMorville Instead of using
pipto remove the package (as in #121 (comment)), consider tryingconda uninstall slycot@murrayrm still no dice. The test env. works fine, but import slycot gives the same error as above, but now just in the test environment.
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/username/anaconda/envs/python3.4-slycot-test/lib/python3.4/site-packages/slycot/__init__.py", line 16, in <module> from .analysis import ab01nd,ab05md,ab05nd,ab07nd,ab08nd, \ File "/Users/username/anaconda/envs/python3.4-slycot-test/lib/python3.4/site-packages/slycot/analysis.py", line 21, in <module> from . import _wrapper ImportError: dlopen(/Users/username/anaconda/envs/python3.4-slycot-test/lib/python3.4/site-packages/slycot/_wrapper.so, 2): Library not loaded: /opt/local/lib/libgcc/libgfortran.3.dylib Referenced from: /Users/username/anaconda/envs/python3.4-slycot-test/lib/python3.4/site-packages/slycot/_wrapper.so Reason: image not found@slivingston Tried
conda uninstall slycot, and generally reproducing the entire problem without usingpip. Also, does not seem to change anything.This relates to the use of a newer LAPACK, from which dgesv has been deprecated and removed. See pull request number 13 on Slycot
Since I found this open issue when googling the same error message, it is useful here to note that the conda-forge installation process for control and slycot (see #115) solved this problem for me, presumably because it uses an older version of LAPACK.
I think this issue is "resolved" from the point of view of python-control, in the sense that it relates to getting a working version of slycot up and running. As @repagh noted above, the issue with lapack as been resolved in Slycot PR #13.
I have some cryptic issue with slycot:
Using the lqr in Control gives:
And just using doing
import slycotin python rises: