# How to manage multiple Julia projects on the same computer

**URL:** <https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855>\
**Category:** New to Julia\
**Tags:** documenter, pkgtemplates\
**Created:** [April 24, 2023, 1:00pm UTC](https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855 "2023-04-24T13:00:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mmv/32/26323_2.png) [@mmv](https://discourse.julialang.org/u/mmv)\
**Post date:** [April 24, 2023, 1:00pm UTC](https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855/1 "2023-04-24T13:00:49Z")

</div>

Hi!

I got the following error message while preparing for a new Julia (v. 1.8.5) project,

```julia
MicMac3 ~/Projects/MISR/MISR_Tools % ls
JMTools_template.jl
MicMac3 ~/Projects/MISR/MISR_Tools % julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.8.5 (2023-01-08)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> using PkgTemplates
WARNING: using PkgTemplates.Documenter in module Main conflicts with an existing identifier.

julia> 

```

Note that I have not (yet) asked to use `Documenter` in this context, though this plugin had been used to define an earlier project on the same computer, in a different directory. This is a new activity, in a separate (mostly empty) directory. Is there a potential for interference between different projects? If so, how can I keep those projects separated? Can I simply ignore this error message and proceed further?

Thanks for your help in this matter.

I created a new directory, launched Julia and added

---

<div class="post-metadata">

**Author:** ![cmarcotte](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@cmarcotte](https://discourse.julialang.org/u/cmarcotte)\
**Post date:** [April 24, 2023, 1:19pm UTC](https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855/2 "2023-04-24T13:19:39Z")

</div>

Typically one invokes `julia --project=.` to designate separate projects and thus different packages. It helps avoid these undesirable interactions.

---

<div class="post-metadata">

**Author:** ![j-fu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j-fu/32/11373_2.png) [@j-fu](https://discourse.julialang.org/u/j-fu)\
**Post date:** [April 24, 2023, 1:30pm UTC](https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855/3 "2023-04-24T13:30:20Z")

</div>

`julia --project=.` will invoke the project in the actual directory. More generally, I did some [writeup](https://j-fu.github.io/marginalia/julia/project-workflow/) on how to organize a Julia project.

Since Julia 1.7, you also can have “shared projects” via `julia --project=@myproject` .

For instance, when I use pluto, I have a shared environment for Pluto, and when using it, I start Julia with `julia --project=@pluto`. Note that Pluto notebooks by default automatically will activate their own environments on startup.

---

<div class="post-metadata">

**Author:** ![mmv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mmv/32/26323_2.png) [@mmv](https://discourse.julialang.org/u/mmv)\
**Post date:** [April 24, 2023, 2:51pm UTC](https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855/4 "2023-04-24T14:51:28Z")

</div>

Thanks @cmarcotte and @j-fu for your comments. I do understand that I can call Julia to activate a particular project. My question is a bit different, because **I do not have a new project yet** : I just issued the command `using PkgTemplates` in a virgin directory with the intent of creating a new project, and thus was surprised to get this warning message. Does it matter? Can I ignore it?

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [April 24, 2023, 2:56pm UTC](https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855/5 "2023-04-24T14:56:54Z")

</div>

When you type “using xxx.jl” in a new directory, you are still using the global environment, you aren’t creating a new project in that empty directory.  
For that you need first to type `]` and then `activate .`  
This will tell julia that you want to use (or inialise) a project in that specific directory.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [April 24, 2023, 5:32pm UTC](https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855/6 "2023-04-24T17:32:50Z")

</div>

> [@mmv](#):
>
> I just issued the command `using PkgTemplates` in a virgin directory with the intent of creating a new project

You can do that in a temporary environment, so to avoid installing `PkgTemplates` (or whatever other tool) in the main environment, to avoid those name clashes in the future.

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [April 24, 2023, 6:32pm UTC](https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855/7 "2023-04-24T18:32:17Z")

</div>

What I don’t understand is why there is a name clash if the first thing in the session is loading PkgTemplates. Do you have something in your `~/.julia/config/startup.jl` loading another package?

---

<div class="post-metadata">

**Author:** ![mmv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mmv/32/26323_2.png) [@mmv](https://discourse.julialang.org/u/mmv)\
**Post date:** [April 25, 2023, 8:37am UTC](https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855/8 "2023-04-25T08:37:49Z")

</div>

@sylvaticus: Thanks for this clarification: I did not know there was a difference between `using [package name]` and `]` followed by `activate .` and `add [package name]`… Always happy to learn!

@lmiq: Thanks for this intriguing suggestion: I’ll have to learn about `temporary environment`…

@aramirezreyes: Indeed, I found that my file `~/.julia/config/startup.jl` already contained the instruction `using Documenter`, most probably as a result of a prior project. I have commented out that line, and the project creation process moves ahead further, but now generates a different error message when I attempt to use the template:

```julia
julia> tmpl("JMTools")
[ Info: Running prehooks
[ Info: Running hooks
  Activating new project at `~/Projects/MISR/MISR_Tools/JMTools/test`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `~/Projects/MISR/MISR_Tools/JMTools/test/Project.toml`
  [8dfed614] + Test
    Updating `~/Projects/MISR/MISR_Tools/JMTools/test/Manifest.toml`
  [2a0f44e3] + Base64
  [b77e0a4c] + InteractiveUtils
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [9a3f8284] + Random
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization
  [8dfed614] + Test
  Activating project at `~/.julia/environments/v1.8`
ERROR: SystemError: opening file "~/Projects/MISR/MISR_RCCM/JMRCCM/docs/make.jl": No such file or directory
Stacktrace:
  [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
    @ Base ./error.jl:176
  [2] #systemerror#80
    @ ./error.jl:175 [inlined]
  [3] systemerror
    @ ./error.jl:175 [inlined]
  [4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing)
    @ Base ./iostream.jl:293
  [5] open
    @ ./iostream.jl:275 [inlined]
  [6] open(f::Base.var"#387#388"{String}, args::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:382
  [7] open
    @ ./io.jl:381 [inlined]
  [8] read
    @ ./io.jl:462 [inlined]
  [9] render_file
    @ ~/.julia/packages/PkgTemplates/RTfWa/src/plugin.jl:326 [inlined]
 [10] hook(p::Documenter{GitHubActions}, t::Template, pkg_dir::String)
    @ PkgTemplates ~/.julia/packages/PkgTemplates/RTfWa/src/plugins/documenter.jl:188
 [11] (::PkgTemplates.var"#17#20"{typeof(PkgTemplates.hook), Template, String})(p::Documenter{GitHubActions})
    @ PkgTemplates ~/.julia/packages/PkgTemplates/RTfWa/src/template.jl:132
 [12] foreach(f::PkgTemplates.var"#17#20"{typeof(PkgTemplates.hook), Template, String}, itr::Vector{PkgTemplates.Plugin})
    @ Base ./abstractarray.jl:2774
 [13] (::PkgTemplates.var"#16#19"{Template, String})(h::typeof(PkgTemplates.hook))
    @ PkgTemplates ~/.julia/packages/PkgTemplates/RTfWa/src/template.jl:131
 [14] (::Base.var"#57#58"{PkgTemplates.var"#16#19"{Template, String}})(#unused#::Nothing, x::Function)
    @ Base ./tuple.jl:555
 [15] BottomRF
    @ ./reduce.jl:81 [inlined]
 [16] afoldl
    @ ./operators.jl:549 [inlined]
 [17] _foldl_impl
    @ ./tuple.jl:277 [inlined]
 [18] foldl_impl
    @ ./reduce.jl:48 [inlined]
 [19] mapfoldl_impl
    @ ./reduce.jl:44 [inlined]
 [20] #mapfoldl#259
    @ ./reduce.jl:170 [inlined]
 [21] #foldl#260
    @ ./reduce.jl:193 [inlined]
 [22] foreach
    @ ./tuple.jl:555 [inlined]
 [23] (::Template)(pkg::String)
    @ PkgTemplates ~/.julia/packages/PkgTemplates/RTfWa/src/template.jl:129
 [24] top-level scope
    @ REPL[2]:1

```

It looks like Julia complains about the absence of the file `~/Projects/MISR/MISR_RCCM/JMRCCM/docs/make.jl`, which sounds strange to me because it is precisely the purpose of the `PkgTemplates` package and the template file to create and setup the project as needed. Indeed, if I manually create the `JMRCCM` directory, then the process does not proceed at all because that subdirectory already exists.

Thanks for any further suggestion about this issue.

---

<div class="post-metadata">

**Author:** ![mmv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mmv/32/26323_2.png) [@mmv](https://discourse.julialang.org/u/mmv)\
**Post date:** [April 25, 2023, 8:53am UTC](https://discourse.julialang.org/t/how-to-manage-multiple-julia-projects-on-the-same-computer/97855/9 "2023-04-25T08:53:32Z")

</div>

Update: Sorry for the confusion: I just realized that my use of the template file was inconsistent because it requested the creation of the `JMTools` project but was still referring to the `JMRCCM` subdirectory in the `Documenter` section. Thanks again to all for your inputs.
