How to Install all Packages in a Project into the General Julia Manifest

I have a bunch of packages that I would like my general julia environment to have.

To achieve this I have created Manifest and Project files with the necessary packages and dependencies. How would I go about installing all of those packages in the general Julia environment such that I have access to them without having to call activate when I start Julia?

I want something similar to:

using Pkg
cd("/path/to/my/files")
Pkg.activate(".")
Pkg.instantiate()
Pkg.precompute()

except I want to run it once and have it install everything into the general Julia environment.

Is such a thing possible? Thanks!

1 Like

Sorry its a bit confusing. Why do you activate your current folder if you want to work in a global environment?

Great question. I am trying to create a docker container containing all of the packages that I need, and I want those packages to be available inside the docker container any time I run a julia command. Hence, I don’t want to have to run activate as part of every julia command with future use of said docker container.

Why do you activate your current folder

I am activating the current folder simply because that is how I would go about installing everything for a package into the package’s environment. I don’t want the package’s environment, and simply running Pkg.instantiate() locally doesn’t work.

I think I solved my problem.

I now do the following:

RUN julia -e "using Pkg; Pkg.instantiate()"
COPY Project.toml /user/.julia/environments/v1.7/Project.toml
COPY Manifest.toml /user/.julia/environments/v1.7/Manifest.toml
RUN julia -e "using Pkg; Pkg.instantiate(); Pkg.precompile()"

The first line produces my .julia directory, the next two are to copy over my project and manifest files, and the final is to instantiate and precompile. It appears to have worked - thanks.

3 Likes