# Offline installation of Julia packages

**URL:** https://discourse.julialang.org/t/offline-installation-of-julia-packages/20083
**Category:** General Usage
**Tags:** package, installation
**Created:** [January 25, 2019, 11:31am UTC](https://discourse.julialang.org/t/offline-installation-of-julia-packages/20083 "2019-01-25T11:31:59Z")
**Posts on this page:** 1
**Showing post:** 16

<div class="post-metadata">

### Author: ![wulpuqu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wulpuqu/32/17640_2.png) [@wulpuqu](https://discourse.julialang.org/u/wulpuqu)
#### Post date: [October 15, 2020, 1:12pm UTC](https://discourse.julialang.org/t/offline-installation-of-julia-packages/20083/16 "2020-10-15T13:12:01Z")

</div>

With the introduction of Artifacts in Pkg for Julia v1.3+, this simple script does the work, by calling julia with `julia --project=/path/to/project`

```julia
using Pkg
# On the host machine, call the following line to get the right 'machine' string corresponding to the host (here a Debian linux machine)
#machine=string(Sys.MACHINE,BinaryPlatforms.compiler_abi_str(BinaryPlatforms.detect_compiler_abi(platform_key_abi(Sys.MACHINE))))

machine="x86_64-pc-linux-gnu-libgfortran4-cxx11" # See above
platform = Pkg.BinaryPlatforms.platform_key_abi(machine)

path_to_project = # Fill this
path_to_external = # Fill this
ispath(path_to_external) || mkpath(path_to_external)
empty!(DEPOT_PATH)
push!(DEPOT_PATH,path_to_external)

function main(path_to_project,path_to_external,platform)
    Pkg.activate(path_to_project)
    ctx=Pkg.Types.Context()
    println("Project Path : " * path_to_project)
    println("Using : " * ctx.env.manifest_file * "\n"
           *" " * ctx.env.project_file)
    println("Installing to " * path_to_external)
    println("Platform $platform")
    Pkg.instantiate(ctx;platform=platform,verbose=true)
end

main(path_to_project,path_to_external,platform)

```

It creates a new depot at `path_to_external` which can then be exported on the host machine.  
On the host machine, you have to run `JULIA_DEPOT_PATH=/path/to/exported/depot julia` and launch `using Pkg; Pkg.build()`.

You might have some problems with not found libraries, but don’t worry it is generally just a symlink/renaming problem.

Note that if your project use `Conda/PyCall`, it won’t install a proper python distribution corresponding to your machine, you have to install it manually and specify the `CONDA_JL_HOME` environment variable.

For `Plots.jl` with GR (unfortunately not using `Pkg.Artifacts` for the moment) you have to directly download the library at `https://github.com/sciapp/gr/releases`, install it in` GR/###/deps/downloads` and remove this line in `GR/###/deps/build.jl`  
[https://github.com/jheinen/GR.jl/blob/b275fcf52800018fd272ec9baa0259759f9b9801/deps/build.jl#L134](https://github.com/jheinen/GR.jl/blob/b275fcf52800018fd272ec9baa0259759f9b9801/deps/build.jl#L134)

---

_[View the full topic](https://discourse.julialang.org/t/offline-installation-of-julia-packages/20083)._
