SciML / diffeqpy

Solving differential equations in Python using DifferentialEquations.jl and the SciML Scientific Machine Learning organization
MIT License
531 stars 39 forks source link

Deprecation warnings in setup.jl #45

Closed homocomputeris closed 5 years ago

homocomputeris commented 5 years ago

Obviously, not a breaking issue at the moment, but may be worth fixing:

┌ Warning: `haskey(o::PyObject, s::Union{Symbol, AbstractString})` is deprecated, use `hasproperty(o, s)` instead.
│   caller = numargs(::PyObject) at setup.jl:9
└ @ Main /usr/lib/python3.7/site-packages/diffeqpy/setup.jl:9
┌ Warning: `getindex(o::PyObject, s::Symbol)` is deprecated in favor of dot overloading (`getproperty`) so elements should now be accessed as e.g. `o.s` instead of `o[:s]`.
│   caller = numargs(::PyObject) at setup.jl:13
└ @ Main /usr/lib/python3.7/site-packages/diffeqpy/setup.jl:13

https://github.com/JuliaDiffEq/diffeqpy/blob/e5acd6c9d1836d920eae802f1bed10dd6d86b424/diffeqpy/setup.jl#L9-L13

ChrisRackauckas commented 5 years ago

https://github.com/JuliaDiffEq/diffeqpy/pull/46 should do it but it seems to fail? Is this PyCall master or something?

homocomputeris commented 5 years ago

I believe I have the release versions:

(v1.1) pkg> status
    Status `~/.julia/environments/v1.1/Project.toml`
  [764a87c0] BoundaryValueDiffEq v2.2.3
  [2b5f629d] DiffEqBase v5.8.1
  [aae7a2af] DiffEqFlux v0.5.0
  [0c46a032] DifferentialEquations v6.4.0
  [61744808] DynamicalSystems v1.3.0
  [587475ba] Flux v0.8.3
  [7073ff75] IJulia v1.18.1
  [682c06a0] JSON v0.20.0
  [91a5bcdd] Plots v0.25.1
  [438e738f] PyCall v1.91.2
  [d330b81b] PyPlot v2.8.1
ChrisRackauckas commented 5 years ago

Can you look at that PR? I believe I followed the depwarns correctly.

tkf commented 5 years ago

That failure may be due to #42.

homocomputeris commented 5 years ago

If I update setup.jl, I get this:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3296, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-7d45701d85a2>", line 1, in <module>
    runfile('...', wdir='...')
  File "/usr/share/pycharm/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/usr/share/pycharm/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
...
  File "...", line 52
    bvp1 = de.BVProblem(eb_beam, bc, w0, interval)
RuntimeError: Julia exception: UndefVarError: hasproperty not defined
Stacktrace:
 [1] numargs(::PyObject) at /usr/lib/python3.7/site-packages/diffeqpy/setup.jl:9
 [2] isinplace(::PyObject, ::Int64) at /home/user/.julia/packages/DiffEqBase/BvErs/src/utils.jl:26
 [3] #ODEFunction#113(::Base.Iterators.Pairs{Symbol,Nothing,NTuple{7,Symbol},NamedTuple{(:analytic, :tgrad, :jac, :invW, :invW_t, :paramjac, :syms),NTuple{7,Nothing}}}, ::Type, ::PyObject) at /home/user/.julia/packages/DiffEqBase/BvErs/src/diffeqfunction.jl:295
 [4] (::getfield(Core, Symbol("#kw#Type")))(::NamedTuple{(:analytic, :tgrad, :jac, :invW, :invW_t, :paramjac, :syms),NTuple{7,Nothing}}, ::Type{DiffEqBase.ODEFunction}, ::PyObject) at ./none:0
 [5] convert(::Type{DiffEqBase.ODEFunction}, ::PyObject) at /home/user/.julia/packages/DiffEqBase/BvErs/src/diffeqfunction.jl:614
 [6] #BVProblem#352(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Type, ::PyObject, ::PyObject, ::Array{Float64,1}, ::Tuple{Float64,Float64}, ::Nothing) at /home/user/.julia/packages/DiffEqBase/BvErs/src/problems/bvp_problems.jl:32
 [7] Type at /home/user/.julia/packages/DiffEqBase/BvErs/src/problems/bvp_problems.jl:32 [inlined] (repeats 2 times)
 [8] _pyjlwrap_call(::Type, ::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}) at /home/user/.julia/packages/PyCall/ttONZ/src/callback.jl:28
 [9] pyjlwrap_call(::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}) at /home/user/.julia/packages/PyCall/ttONZ/src/callback.jl:49

and also this:

julia> hasproperty
ERROR: UndefVarError: hasproperty not defined
julia> using Base
julia> hasproperty
ERROR: UndefVarError: hasproperty not defined

And I failed to find docs for https://github.com/JuliaLang/julia/pull/30496 in 1.1 because it requires 1.2.

ChrisRackauckas commented 5 years ago

@stevengj should https://github.com/JuliaPy/PyCall.jl/blob/fffd933828a559b794d1aadbe4273e76e5d8f84e/src/PyCall.jl#L341-L344 only throw a depwarn on v1.2?

tkf commented 5 years ago

I think you can use PyCall.hasproperty here.