Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you import any python library in Julia?

Tags:

python

julia

My doubt was can you import any python module or library in Julia and vice versa.I am just getting started with Julia language so just want to know about it.

like image 650
Vedant Bhosale Avatar asked Jul 07 '19 06:07

Vedant Bhosale


People also ask

Can I use NumPy in Julia?

You can call Python as needed, but you'll probably find that almost everything in NumPy and SciPy can be done natively with Julia packages. Definitely this. NumPy and SciPy are necessary in Python to make numerical computing fast, but Julia arrays are far nicer to work with (and I assume just as fast).

How do I import a Python module into Julia?

Users can import arbitrary Python modules and libraries into Julia. PyCall package is provided for calling Python from Julia code. You can use PyCall from any Julia code, including within Julia modules. And add this package to the Julia environment with Pkg.add (“PyCall”).

How do I call Python from Julia code?

Julia is a high-level, high-performance, dynamic programming language for numerical computing. Users can import arbitrary Python modules and libraries into Julia. PyCall package is provided for calling Python from Julia code. You can use PyCall from any Julia code, including within Julia modules.

How do I revise my Julia package code in Python?

You can even set this up to work with ipython, similar to the %autoreload magic, so that any change in your Julia package code is reflected in your python environment. Let’s check that out. Start up an ipython REPL, and then immediately type these magic commands: This will turn on Revise for this REPL session.

Do I need to learn Python to learn Julia?

Luckily, for those who are looking at Julia with hungry eyes, you really do not need to learn the Julia ecosystem to make an attempt at coming from Python. This can be done with the PyCall.jl package, which is used to call Python packages, as one might expect.


1 Answers

After quick googling, I found this site : https://github.com/JuliaPy/PyCall.jl where you can call python library's functions from Julia.

Here's a small example in using it (importing math module) :

using PyCall
math = pyimport("math")

You can now call functions like : math.sin() etc.

like image 163
Roshan Avatar answered Sep 22 '22 21:09

Roshan