Reputation: 121
I'm a new beginner with python und have recently installed Julia. And as I wrote "from julia import Main" in Jupyter note through Anaconda, an error would occur which is "no module named 'julia'". I don't know which part is wrong or is this about the path of the installation of Julia? enter image description here
I would appreciate it so much if you could help me.
Upvotes: 2
Views: 1095
Reputation: 4370
"from x import y" is the syntax for importing Python packages in a Python script or notebook, but as you probably know, Julia is a separate language of its own, not a Python package.
If you want to use Julia in a Jupyter notebook, you will instead generally want to change the whole Jupyter kernel to Julia from Python, rather than just adding a package (though see comment from Przemyslaw above if you want to call Julia from Python for any reason).
The easiest way to install a Julia kernel for Jupyter and start a notebook using that kernel is to just start the Jupyter notebook from Julia. In other words, first start Julia, so that you have a Julia REPL that looks something like the image below, and then type
julia> using Pkg; Pkg.add("IJulia") # If IJulia is not already installed
julia> using IJulia
julia> notebook()
which will open up a Jupyter instance with a Julia kernel installed, from which you can open a new notebook using that Julia kernel
which should look like the following (note the Julia symbol in the upper right corner)
Note that at no point in this process do you use Python or Anaconda for anything, and note also that in Julia there is no from
keyword and also generally no such thing as Main
Upvotes: 4