IJulia is not connecting to Jupyter Notebook - julia

Whenever I try to open up a Jupyter notebook via Anaconda, I do not have a "Julia" code option. I have tried using Pkg., uninstalling Julia and Anaconda but my Mac does not seem to be connecting the two. I have also tried to open a Jupyter notebook directly from the Julia Kernel and that still is not working! I'm not sure what the issue is or what I should do next, here is the error:
(#v1.5) pkg> add "IJulia"
Updating registry at `~/.julia/registries/General`
######################################################################## 100.0%
Resolving package versions...
No Changes to `~/.julia/environments/v1.5/Project.toml`
No Changes to `~/.julia/environments/v1.5/Manifest.toml`

The output you showed is not an error. It is saying that IJulia is already installed in your system.
You need to run the notebook method from IJulia package.
Do:
julia> Using IJulia
julia> notebook()
If you don't have juypter already installed it prompt asking if you want to install it simply press y and it will start it in your browser automatically.
Also if for any reason it didn't open it automatically you can open it yourself.
Type localhost:8888(or you can click the link) in your browser url bar to open it.

What you posted does not indicate an error, it merely says that IJulia is already installed in your default environment: no changes were needed to add it.
You next step should now be to run:
julia> using IJulia
julia> IJulia.notebook()
After this, a new notebook should open in your browser.

I ever had an issue like this also. To solve this you need to rebuild the IJulia by run like below:
Using Pkg
Pkg.add("IJulia")
Pkg.build("IJulia")

Related

Can't run Julia in Jupyter notebook?

Has anyone had a problem running julia from a jupyter notebook?
I have looked at how-to pages like this one and this one, which all pretty much recommend the same series of steps:
Open the terminal, launch Julia, and Pkg.add("IJulia").
I follow this step and got the following output
Resolving package versions...
Updating `~/.julia/environments/v1.7/Project.toml`
[7073ff75] + IJulia v1.23.3
Updating `~/.julia/environments/v1.7/Manifest.toml`
[7073ff75] + IJulia v1.23.3
[b85f4697] + SoftGlobalScope v1.1.0
[c2297ded] + ZMQ v1.2.1
[8f1865be] + ZeroMQ_jll v4.3.4+0
[a9144af2] + libsodium_jll v1.0.20+0
Launch a Jupyter session and choose a Julia kernel.
I'm able to launch a Jupyter session. However, when I click new, all my option are Python kernels. I don't see anywhere to launch a Julia kernel.
Has anyone run into a similar problem??
I am running macOS Monterey, version 12.4, Apple M1 Max Chip.
My julia is 1.7.2
Try a different step 2:
julia> using IJulia
julia> notebook()
This should open Jupyter in a new browser/tab window. Do you see the Julia kernel in this window? (In which case you might just have different Jupyter versions installed on your system).
you're probably using a jupyter notebook that didn't come with IJulia, thus, you will have to install a kernel spec (a JSON file) so the jupyter knows where to find Julia kernel.
Try following:
https://julialang.github.io/IJulia.jl/stable/manual/installation/#Installing-IJulia
More specifically,
You can force it to use a specific jupyter installation by setting ENV["JUPYTER"] to the path of the jupyter program before running Pkg.build("IJulia")
That's probably because the Jupyter notebook you have installed doesn't have IJulia installed. You will have to load IJulia to access Jupyter with a Julia kernel to fix that.
julia> using IJulia
julia> notebook()
I had the same problem which was the result of having an older version of Jupyter. I solved it by uninstalling and reinstalling the latest jupyter, then added the R and Julia kernels from thw official R, through R Studio, and Julia sites respectively where each kernel installation did not take more than 2 minutes and all work well.
Good luck
EK

Julia 1.6.2 not appearing in Jupyter notebook

I have installed julia 1.6.2 , jupyter notebook and anaconda 3 according to this website:
https://datatofish.com/add-julia-to-jupyter/
I have also checked other websites and the steps of installation were similar. However, I have a problem in step 5 of the above link, as Julia 1.0 doesn't appear and only Python appears. ( Text File, Folder, and Terminal also appear in the Others section )
Any ideas on what the problem is? I have also set the environment variable of Julia by going to System Variables and adding the bin folder of julia to Path. ( Windows 10 OS)
Also, after installing Julia, these were the lines I entered to install other things.
import Pkg
# installs IJulia package
Pkg.add("IJulia")
using IJulia
# launch Jupyter notebook
notebook()
After these, I opened julia again and typed:
import Pkg
Pkg.add("NBInclude")
Julia 1.0 is really old, please use the latest 1.6.2 and follow official installation guide for Jupyter notebook support (IJulia): https://julialang.github.io/IJulia.jl/dev/manual/installation/
Usually, it's as simple as ]build IJulia, where pressing ] at the REPL drops you into the pkg> mode
I had this issue also. To solve it, you just need to rebuild your IJulia kernel by running command below on Julia apps:
Using Pkg
Pkg.add("IJulia")
Pkg.build("IJulia")
I agree with the answer of #jling. Use an up-to-date julia version if you can. In case you need an old julia version, I have recently created a docker container that provides julia 1.1 inside jupyter notebooks (and I think python as well).
You can find the Dockerfile here: https://github.com/cherrywoods/HorizontalCAS
Nevermind all the code, only the Dockerfile is relevant (and maybe the last section of the Readme). I guess this dockee fiƶe should also work with julia 1.0 if you change the file accordingly.

IJulia fails with precompiling LoadError

I have installed Julia 1.5.3 on Ubuntu but IJulia falis with LoadError as shown in the screenshot.
The first path to the conda environment is very wrong, this is running on Ubuntu. The path shown below Precompliling is a WINDOWS path.
Where in the scripts can I correct this reference and allow IJulia to install ?
It looks like you have had an Anaconda installation that is not available anymore yet your paths are pointing to it. The best thing to do is to install an Anaconda inside Julia. This also works best in practice.
using Pkg
ENV["PYTHON"]=""
Pkg.add("PyCall")
Pkg.build("PyCall")
Pkg.add("Conda")
using Conda
Conda.runconda(`install jupyter --yes`)
Pkg.build("IJulia")
Now your code will work.
using IJulia
notebook(dir=".")
Remember also to try Pluto Pkg.add("Pluto") - a new generation of notebooks for Julia.

How do you add Jupyter Notebook kernels for prior versions of Julia?

I am using a Windows machine and trying to have Jupyter Notebook kernels for multiple versions of Julia (0.7.0 and 1.1.1) because package AWS does not support the latest version, but does support 0.7.0.
I had Julia 1.1.1 installed on my computer first and got something similar to the following error when I tried to install package AWS: https://github.com/JuliaLang/Pkg.jl/issues/792
Then I installed Julia 0.7.0 and was able to install AWS in the Julia 0.7.0 terminal with Pkg.add("AWS") with no problems.
In the Julia 0.7.0 terminal, I installed IJulia again with Pkg.add("IJulia") and restarted my Jupyter notebook instance. Now I'd like to use AWS via Jupyter notebook but when I create a new one, only Julia 1.1.1 appears.
I ended up having success by showing which kernels I had using jupyter kernelspec list in terminal, which showed where my other Julia kernel was located.
>>> jupyter kernelspec list
Available Kernels:
julia-1.1 C:\Users\{%USERNAME%}\AppData\Roaming\jupyter\kernels\julia-1.1
python3 C:\ProgramData\Anaconda3\share\jupyter\kernels\python3
I navigated to the file path listed after julia-1.1
Created a julia-0.7 folder in that same directory
Copied over contents from the julia-1.1 folder
Edited the kernel.json file by replacing every instance of julia-1.1.1 with julia-0.7.0
What I ended up having success with seems like a very rudimentary way to solve this problem. I'd like a more elegant way to achieve the same result, similar to when adding multiple kernels for different versions of Python. (Using both Python 2.x and Python 3.x in IPython Notebook)
Please help, thank you!
You (probably) just need to Pkg.build("IJulia") on the second Julia version.
Since Julia 0.7 the package manager uses separate directories for each version of a package, meaning that, from the package managers perspective, the package is already installed, and no downloading or building is performed when you install the same version from a different Julia version. The package manager does not know, however, that IJulia needs to be rebuilt for this new Julia version. You can trigger the build manually by Pkg.build("IJulia").

Julia notebook in win64

I followed the instructions in https://github.com/JuliaLang/IJulia.jl
using Pkg
Pkg.add("IJulia")
using IJulia
notebook()
After creating an IJulia notebook, it gets stuck at "In[*]" trying to calculate 1+1. I created a python notebook and the same code runs fine. The Julia prompt is also able to run this calculation.
Starting jupyter from the Anaconda console and running the same IJulia notebook does not show any error either.
The Julia kernel takes about 10 s to start, which seems to be a long time compared to the python kernel.
What could be the problem?
You are running into https://github.com/JuliaLang/IJulia.jl/issues/693. IJulia isn't working under Julia v0.7+ yet (at least on Windows). People are presumably working hard to fix this, so let's hope this issue vanishes soon.
Note, the link above contains a temporary fix, if you are willing to try.

Resources