Pkg change in Julia v. 0.6.3 vs. v. 0.6.2?


#1

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…

  1. I install the package (OMJulia.jl) in a particular directory on my PC (C:\OMGit\OMJulia).
  2. I start up Julia, and add the location of this directory to the Julia path (push!(LOAD_PATH, "C:\\OMGit\\OMJulia")).
  3. With using OMJulia, I get a normal response (i.e., no error message). (Note: I have not done Pkg.add("OMJulia"))
  4. 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?


#2

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?


#3

Thanks, rdeits – I found the problem. There is a change from Julia v.0.6.2 to Julia v.0.6.3, I think. In Julia v.0.6.3:

julia> LOAD_PATH
2-element Array{Any,1}:
 "C:\\Users\\BLI\\AppData\\Local\\Julia-0.6.3\\local\\share\\julia\\site\\v0.6"
 "C:\\Users\\BLI\\AppData\\Local\\Julia-0.6.3\\share\\julia\\site\\v0.6"
 
 julia> push!(LOAD_PATH,"C:\\OMGit\\OMJulia")
3-element Array{Any,1}:
 "C:\\Users\\BLI\\AppData\\Local\\Julia-0.6.3\\local\\share\\julia\\site\\v0.6"
 "C:\\Users\\BLI\\AppData\\Local\\Julia-0.6.3\\share\\julia\\site\\v0.6"
 "C:\\OMGit\\OMJulia"

In Julia v. 0.6.2, this changed path was stored in variable LOAD_PATH – I’m pretty sure of that.

HOWEVER, in Julia v. 0.6.3: when I start IJulia:

julia> using IJulia
julia> notebook()

and then navigate to some IJulia notebook, in the notebook:

In [1] LOAD_PATH
2-element Array{Any,1}:
 "C:\\Users\\BLI\\AppData\\Local\\Julia-0.6.3\\local\\share\\julia\\site\\v0.6"
 "C:\\Users\\BLI\\AppData\\Local\\Julia-0.6.3\\share\\julia\\site\\v0.6" 

… and Julia has forgotten the additional path that I pushed into the LOAD_PATH.


#4

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?


#5

Ah. Possibly… I don’t recall it, but you must be right…

Questions:

  1. Is there a default juliarc.jl file, or is this missing unless I create one?
  2. Where should the juliarc.jl file be stored? At the location of path JULIA_HOME?

Thanks.
B


#6

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: https://groups.google.com/forum/#!topic/julia-users/3jY1hJJzC0Y 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?


#7

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.

Thanks!


#8

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.


#9

Thanks, again: very clarifying and useful to know.