# Uninstalled dependency error when starting with -p flag

**URL:** <https://discourse.julialang.org/t/uninstalled-dependency-error-when-starting-with-p-flag/60305>\
**Category:** New to Julia\
**Created:** [April 30, 2021, 11:57am UTC](https://discourse.julialang.org/t/uninstalled-dependency-error-when-starting-with-p-flag/60305 "2021-04-30T11:57:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![altre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/altre/32/17036_2.png) [@altre](https://discourse.julialang.org/u/altre)\
**Post date:** [April 30, 2021, 11:57am UTC](https://discourse.julialang.org/t/uninstalled-dependency-error-when-starting-with-p-flag/60305/1 "2021-04-30T11:57:02Z")

</div>

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

> [@Problems parallelizing declaring used packages](https://discourse.julialang.org/t/problems-parallelizing-declaring-used-packages/27728):
>
> Hi! I am having big trouble setting up a code for parallelization. When I try to “declare” the packages that I am using in the workers by running the following code: #--------------------------------# # Initialization # #--------------------------------# # Packages #using Distributed using QuantEcon, Optim, Distributions, DelimitedFiles, ExcelReaders using ProgressMeter, BenchmarkTools, DataFrames, Combinatorics using LinearAlgebra, Statistics, Random, StatsBase using BlackBox…

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

```julia
[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
julia --project -p2 -e 'using Catwalk'

```

I get:

```julia
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.

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [May 1, 2021, 10:26pm UTC](https://discourse.julialang.org/t/uninstalled-dependency-error-when-starting-with-p-flag/60305/2 "2021-05-01T22:26:25Z")

</div>

The problem is [Workers should inherit Pkg environment · Issue #28781 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/28781); 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…

---

<div class="post-metadata">

**Author:** ![altre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/altre/32/17036_2.png) [@altre](https://discourse.julialang.org/u/altre)\
**Post date:** [May 3, 2021, 7:00am UTC](https://discourse.julialang.org/t/uninstalled-dependency-error-when-starting-with-p-flag/60305/3 "2021-05-03T07:00:35Z")

</div>

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:  
[https://github.com/JuliaLang/julia/issues/28781](https://github.com/JuliaLang/julia/issues/28781)
