简体   繁体   中英

Calling a Julia 0.4 function from Python. How i can make it work?

I wrote an optimization function in Julia 0.4 and I want to call it from Python. I'm storing the function in a .jl file in the same working directory as the Python code. The data to be transferred is numeric, and I think of using Numpy arrays and Julia arrays for calls. Is there a tutorial on how to make this work?

Check out the pyjulia module . It allows you make calls to Julia from within Python

In my experience, calling Julia using the Python pyjulia package is difficult and not a robust solution outside HelloWorld usage.

1) pyjulia is very neglected.

There is practically no documentation aside the source code. For example, the only old tutorials I've found still use julia.run() that was replaced by julia.eval(). pyjulia is not registered on PyPI, the Python Package Index. Many old issues have few or no responses. And buggy, particularly with heavy memory usage and you could run into mysterious segfaults. Maybe, garbage collector conflicts...

2) You should limit pyjulia use to Julia functions that return simple type

Julia objects imported to python using pyjulia are difficult to use. pyjulia doesn't import any type constructors. For example, pyjulia seems to convert complex Julia types into plain python matrix.

3) If you can isolate the software modules and manage the I/O, you should consider the shell facility, particularly in Linux / Unix environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM