Uninstalled dependency error when starting with -p flag

A similar problem has been discussed here, but I think this is subtly different:

Say I have a project with the following simple Project.toml after running add Catwalk in the current Project:

[deps]
Catwalk = "860e6890-8a08-4313-9643-fcac6eb69798"

and I have NOT installed the package in my global @v1.6 environment.

If I then run:

julia --project -p2 -e 'using Catwalk'

I get:

ERROR: On worker 2:
ArgumentError: Package Catwalk [860e6890-8a08-4313-9643-fcac6eb69798] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.
...

Everything works fine when running julia --project -e 'using Catwalk'. And if I add the dependency in the @v1.6 environment, julia --project -p2 -e 'using Catwalk' works fine as well.

This is not as I expected, since I did not run @everywere using Catwalk and I thought the master process should have access to the current project environment.

Is this expected behaviour? Is there any way to get around this? I would prefer to be able to deploy only my project without touching the global environment.

The problem is Issues · JuliaLang/julia · GitHub as discussed there one workaround is to use the environmental variable JULIA_PROJECT instead of the —project flag to choose the environment. You can also use exeflags with addprocs. I think the fact that the project flag doesn’t work is pretty unfortunate and has tripped up many people, but at least the workarounds are fairly easy once you find them…

1 Like

Thank you very much for your answer! Both solutions work. I will use the JULIA_PROJECT flag, then I will not need to change my code much.

This is the link:

1 Like