Change local of instalation of \.julia

Dear all,
I having problems with my user’s name: C:\Users\Usuário\.julia (from Brazil), where all packages are installed (because the name “Usuário”).
However, I cannot control where packages are installed neither the name’s folder.
How can I change this folder, for example, to
C:\JuliaPro-1.5.3-1?
There is a command to do this automatically?
Because when I copy and paste the folder .julia~ (where all packages are installed) to the desired local, ocours several problems.
Many thanks.

1 Like

You can use the JULIA_DEPOT_PATH environment variable to set where julia installs packages.
See Environment Variables · The Julia Language.

1 Like

I cannot do this. Please, provide the correct command. I am a new user. Thanks.

Go to environment variables and create a new variable called JULIA_DEPOT_PATH. Its contents should be the desired path to your .julia folder. Something like: C:\julia.julia
If the variable exists just modify the path inside.

In Julia there is a variable called DEPOT_PATH. For me on Windows, it looks like this:

julia> DEPOT_PATH
3-element Array{String,1}:
 "C:\\Users\\kittisopikulm\\.julia"
 "C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\local\\share\\julia"
 "C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\share\\julia"

You can also control it by setting the environmental variable JULIA_DEPOT_PATH.

I will start with the archaic way of doing on this on Windows via command prompt:

  1. Windows button + R to open the Run Dialog
  2. Type in “cmd.exe”
  3. Type in “set JULIA_DEPOT_PATH=C:\JuliaDepot;” and then push [ENTER]. Note the semicolon. Type this without quotes.
  4. Type in “julia” and then push [ENTER]. This assumes that julia.exe is on your PATH.
  5. If julia.exe is not on your PATH, you may need to give the full location. For me this, julia.exe is located in “C:\Users\kittisopikulm\AppData\Local\Programs\Julia 1.5.0\bin\julia.exe”

Within Julia, you will now get the following:

julia> DEPOT_PATH
4-element Array{String,1}:
 "C:\\JuliaDepot"
 "C:\\Users\\kittisopikulm\\.julia"
 "C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\local\\share\\julia"
 "C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\share\\julia"

It may be necessary to remove the .julia folder or the specific packages in your .julia folder to use the above. The other solution would be to fully specify the DEPOT_PATH as

set JULIA_DEPOT_PATH="C:\JuliaDepot;%LOCALAPPDATA%\Julia 1.5.3\local\share\julia;%LOCALAPPDATA%\Programs\Julia 1.5.3\share\julia"

Adjust the above for your julia version.

Dear, Thank you very much for the details. Almost there!

Ok, I have opned the terminal. In julia, when I type:

DEPOT_PATH

appears:

julia> DEPOT_PATH
4-element Array{String,1}:
 "C:\\JuliaDepot"
 "C:\\Users\\Usuário\\.julia"
 "C:\\Users\\Usuário\\AppData\\Local\\JuliaPro-1.5.3-1\\Julia-1.5.3\\local\\share\\julia"
 "C:\\Users\\Usuário\\AppData\\Local\\JuliaPro-1.5.3-1\\Julia-1.5.3\\share\\julia"

I don’t want the folder “Usuário”. I have crieted a new folder in the following path:

C:\JuliaNovo

My last question: how can I adapt the code:

set JULIA_DEPOT_PATH="C:\JuliaDepot;%LOCALAPPDATA%\Julia 1.5.3\local\share\julia;%LOCALAPPDATA%\Programs\Julia 1.5.3\share\julia"

to my situation? I replace %LOCALAPPDATA% to C:\JuliaNovo only?

I have tried to do this but failed:

The set syntax is specific to Windows batch scripting in the command prompt cmd.exe.

Within Julia, you just need to manipulate the DEPOT_PATH array:

julia> DEPOT_PATH
3-element Array{String,1}:
 "C:\\Users\\kittisopikulm\\.julia"
 "C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\local\\share\\julia"
 "C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\share\\julia"

julia> DEPOT_PATH[2]
"C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\local\\share\\julia"

julia> DEPOT_PATH[2] = "C:\\JuliaNovo\\Julia 1.5.0\\local\\share\\julia"
"C:\\JuliaNovo\\Julia 1.5.0\\local\\share\\julia"

julia> DEPOT_PATH
3-element Array{String,1}:
 "C:\\Users\\kittisopikulm\\.julia"
 "C:\\JuliaNovo\\Julia 1.5.0\\local\\share\\julia"
 "C:\\Users\\kittisopikulm\\AppData\\Local\\Programs\\Julia 1.5.0\\share\\julia"

My recommendation, however, is that you install Julia to a different location and then permanently set the JULIA_DPEOT_PATH using these instructions:

2 Likes

Thank you so much! wonderfull.
You are very patient.

1 Like

My pleasure. I’m a bit annoyed that á breaks things. I think this is actually a Windows issue rather than a Julia issue. I’m interested what the root issue actually is.