# \`$ julia -p n\` can't use Project.toml?

**URL:** <https://discourse.julialang.org/t/julia-p-n-cant-use-project-toml/57907>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [March 25, 2021, 3:56am UTC](https://discourse.julialang.org/t/julia-p-n-cant-use-project-toml/57907 "2021-03-25T03:56:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkarikom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkarikom/32/7096_2.png) [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Post date:** [March 25, 2021, 3:56am UTC](https://discourse.julialang.org/t/julia-p-n-cant-use-project-toml/57907/1 "2021-03-25T03:56:33Z")

</div>

Basic script:

```julia-auto
me@pc:/tmp/testenv$ less /tmp/testproj/test.jl 

using Optim,DataFrames

DataFrame(rand(3,3))

```

Project has all deps:

```julia-auto
me@pc:/tmp/testenv$ less /tmp/testproj/Project.toml 

./Project.toml

me@pc:/tmp/testenv$ less /tmp/testproj/Project.toml 
[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Project.toml (END)

```

According to the [docs](https://docs.julialang.org/en/v1.7-dev/manual/command-line-options/#command-line-options), the correct way to specify a project when calling in bash is:

```julia-auto
me@pc:/tmp/testenv$ julia -p 5 --project=/tmp/testproj ./test.jl

```

### This is super annoying:

No info about the status of the project that I requested to be activated, just apparently silently failing:

```julia-auto
ERROR: LoadError: ArgumentError: Package Optim not found in current path:
- Run `import Pkg; Pkg.add("Optim")` to install the Optim package.

```

#### Try ignoring the docs and use interactive way:

```julia-auto
me@pc:/tmp/testenv$ less /tmp/testproj/test.jl 

using Pkg
Pkg.activate("/tmp/testproj")
using Optim,DataFrames

DataFrame(rand(3,3))

```

#### Exact same problem:

```julia-auto
ERROR: LoadError: ArgumentError: Package Optim not found in current path:
- Run `import Pkg; Pkg.add("Optim")` to install the Optim package.

```

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [March 25, 2021, 4:49am UTC](https://discourse.julialang.org/t/julia-p-n-cant-use-project-toml/57907/2 "2021-03-25T04:49:10Z")

</div>

This is unfortunately a long standing issue with Distributed workflows: [Workers should inherit Pkg environment · Issue #28781 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/28781)

One of the easiest workarounds is to use the `JULIA_PROJECT` environment variable — from bash it’s just:

```nohighlight
$ JULIA_PROJECT=/tmp/testproj julia -p 5 ./test.jl

```

---

<div class="post-metadata">

**Author:** ![mkarikom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkarikom/32/7096_2.png) [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Post date:** [March 25, 2021, 5:17am UTC](https://discourse.julialang.org/t/julia-p-n-cant-use-project-toml/57907/3 "2021-03-25T05:17:19Z")

</div>

> [@mbauman](#):
>
> This is unfortunately a long standing issue with Distributed workflows: [Workers should inherit Pkg environment · Issue #28781 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/28781)

Yeah this is clearly going to get fixed, but the most urgent issue is the documentation.

I hate to lay this at someone else’s feet but most people (eg myself) who are getting tripped up by this do not have the expertise to do a PR for the manual, at least without it looking totally ad hoc.

Right now the documentation on the julia environment is fragmented because:

- args ([Command-line Options · The Julia Language](https://docs.julialang.org/en/v1.7-dev/manual/command-line-options/))
- shell ([Environment Variables · The Julia Language](https://docs.julialang.org/en/v1/manual/environment-variables/))

have semantic inconsistencies in their functionality as you pointed out and this can only be handled by a more unified treatment which currently does not exist to my knowledge.
