question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while calling julia from python

See original GitHub issue

jl.sind(90) AttributeError: 'Julia' object has no attribute 'sin

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kmsquirecommented, Nov 20, 2016

It seems that defining jl = Julia() inside the function is the source of the problem, although I’m not sure exactly why. If you instead either define jl = Julia() as a global variable, or pass it in as a parameter to the function, everything works fine:

from julia import Julia

jl = Julia()

def harris_jul(frame, lib_func):
    print jl.sind(90)
    return frame

In Julia and most other modern programming languages, globals are discouraged, but in this case, it could be argued that this is a singleton instance that plays a similar role to a module. At any rate, treating it like a singleton, you could do something a little fancier like

from julia import Julia

def julia_singleton():
    if not hasattr(julia_singleton, "__instance"):
        julia_singleton.__instance = Julia()
    return julia_singleton.__instance

def harris_jul(frame, lib_func):
    jl = julia_singleton()
    print jl.sind(90)
    return frame

which seems to work just fine, and is arguably better than a simple global variable.

0reactions
karanaggarwal1994commented, Nov 25, 2016

Is there any check condition that we can put to check if a Julia function with same signature exists then skip it else make it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Calling julia from python with flask returns error - Stack Overflow
I want to execute a code in Julia calling it from python. When I run it locally on my machine, it works fine,...
Read more >
Error while Python calling Julia · Issue #83 · JuliaPy/pyjulia
Assignees. No one assigned ; Projects. None yet ; Milestone. No milestone.
Read more >
Efficiency for calling Julia from python and purely run Julia
The main issue is, I plan to call julia from python to accelerate the performance ... ERROR: package(s) LoopVectorization, TensorOperations not in project...
Read more >
Error while calling Julia from python - Google Groups
j=julia.Julia() WARNING: CHOLMOD version incompatibility. Julia was compiled with CHOLMOD version 3.0.6. It is currently linked with version 2.1.2.
Read more >
Usage — PyJulia 0.6.0 documentation - Read the Docs
from julia import Base. and then call Julia functions in Base from python, e.g.,. >>> Base.sind(90). Other variants of Python import syntax also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found