I’m testing a package that used to work in Julia v. 0.6.2, and which does not work in Julia v.0.6.3, and I’m trying to understand why…
I install the package (OMJulia.jl) in a particular directory on my PC (C:\OMGit\OMJulia).
I start up Julia, and add the location of this directory to the Julia path (push!(LOAD_PATH, "C:\\OMGit\\OMJulia")).
With using OMJulia, I get a normal response (i.e., no error message). (Note: I have not done Pkg.add("OMJulia"))
I then do using IJulia, notebook(), and navigate to a Jupyter/Julia notebook that used to work under Julia v. 0.6.2.
OK – now (v. 0.6.3) the notebook doesn’t work! Issuing command using OMJulia from the notebook leads to:
ArgumentError: Module OMJulia not found in current path.
Run `Pkg.add("OMJulia")` to install the OMJulia package.
Stacktrace:
[1] _require(::Symbol) at .\loading.jl:435
[2] require(::Symbol) at .\loading.jl:405
What is different in Julia v. 0.6.3? Why doesn’t Julia find package OMJulia any more?
Something is different in the Julia process you’re running from the command line and the Julia being run in IJulia. To figure out what it is, you can compare the results of:
julia> versioninfo()
julia> JULIA_HOME
and
julia> LOAD_PATH
running in the command line (where your package works) and in an IJulia notebook. Do you see any differences?
LOAD_PATH is just a variable in your current Julia session. Each Julia kernel running in IJulia is a completely separate Julia session, so appending something to LOAD_PATH once will have no effect on its value inside the IJulia kernels. That hasn’t changed since v0.6.2 (or ever, for that matter).
You can show this by starting two copies of Julia from the command line. Modifying LOAD_PATH in one will not affect its value in the other. The same thing is happening in IJulia.
I’m guessing that your workflow must have been somehow different when things were working with v0.6.2. For example, did you have a ~/.juliarc.jl file that was modifying your LOAD_PATH?
There’s no default file, but if you have one it will be in your home directory (and with an initial dot, like .juliarc.jl). Where that is exactly is possibly somewhat unclear on Windows: Redirecting to Google Groups but it looks like running homedir() in Julia should show you where Julia expects to find it.
Alternatively, did you perhaps have the JULIA_LOAD_PATH environment variable set in Windows?
I found it… Typing %appdata% in Windows Explorer path field, leads to C:\Users\User_name\AppData\Roaming, and then I navigate to C:\Users\User_name\AppData\Local\Julia-0.6.3\etc – that’s where the default juliarc.jl file is located.
Note that the right place to put your configuration file in future versions (v0.7 and higher) will be ~/.julia/config/startup.jl where ~ is whatever homedir() in Julia returns.
For version 0.6 and below, it’s better to put your configuration in ~/.juliarc.jl instead of editing the one in AppData, precisely so that it won’t get overwritten by every new Julia update.