How do I update an environment in Julia?

Yes, this is correct. Pkg should be used to manipulate environments, and instantiate is the command you want to create (“instantiate”) an environment that is consistent with the current contents of Project.toml. The description of the complete environment is saved in the Manifest.toml.

EDIT: To go a bit more into the details: Pkg.resolve is used to build a consistent environment and save it into Manifest.toml, and then Pkg.instantiate is responsible for taking the environment described in Manifest.toml and making sure all listed packages and versions are installed on your machine.

If no Manifest exists, calling instantiate will implicitly call resolve first. If a Manifest already exists but is not consistent with the current description of the project, you’ll need to re-resolve and instantiate will tell you so.

Do you mean “clean” in that this simulates what would happen to a new user of the package? Then that is true.

If my understanding of Pkg is correct, this should be equivalent to running update instead of resolve. IIUC, the difference between these two commands is that resolve tries to determine a minimal set of changes (w.r.t. the current environment described in Manifest.toml if it exists) that are needed to make the environment consistent with the requirements described in Project.toml. On the other hand, update tries to find an environment that is as up-to-date as possible (i.e. it will install newer versions of dependencies when available, even if it is not strictly necessary to conform to the project requirements).

Not sure what you mean by that. Running resolve will ensure that any update you make in the compatibility bounds of your project will be reflected in the environment. Running update will additionally try to bring into the project any newer version of your dependencies that might have been released since the last time you instantiated/updated your environment.

Please do not delete the entire .julia directory. It is usually not needed and may have unintended consequences (including the loss of some data that can’t be recovered from the Internet).

See for example this recent discussion about deleting the .julia directory:

4 Likes