Search code examples
pathpackagejuliaijulia-notebookload-path

Julia: JULIA_LOAD_PATH not defined when trying to set value


I am trying to set the JULIA_LOAD_PATH as already discussed here Github issue and Julia Docu. I try to run JULIA_LOAD_PATH= "/mypath/bla:$JULIA_LOAD_PATH" in a julia-session, but get the following error:

UndefVarError: JULIA_LOAD_PATH not defined

Stacktrace:
 [1] top-level scope at In[23]:1

I did already do a using Base statement, in case the variable is defined in the Base module, but it did not really help.

How can I add a folder to the julia load-path variable, such that I can import packages from there? Thanks in advance!


Solution

  • JULIA_LOAD_PATH is a system environment variable you may set outside of Julia in your system. You are looking for Base.load_path(), which can be displayed with

    julia>Base.load_path()
    

    and added to with

    julia>push!(Base.load_path(), "mydirectory")
    

    See also help for LOAD_PATH.