julia.core.JuliaError: Exception 'ArgumentError' occurred while calling julia code: using PyCall

Viewed 254

I've been trying to run this project: https://github.com/pjssilva/Robot-dance

I've already installed all the required packaged, and both Julia and Python, but still I get the following error:

  File "run_robot.py", line 14, in <module>
    import prepare_data
  File "/mnt/sda1/Documents/USP/Covid/Robot-dance/prepare_data.py", line 14, in <module>
    jl = Julia(compiled_modules=False)
  File "/home/luisa/anaconda3/lib/python3.7/site-packages/julia/core.py", line 502, in __init__
    self._call(u"using PyCall")
  File "/home/luisa/anaconda3/lib/python3.7/site-packages/julia/core.py", line 536, in _call
    self.check_exception(src)
  File "/home/luisa/anaconda3/lib/python3.7/site-packages/julia/core.py", line 586, in check_exception
    .format(exception, src))
julia.core.JuliaError: Exception 'ArgumentError' occurred while calling julia code:
using PyCall

Any ideas what might the issue be?

1 Answers

You may be missing the needed Package for Julia.

After installing Julia in Python, go to Julia REPL and add the package "PyCall".

After that, try to call your function again. Working (and simple) example below:

import os

def py_func():
    from julia.api import Julia

    jl = Julia(compiled_modules=False) # If Julia is in PATH
    #jpath = "C:/julia-1.7.0/bin/julia.exe" # When Julia is not in PATH
    #jl = Julia(runtime=jpath, compiled_modules=False) # When Julia is not in PATH

    main_dir = os.path.dirname(__file__)
    julia_file = os.path.join(main_dir, "temp.jl") # Supposing both .py and .jl files are in the same directory

    from julia import Main
    Main.include(julia_file)

    jl.eval("func_in_julia()")


if __name__ == '__main__':
    py_func()
Related