SciML / PyDSTool.jl

A wrapper for the Python PyDSTool library for the SciML Scientific Machine Learning organization
Other
7 stars 11 forks source link

PyDSTool crashes when using system Anaconda Python 3 on Linux #7

Open Citronnade opened 6 years ago

Citronnade commented 6 years ago

Hardware: Linux Mint 18.1 64-bit. System python: 3.6.2 (Anaconda). Julia 0.6.2.

Stack trace:

ERROR: PyError (ccall(@pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, arg, C_NULL)) <class 'TypeError'>
TypeError("'float' object cannot be interpreted as an integer",)
  File "/home/max/anaconda3/lib/python3.6/site-packages/PyDSTool/PyCont/Continuation.py", line 1246, in forward
    self._compute(v0=self.initdirec)
  File "/home/max/anaconda3/lib/python3.6/site-packages/PyDSTool/PyCont/Continuation.py", line 1102, in _compute
    self._createTestFuncs()
  File "/home/max/anaconda3/lib/python3.6/site-packages/PyDSTool/PyCont/Continuation.py", line 2035, in _createTestFuncs
    save=True, numpoints=self.MaxNumPoints+1)
  File "/home/max/anaconda3/lib/python3.6/site-packages/PyDSTool/PyCont/TestFunc.py", line 719, in __init__
    BiAltMethod.__init__(self, (F.n, 1), F, C, save=save, numpoints=numpoints)
  File "/home/max/anaconda3/lib/python3.6/site-packages/PyDSTool/PyCont/TestFunc.py", line 381, in __init__
    self.data.P = zeros((n*(n-1)/2, n*(n-1)/2), float)

Stacktrace:
 [1] pyerr_check at /home/max/.julia/v0.6/PyCall/src/exception.jl:56 [inlined]
 [2] pyerr_check at /home/max/.julia/v0.6/PyCall/src/exception.jl:61 [inlined]
 [3] macro expansion at /home/max/.julia/v0.6/PyCall/src/exception.jl:81 [inlined]
 [4] #_pycall#67(::Array{Any,1}, ::Function, ::PyCall.PyObject) at /home/max/.julia/v0.6/PyCall/src/PyCall.jl:653
 [5] #pycall#71(::Array{Any,1}, ::Function, ::PyCall.PyObject, ::Type{PyCall.PyAny}) at /home/max/.julia/v0.6/PyCall/src/PyCall.jl:675
 [6] #call#72 at /home/max/.julia/v0.6/PyCall/src/PyCall.jl:678 [inlined]
 [7] (::PyCall.PyObject)() at /home/max/.julia/v0.6/PyCall/src/PyCall.jl:678
 [8] #bifurcation_curve#5(::Int64, ::Int64, ::Float64, ::Float64, ::String, ::Bool, ::String, ::Bool, ::Bool, ::Void, ::Array{Symbol,1}, ::PyDSTool.#bifurcation_curve, ::PyCall.PyObject, ::String, ::Array{String,1}) at /home/max/.julia/v0.6/PyDSTool/src/bifurcation.jl:102
 [9] (::PyDSTool.#kw##bifurcation_curve)(::Array{Any,1}, ::PyDSTool.#bifurcation_curve, ::PyCall.PyObject, ::String, ::Array{String,1}) at ./<missing>:0

Switching PyCall to use Conda's Python installation (2.7) works. Running PyDSTool directly using the same Python (Anaconda Python 3) also works--just Julia with system Python doesn't.

Somewhat relevant post on the PyDSTool forums (not sure if it's the same problem or not): https://sourceforge.net/p/pydstool/discussion/472291/thread/30b4c876/

Possibly due to n*(n-1)/2 being a float?

ChrisRackauckas commented 6 years ago

Thanks for the report. I know @tkf was working on some PyDSTool updates, I wonder if he knows something about this.

tkf commented 6 years ago

Possibly due to n*(n-1)/2 being a float?

Yea, my guess is the same.

I sent a PR a while ago for fixing the integer divisions to make PyCont work with Python 3 https://github.com/robclewley/pydstool/pull/125

korsbo commented 6 years ago

I'm having the same problem.