# Set up Julia for a novice

**URL:** https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214
**Category:** General Usage
**Tags:** package
**Created:** [August 23, 2022, 5:21pm UTC](https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214 "2022-08-23T17:21:39Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)
#### Post date: [August 23, 2022, 5:21pm UTC](https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214/1 "2022-08-23T17:21:39Z")

</div>

I’d like to write a script that installs a few packages, does `using` to trigger compilation, and replies `yes` to all questions. Is there a way to do this? What I’d like to do is something like

```julia
for pack in [FFTW, SparseSuite, PyPlot, IJulia]
Pkg.add(string(pack))
using pack
replay "y" to all questions
end

```

I have no idea how to begin. Even without the `reply "y"` part, I’m having trouble with looping over a list of packages and doing both add (which uses a string) and using (which does not).

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [August 23, 2022, 5:28pm UTC](https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214/2 "2022-08-23T17:28:04Z")

</div>

Why not just instantiate an environment?

---

<div class="post-metadata">

### Author: ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)
#### Post date: [August 23, 2022, 5:34pm UTC](https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214/3 "2022-08-23T17:34:08Z")

</div>

I’m still a confused. I’d like to do this in the default environment. Do I write a script to do this? I’d like the user to have to do as little as possible.

My target user will be reading instructions from a web page and not local to my workplace, so I can’t do this myself and send them a .julia tarball.

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [August 23, 2022, 5:34pm UTC](https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214/4 "2022-08-23T17:34:49Z")

</div>

you can put the Manifest.toml and Project.toml into the default environment folder

---

<div class="post-metadata">

### Author: ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)
#### Post date: [August 23, 2022, 5:37pm UTC](https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214/5 "2022-08-23T17:37:06Z")

</div>

OK. So when my customer puts the .toml files into a newly created .julia directory and starts Juila, will the packages automatically be added? Do I still have to tell them to do

`using XXX`  
for all packages and reply “y” to any questions?

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [August 23, 2022, 5:51pm UTC](https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214/6 "2022-08-23T17:51:13Z")

</div>

They will need to run `Pkg.instantiate()`. Notice that you can easily test these scenarios yourself. This gives you a pristine Julia depot unrelated to whatever you have in your `.julia`:

```julia
$ mkdir /tmp/testdepot
$ JULIA_DEPOT_PATH=/tmp/testdepot julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.8.0 (2022-08-17)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

(@v1.8) pkg> st
  Installing known registries into `/tmp/testdepot`
Status `/tmp/testdepot/environments/v1.8/Project.toml` (empty project)

```

---

<div class="post-metadata">

### Author: ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)
#### Post date: [August 23, 2022, 6:13pm UTC](https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214/7 "2022-08-23T18:13:30Z")

</div>

That’ll work, but it’s a bit more effort from my customers than I’d like.

---

<div class="post-metadata">

### Author: ![Lilith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lilith/32/27492_2.png) [@Lilith](https://discourse.julialang.org/u/Lilith)
#### Post date: [August 23, 2022, 6:23pm UTC](https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214/8 "2022-08-23T18:23:17Z")

</div>

There is a way to do what you asked for:

```julia
import Pkg
Pkg.activate("project_for_ctkelley_tutorial", shared=true)
for pack in [:FFTW, :SuiteSparse, :PyPlot, :IJulia]
    Pkg.add(string(pack))
    @eval using $pack
end

```

I took the liberty of adding `Pkg.activate("project_for_ctkelley_tutorial", shared=true)` so that your users won’t have to deal with a default environment with long precompile times down the line.

---

<div class="post-metadata">

### Author: ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)
#### Post date: [August 23, 2022, 8:13pm UTC](https://discourse.julialang.org/t/set-up-julia-for-a-novice/86214/9 "2022-08-23T20:13:50Z")

</div>

That does it. Thanks!
