Code Monkey home page Code Monkey logo

Comments (7)

ChrisRackauckas avatar ChrisRackauckas commented on July 17, 2024 1

Fixed by PythonCall transition

from diffeqpy.

ChrisRackauckas avatar ChrisRackauckas commented on July 17, 2024

@tkf do you know anything about this?

from diffeqpy.

tkf avatar tkf commented on July 17, 2024

I think it means that IPython cannot find command line program julia inside Jupyter.

To check if IPython can find julia, you can run !which julia (with !) inside Jupyter. If it says julia not found or sometihng similar, you need to specify the path to julia explicitly when using PyJulia. To find out the absolute path to julia, you can do which julia (no ! here) in the system shell (e.g., bash). Once you get the path, you can then do

from julia import Julia
Julia(runtime="PATH/TO/bin/julia")

from diffeqpy import de

with PATH/TO/bin/julia replaced with the actual path printed by which julia.

Ref: https://pyjulia.readthedocs.io/en/latest/api.html

from diffeqpy.

Omer80 avatar Omer80 commented on July 17, 2024

!which julia resulted in:

which julia julia
/usr/local/bin/julia
/usr/local/bin/julia

What seems to work is:

from julia.api import Julia
jl = Julia(compiled_modules=False)
#jl(runtime="/usr/local/bin/julia")

from diffeqpy import de

However it takes quite a long time to import the package...

from diffeqpy.

tkf avatar tkf commented on July 17, 2024

Do you get the same stacktrace as in the first post if you:

  1. Restart the IPython kernel, and then
  2. Evaluate from julia import Main

?

from diffeqpy.

Omer80 avatar Omer80 commented on July 17, 2024

I've restarted the Kernel and used:

import time
start = time.time()
from julia import Main
end = time.time()
print(end - start)

But I have got FileNotFoundError:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-4-d6cf9f272d96> in <module>
      1 import time
      2 start = time.time()
----> 3 from julia import Main
      4 end = time.time()
      5 print(end - start)

/opt/anaconda3/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_)

/opt/anaconda3/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/opt/anaconda3/lib/python3.7/importlib/_bootstrap.py in _load_unlocked(spec)

/opt/anaconda3/lib/python3.7/importlib/_bootstrap.py in _load_backward_compatible(spec)

/opt/anaconda3/lib/python3.7/site-packages/julia/core.py in load_module(self, fullname)
    244         if juliapath == 'Main':
    245             return sys.modules.setdefault(fullname,
--> 246                                           JuliaMainModule(self, fullname))
    247         elif self.julia.isafunction(juliapath):
    248             return self.julia.eval(juliapath)

/opt/anaconda3/lib/python3.7/site-packages/julia/core.py in __init__(self, loader, *args, **kwargs)
    146     def __init__(self, loader, *args, **kwargs):
    147         super(JuliaModule, self).__init__(*args, **kwargs)
--> 148         self._julia = loader.julia
    149         self.__loader__ = loader
    150 

/opt/anaconda3/lib/python3.7/site-packages/julia/core.py in julia(self)
    236     @property
    237     def julia(self):
--> 238         self.__class__.julia = julia = Julia()
    239         return julia
    240 

/opt/anaconda3/lib/python3.7/site-packages/julia/core.py in __init__(self, init_julia, jl_init_path, runtime, jl_runtime_path, debug, **julia_options)
    465             self.api = get_libjulia()
    466         elif init_julia:
--> 467             jlinfo = JuliaInfo.load(runtime)
    468             if jlinfo.version_info < (0, 7):
    469                 raise RuntimeError("PyJulia does not support Julia < 0.7 anymore")

/opt/anaconda3/lib/python3.7/site-packages/julia/juliainfo.py in load(cls, julia, **popen_kwargs)
     71             stderr=subprocess.PIPE,
     72             universal_newlines=True,
---> 73             **popen_kwargs
     74         )
     75 

/opt/anaconda3/lib/python3.7/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    798                                 c2pread, c2pwrite,
    799                                 errread, errwrite,
--> 800                                 restore_signals, start_new_session)
    801         except:
    802             # Cleanup if the child failed starting.

/opt/anaconda3/lib/python3.7/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
   1549                         if errno_num == errno.ENOENT:
   1550                             err_msg += ': ' + repr(err_filename)
-> 1551                     raise child_exception_type(errno_num, err_msg, err_filename)
   1552                 raise child_exception_type(err_msg)
   1553 

FileNotFoundError: [Errno 2] No such file or directory: 'julia': 'julia'

from diffeqpy.

PARODBE avatar PARODBE commented on July 17, 2024

Hi,

I get the same problem. Could you help me, please?

image

Thanks!

from diffeqpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.