Menu

swig not working although installed

Help
2015-11-16
2015-11-19
  • Jan Nitzbon

    Jan Nitzbon - 2015-11-16

    Hello everybody,

    I am using PyDSTool for a couple of weeks and quite happy with it up to now. In order to compute also LC-C curves I need to get the AUTO interface working.

    I am using pyhthon via the anaconda software. If I rund 'conda list' I also get the entry "pydstool 0.90.2 <pip>", so I assume that I installed PyDSTool correctly. Also there is an entry "swig 3.0.2 0".</pip>

    I have also installed gcc and gfortran. However, if I run an example which makes use of the auto interface (e.g. examples/PyCont_Lorenz.py) I get the following error message:

    unable to execute 'swig': No such file or directory

    %tb

    Traceback (most recent call last):

    File "<ipython-input-3-6abd36f6837e>", line 1, in <module>
    runfile('/home/jannitzbon/Downloads/pydstool-0.90.2/examples/PyCont_Lorenz.py', wdir='/home/jannitzbon/Downloads/pydstool-0.90.2/examples')</module></ipython-input-3-6abd36f6837e>

    File "/home/jannitzbon/.anaconda3/lib/python3.4/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 685, in runfile
    execfile(filename, namespace)

    File "/home/jannitzbon/.anaconda3/lib/python3.4/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 85, in execfile
    exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)

    File "/home/jannitzbon/Downloads/pydstool-0.90.2/examples/PyCont_Lorenz.py", line 55, in <module>
    PyCont.newCurve(PCargs)</module>

    File "/home/jannitzbon/.anaconda3/lib/python3.4/site-packages/PyDSTool-0.90.2-py3.4.egg/PyDSTool/PyCont/ContClass.py", line 212, in newCurve
    self.loadAutoMod()

    File "/home/jannitzbon/.anaconda3/lib/python3.4/site-packages/PyDSTool-0.90.2-py3.4.egg/PyDSTool/PyCont/ContClass.py", line 424, in loadAutoMod
    self.compileAutoLib()

    File "/home/jannitzbon/.anaconda3/lib/python3.4/site-packages/PyDSTool-0.90.2-py3.4.egg/PyDSTool/PyCont/ContClass.py", line 716, in compileAutoLib
    libraries=libsources)])

    File "/home/jannitzbon/.anaconda3/lib/python3.4/site-packages/numpy/distutils/core.py", line 169, in setup
    return old_setup(**new_attr)

    File "/home/jannitzbon/.anaconda3/lib/python3.4/distutils/core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))

    SystemExit: error: command 'swig' failed with exit status 1

    The content of the following folders might be of interest:

    ls examples/auto_temp
    auto_Lorenz_vf.i Lorenz_vf.c src.linux-x86_64-3.4

    ls examples/auto_temp/src.linux-x86_64-3.4
    auto_temp

    The latter folder "auto_temp" is empty.
    I also ran the swig command separately in a terminal in verbose mode which generated the following output:

    swig -v -python -I/home/jannitzbon/.anaconda3/lib/python3.4/site-packages/numpy/core/include AND SO ON (many more paths)

    Language subdirectory: python
    Search paths:
    ./
    /home/jannitzbon/.anaconda3/lib/python3.4/site-packages/numpy/core/include/
    /home/jannitzbon/Downloads/pydstool-0.90.2/examples/
    /home/jannitzbon/.anaconda3/lib/python3.4/site-packages/PyDSTool-0.90.2-py3.4.egg/PyDSTool/PyCont/auto/module/include/
    /home/jannitzbon/Downloads/pydstool-0.90.2/examples/auto_temp/
    /home/jannitzbon/.anaconda3/lib/python3.4/site-packages/PyDSTool-0.90.2-py3.4.egg/PyDSTool/PyCont/auto/src/include/
    ./swig_lib/python/
    /home/jannitzbon/.anaconda3/share/swig/3.0.2/python/
    ./swig_lib/
    /home/jannitzbon/.anaconda3/share/swig/3.0.2/
    Preprocessing...
    Starting language-specific parse...
    Processing unnamed structs...
    Processing types...
    C++ analysis...
    Generating wrappers...
    Unable to open file auto_temp/src.linux-x86_64-3.4/auto_temp/auto_Lorenz_vf_wrap.c: No such file or directory

    The latter file is indeed not existing as shown above. So does anybody have an idea why swig is not working properly in my case?

    Thanks in advance!
    Cheers, Jan

     

    Last edit: Jan Nitzbon 2015-11-16
  • Rob Clewley

    Rob Clewley - 2015-11-16

    OK, sorry to hear that. Let's deconstruct this a bit. Have you verified that Dopri or Radau tests work? Those also rely on SWIG. Your final paste doesn't indicate whether your OS reported that SWIG was actually found at the command line as a valid command. What happens if you just run "SWIG -version"?

    I'm hoping that the PIP installation removed the "-m32" flags from the compiler options, but you should verfiy that they were not present in the swig command you copy-pasted. There have been some problems reported running on 64 bit installations of python, and especially conda. Some details are here, because I'm not sure if conda installs a "dev" friendly version of python that has the required libs for what PyDSTool needs.

     
  • Jan Nitzbon

    Jan Nitzbon - 2015-11-17

    Thanks for the quick reply!
    If I rund "swig -version" I get the following output:

    SWIG Version 3.0.2
    Compiled with g++ [x86_64-unknown-linux-gnu]
    Configured options: +pcre

    So I assume this is installed correctly. From the PyDSTool examples folder I ran "interp_dopri_test.py" and it is NOT working. Similar error message as for the LC-C curve:

    running build_src
    build_src
    building py_modules sources
    building extension "/home/jannitzbon/Downloads/pydstool-0902/examples/dop853_temp._dop853_ODEtest_vf" sources
    swig: /home/jannitzbon/Downloads/pydstool-0902/examples/dop853_temp/dop853_ODEtest_vf.i
    swig -python -I/home/jannitzbon/.anaconda3/lib/python3.4/site-packages/numpy/core/include -I/home/jannitzbon/Downloads/pydstool-0902/examples -I/home/jannitzbon/.anaconda3/lib/python3.4/site-packages/PyDSTool-0.90.2-py3.4.egg/PyDSTool/integrator -o /home/jannitzbon/Downloads/pydstool-0902/examples/dop853_temp/dop853_ODEtest_vf_wrap.c -outdir /home/jannitzbon/Downloads/pydstool-0902/examples/dop853_temp /home/jannitzbon/Downloads/pydstool-0902/examples/dop853_temp/dop853_ODEtest_vf.i
    unable to execute 'swig': No such file or directory
    To exit: use 'exit', 'quit', or Ctrl-D.
    An exception has occurred, use %tb to see the full traceback.
    SystemExit: error: command 'swig' failed with exit status 1

    In this case, however, all the paths and files used by the swig command are existing.

    According to the Getting Started page you linked, I though 64bit should be working with PyDSTool >0.90.0. So this might not be the case for the anaconda installation?

    Where exactly should I remove the -m32 flags if present? In the siwg command I don't see such flags set...
    About the libs you mentionend, is it possible to manually add them to the conda installation of python if they are not present?

    I also reinstalled the whole PyDSTool package again via pip but the problem is still there.

     

    Last edit: Jan Nitzbon 2015-11-17
  • Jan Nitzbon

    Jan Nitzbon - 2015-11-19

    I solved the problem by installing the packages "python-dev" and "build-essential". Apparently some C-compiler was missing. This solution is also working with the anaconda installation of python.

     
  • Rob Clewley

    Rob Clewley - 2015-11-19

    Good to know. I thought it might be about the "dev" option. Thanks for reporting back.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.