# Running julia from a shell

**URL:** https://discourse.julialang.org/t/running-julia-from-a-shell/36395
**Category:** General Usage
**Created:** [March 23, 2020, 3:24pm UTC](https://discourse.julialang.org/t/running-julia-from-a-shell/36395 "2020-03-23T15:24:24Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![AhmedAlreweny](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@AhmedAlreweny](https://discourse.julialang.org/u/AhmedAlreweny)
#### Post date: [March 23, 2020, 3:24pm UTC](https://discourse.julialang.org/t/running-julia-from-a-shell/36395/1 "2020-03-23T15:24:24Z")

</div>

I am trying to run a Julia code on a cluster shell (linux-based). I tried to to generate an .exe or .so file using [PackageCompiler.jl](https://github.com/JuliaLang/PackageCompiler.jl) to avoid having to install all of the libraries and the packages that are used in the file. However, it didn’t work out. My question is how could I execute my code on the cluster knowing that I don’t have the access to install any additional modules other than (Julia/1.3.1).

---

<div class="post-metadata">

### Author: ![KajWiik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kajwiik/32/199_2.png) [@KajWiik](https://discourse.julialang.org/u/KajWiik)
#### Post date: [March 23, 2020, 5:14pm UTC](https://discourse.julialang.org/t/running-julia-from-a-shell/36395/2 "2020-03-23T17:14:59Z")

</div>

Typically clusters have shared disks, so you can install julia somewhere in home directory and make a soft link to a directory that is in your PATH, e.g. ~/bin. The following may help (with follow-ups):

> [@Start Julia via SLURM batch script on remote node](https://discourse.julialang.org/t/start-julia-via-slurm-batch-script-on-remote-node/33885/3):
>
> Here’s how I set up Julia in a cluster, this also sets up CUDA but you can ignore that.

---

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [March 23, 2020, 5:47pm UTC](https://discourse.julialang.org/t/running-julia-from-a-shell/36395/3 "2020-03-23T17:47:00Z")

</div>

@AhmedAlreweny the shared disk is the way to go here.  
May I ask which cluster you are using? Ask your friendly cluster admin what shared filesystems are available to you.  
Bring them cookies!

---

<div class="post-metadata">

### Author: ![AhmedAlreweny](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@AhmedAlreweny](https://discourse.julialang.org/u/AhmedAlreweny)
#### Post date: [March 27, 2020, 1:30pm UTC](https://discourse.julialang.org/t/running-julia-from-a-shell/36395/4 "2020-03-27T13:30:34Z")

</div>

I have found a .Julia/ directory installed in my $HOME (because I installed the packages directly there), I have 2 questions at this point:

1. How could I move the Julia dirc to `$DATA` instead of `$HOME`? Should I reinstall in again, or could I just use `cp` for that?
2. I don’t see how should I make the soft link? What will be the file and source in that case?

Thanks!

---

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [March 27, 2020, 2:52pm UTC](https://discourse.julialang.org/t/running-julia-from-a-shell/36395/5 "2020-03-27T14:52:57Z")

</div>

You could use the rsync tool to copy the .Julia irectory to $DATA/Julia

Also please send us the results of the command ‘module avail’

---

<div class="post-metadata">

### Author: ![AhmedAlreweny](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@AhmedAlreweny](https://discourse.julialang.org/u/AhmedAlreweny)
#### Post date: [March 27, 2020, 2:57pm UTC](https://discourse.julialang.org/t/running-julia-from-a-shell/36395/6 "2020-03-27T14:57:19Z")

</div>

` Julia/1.3.1` is the julia version that I get when I run `module av`

---

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [March 27, 2020, 3:09pm UTC](https://discourse.julialang.org/t/running-julia-from-a-shell/36395/7 "2020-03-27T15:09:13Z")

</div>

Aha! Well someone on your cluster has created a Modules environment for Julia.

Can you look at that output and find where the module files are stored?  
There is a line like this in the output:  
------------------------------------------------------------ /usr/share/modulefiles -----

OR tell us what printenv MODULEPATH says

SO please let us know what the module file contains:

cat /usr/share/modulefiles/Julia/1.3.1

Your MODULESPATH will not be /usr/share/modulefiles - but it will be similar to that.

---

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [March 27, 2020, 3:12pm UTC](https://discourse.julialang.org/t/running-julia-from-a-shell/36395/9 "2020-03-27T15:12:22Z")

</div>

My apology. You have told us in the first post that you have the Julia/1.3.1 module
