Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when import the "de" from the "diffeqpy" #141

Closed
HuynhTran0301 opened this issue May 13, 2024 · 1 comment
Closed

Error when import the "de" from the "diffeqpy" #141

HuynhTran0301 opened this issue May 13, 2024 · 1 comment
Labels
question Further information is requested

Comments

@HuynhTran0301
Copy link

HuynhTran0301 commented May 13, 2024

Question❓

I tried to import the DifferentialEquations tools from the diffeqpy package following the instructions after installing the package as:

from diffeqpy import de

I got the error below:

File [C:\ProgramData\Anaconda3\lib\site-packages\diffeqpy\de.py:5](file:///C:/ProgramData/Anaconda3/lib/site-packages/diffeqpy/de.py#line=4)
      3 de, _, _ = load_julia_packages("DifferentialEquations", "ModelingToolkit", "PythonCall")
      4 from juliacall import Main
----> 5 de.jit = Main.seval("jit(x) = typeof(x).name.wrapper(ModelingToolkit.complete(ModelingToolkit.modelingtoolkitize(x)), x.u0, x.tspan, x.p)") # kinda hackey
      6 de.jit32 = Main.seval("jit(x) = typeof(x).name.wrapper(ModelingToolkit.complete(ModelingToolkit.modelingtoolkitize(x)), Float32.(x.u0), Float32.(x.tspan), Float32.(x.p))") # kinda hackey
      7 sys.modules[__name__] = de # mutate myself

File [~\.julia\packages\PythonCall\S5MOg\src\JlWrap\any.jl:219](http://localhost:8888/lab/tree/~/.julia/packages/PythonCall/S5MOg/src/JlWrap/any.jl#line=218), in __setattr__(self, k, v)
    217     else:
    218         return
--> 219     self._jl_callmethod($(pyjl_methodnum(pyjlany_setattr)), k, v)
    220 def __dir__(self):
    221     return ValueBase.__dir__(self) + self._jl_callmethod($(pyjl_methodnum(pyjlany_dir)))

AttributeError: Julia: cannot assign variables in other modules

In addition, it did not have a problem when I imported the ode.
Please help me how to fix the error.
Thank you for your time and consideration.

@HuynhTran0301 HuynhTran0301 added the question Further information is requested label May 13, 2024
@ChrisRackauckas
Copy link
Member

Closing as a repeat of #135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants