Updating Julia, IJulia

I previously used an Julia 1.5 with the IJulia notebook to run an Mimi package.
I installed the new version of Julia via julia-1.9.3-win64.exe.

The new path is C:\Users\Ken\AppData\Local\Programs\Julia-1.9.3\bin

The IJulia quick start GitHub - JuliaLang/IJulia.jl: Julia kernel for Jupyter
says Install IJulia from the Julia REPL by pressing ] , then enter: add IJulia.
This gives errors;
Updating registry at C:\Users\Ken\.julia\registries\General
ERROR: GitError(Code:ENOTFOUND, Class:Config, config value ‘safe.directory’ was not found)

The IJulia page says " Alternatively, you can have IJulia create and manage its own Python/Jupyter installation. To do this, type the following in Julia, at the julia> prompt:
using IJulia
This gives errors;
Package IJulia not found, but a package named IJulia is available from a
Install package?
(@v1.9) pkg> add IJulia
(y/n/o) [y]:
Updating registry at C:\Users\Ken\.julia\registries\General
ERROR: GitError(Code:ENOTFOUND, Class:Config, config value ‘safe.directory’ was not found)
Both methods give the same error.

This other IJulia page Installation · IJulia
says "… If you install a new Julia binary (or do anything that changes the location of Julia on your computer), you must update the IJulia installation (to tell Jupyter where to find the new Julia) by running Pkg.build(“IJulia”)
at the Julia command line.
This gives errors;
ERROR: UndefvarError: ‘Pkg’ not defined

The two IJulia pages give different instructions, neither apparently work.
Please provide instructions so that I can run the IJulia and notebook.

1 Like

Sorry to see you having such troubles getting going.
I don’t think this is an error with IJulia: it seems that there is a problem with the package installation process. Can you install another unrelated package, like DataFrames ?

It appears that you may have a git configuration issue related to the following security issue.

I suggest the following action. Rename the folder “C:\Users\Ken.julia\registries” to “C:\Users\Ken.julia\registries_old”. Then retry adding IJulia.

The last error that you reported can be fixed by doing using Pkg before running Pkg.add("IJulia")

The following Julia REPL command sequence might help address the issue.

julia> rpath = joinpath(DEPOT_PATH[1], "registries")

julia> mv(rpath, rpath *"_old")

julia> using Pkg

julia> pkg"registry add General"

julia> pkg"add IJulia"

Could you tell us about the C:\Users\Ken\.julia
directory? Did you copy it from another computer or has it been there since you last tried Julia 1.5?


I am running Windows10.
I changes “C:\Users\Ken.julia\registries” to “C:\Users\Ken.julia\registries_old”.
At the julia> prompt I entered; rpath = joinpath(DEPOT_PATH[1], “registries”)
Julia returned: “C:\users\Ken.julia\registries”
I entered; mv(rpath, rpath *“_old”)
Julia returned: ERROR: ArgumentError: 'C:\users\Ken.julia\registries_old" exists. ‘force=true’ is required to remove ‘C:\users\Ken.julia\registries_old’ before moving.

I am not sure what that is asking me to do. What is my next step?

I didn’t copy C:\Users\Ken\.julia from another computer. The directory was installed with Julia1.5 or possibly and older Julia.

Repeat and change it to mv(rpath, rpath *"_old2").

at the pkg> prompt I entered; add DataFrames
Julia returned;
Installing known registries into C:\Users\Ken\.julia
Updating registry at C:\Users\Ken\.julia\registries\General.toml
Resolving package versions…
Installed Crayons ──────────── v4.1.1

Precompiling project…
25 dependencies successfully precompiled in 61 seconds. 5 already precompiled.
pkg> So it installed fine.

I repeated as you requested and got the same error message.
That is, I changed C:\Users\Ken.julia\registries to C:\Users\Ken.julia\registries_old2
At the julia> prompt I entered; rpath = joinpath(DEPOT_PATH[1], “registries”)
Julia returned: “C:\users\Ken.julia\registries”
I entered; mv(rpath, rpath *“_old2”)
Julia returned: ERROR: ArgumentError: 'C:\users\Ken.julia\registries_old2" exists. ‘force=true’ is required to remove ‘C:\users\Ken.julia\registries_old2’ before moving.

I didn’t see why repeating what I did before would get a successful result.

Well it does not matter now that you got the packages to install.

It sounds like you solved your problem.

I entered at the prompt;
Julia> import pkg
Julia> using IJulia
Julia> notebook()

The Jupyter notebook opened.
I opened the file; Documents/MimiFUND.jl-3.13.0/examples/fund_demo.ipynb
The notebook shows “Kernel Error”, so from the menu I selected; Kernel> Change kernel> which shows Julia 1.2, 1.4, 1.5.3.
There is no Julia 1.9.3 listed.
How can I make the Jupter notebook to recognize Julia 1.9.3 version?

Please use triple backticks before and after the code, so that your posts become more readable :wink:

I think that rebuilding IJulia should help, that step always reinstalls the kernel configuration. Try the following:

julia> import Pkg

julia> Pkg.build("IJulia")

after that, reload the Jupyter notebook web GUI and you should see the Julia kernel.

I don’t know what triple backticks are. What key strokes? I can use the quotes is this window’s menu. I used the command;

julia> Pkg.build(“IJulia”)

That worked. Thanks.

Question: When I enter;

Julia> notebook()

Julia gives many lines of info with a flashing cursor on the last line, and the notebook opens in a brower. I hoped that clicking on “Logout” at the top to the notebook would cause the Julia window to display the Julia prompt but it doesn’t.
How do I return to a Julia prompt without closing the Julia window and restarting Julia?

1 Like

You are almost there, just one button to the right (looks like </>), it will insert two lines with triple backticks.

Even if you close the browser, the notebook’s kernel will still run. This can be quite handy if you don’t want to accidentally lose the session when closing the window. If you want your Julia prompt back, you can hit CTRL+C. It might be that this keyboard combination will not work on Windows, I have no idea. In UNIX-like systems CTRL+C sends a keyboard-interrupt signal. On windows it’s the “copy to clipboard” command :wink: but it depends on what kind of terminal/powershell you use (I have no experience running this stuff on Windows). Maybe try SHIFT+CTRL+C if CTRL+C has no effect…

In Julia, I entered commands;

Pkg> add Mimi
Pkg> add MimiFUND
Julia> using Mimi
Julia> using MimiFUND
Julia> m = MimiFUND.get_model()
Julia> run(m)
Julia> m[:socioecomonic, :income]

Then Julia produces an array of income values.
However, in the Jupyter notebook, I run the first cell;

using Mimi

notebook gives

ArgumentError: Package Mimi [e4e893b0-ee5e-52ea-8111-44b3bdec128c] is required but does not seem to be installed:

  • Run Pkg.instantiate() to install all recorded dependencies.

so I ran in the next cell;

which give the error;
UndefVarError: Pkg not defined

So Mimi and MImiFUND work is Julia, but not in the notebook.
What am I doing wrong?

In the Jupyter notebook, run

using Pkg

Then report the output to us.

That returns;

Project MimiFUND v3.13.0
Status C:\Users\Ken\Documents\MimiFUND.jl-3.13.0\Project.toml
[8bb1440f] DelimitedFiles
[31c24e10] Distributions
[e4e893b0] Mimi
[2913bbd2] StatsBase
[ade2ca70] Dates
[9a3f8284] Random

Run thr following in the notebook.

using Pkg

Also, why does it look like you just hit the download button on Github rather than following the instructiosn here:

OK, this worked. MimiFUND now runs fine in the notebook.
Note that I was just following the instruction. The notebook error only says to Run Pkg.instantiate(). It doesn’t say to run using Pkg before that. This error message should be fixed.

Thanks for your help

Now I want to understand where my updating Julia, IJulia, Mimi and MimiFUND went wrong. I’ll reply to your next message soon.

I started by going to GitHub - fund-model/MimiFUND.jl: FUND - Climate Framework for Uncertainty, Negotiation and Distribution
where it said;

You need to install Julia 1.6.0 or newer to run this model. You can download Julia from Download Julia.

So I chose Windows 64-bit installer and downloaded julia-1.9.3-win64.exe

I double-clicked that file and istalled it. I uninstall my previous two versions of Julia.
Are you implying that this action was incorrect?