How to store the set of needed packages in git

I know the possibility to “instantiate” a folder/project to load all the correct package versions, that are needed.

But how can I do the opposite, store a set of packages in a file that I can commit to git?


I am not sure I got the question right, but checking in your Project.toml and/ or Manifest.toml should do the job.

1 Like

Which Project.toml and/or Manifest.toml? And do I need them both?

I just checked, and in my project folder is none of these files.

the Manifest.toml describes the exact set of packages you are using for development of your package. Since it will download the exact set of packages (and not just the most recent version-compatible set like Project.toml), there is no need to store all the packages locally or on a git repository.

1 Like

But how can I create it?

Using the REPL you can write

] activate <Name of a folder>
add <List of Packages>

Now you have those files in the specified folder.

Ok, I have now the two above mentioned files.

Now I switched to julia 1.3, run
run my program, and it says: package xxx not found.

So my impression is that instantiate has no effect.

Did you activate the folder again? You will see it by the name of the blue prompt.

Ok, using

activate .


But when do I need to use activate, and when instantiate?

And do I need to commit both Project.toml and/or Manifest.toml?

Always activate the environment/project that you want to instantiate.
If you just commit the the Project.toml instantiating will give you the most recent versions of Packages compatible with your Project.toml if you instantiate from the Manifest.toml you will get the exact versions that you had loaded at the time creating that Manifest.toml.
What to commit depends on your usecase.
Also have a glance at the documentation.


To summarize:
a. to create a local Project.toml and Manifest.toml, first activate the project folder and then add all required packages
b. commit both files, if you want to make sure a reproducible set of packages is used,
if you want to use always the newest versions commit Project.toml only
c. after check out execute both ]activate and ]instantiate
d. after you have been working on a different project and you want to switch back it is sufficient to use only ]activate
e. you can use julia --project to do the activate command when you start julia

Is my understanding correct?


yes and you can use julia --project to do the activate command when you start julia.


If you created the project on a given machine, you usually don’t need to instantiate. Only if you send code to others or to a different machine and then doing it once is enough.

Well, my colleagues might also update the package versions, so I have to instantiate after each checkout to be sure to use the same versions.

With a good enough test suite, this shouldn’t be a problem. Assuming people obey semver you really should only need the Project.toml and not the Manifest.toml.

I think the exception to this is if you depend on any unregistered packages.


Note that you can add package via a valid git URL and that package has a project.toml, things will work iirc. But yes for packages added via URL there won’t be a version number and only the Manifest.toml will have the unique git hash that identifies what the repository looked like at the exact moment it was added.

Though you can add a particular commit for a repository, which means you can still work using only Project.toml

I haven’t had had luck with this. For example, the Project.toml for one of my unregistered packages includes a dependence on another unregistered packages (TweedieDistributions.jl), but only includes the UUIDs for each package so there’s no way to find the package from only the Project.toml file.