# Remote Julia Process in Juno

**URL:** <https://discourse.julialang.org/t/remote-julia-process-in-juno/23230>\
**Category:** General Usage\
**Tags:** juno\
**Created:** [April 17, 2019, 1:57am UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230 "2019-04-17T01:57:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![clinton](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@clinton](https://discourse.julialang.org/u/clinton)\
**Post date:** [April 17, 2019, 1:57am UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/1 "2019-04-17T01:57:42Z")

</div>

I am trying to set up a remote Julia process in Juno, so I can use a powerful research server instead of a cruddy laptop.

First, I tried to follow the FAQ for Juno. I opened a terminal, SSHed into the server, launched Julia and ran “using Atom; using Juno; Juno.connect([…])”. This seemed like it was working, except then when I tried to run code using ctrl-enter it just sent it to the local version of Julia. So it didn’t actually work.

Second, I tried to use ftp-remote-edit. I configured the server, and connected to it such that I could see my user directory. However, then when I hit ctrl-enter, I get

```julia
Remote Julia session could not be started.

We tried to launch Julia from `julia` but the process failed with `127` .

Please make sure your settings are correct.

```

Also on the local repl I see the following error message:  
`/bin/sh: 1: julia: not found`

Any tips for getting this to work? The ideal workflow would be to automatically launch the remote Julia process when I run my code, but I’ll settle for getting it to work at all at this point.

Thanks

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [April 17, 2019, 7:49am UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/2 "2019-04-17T07:49:52Z")

</div>

You need to make sure the following setting is correct for the remote machine you’re trying to run Julia on:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/9/d910e37b3c4104271d71fc856662fe16be6facfe.png)

If you do want to use `julia` then make sure it’s symlinked and not aliased in your `.bashrc` or whatever, because, as the error message tells you, we don’t load `bash` before starting Julia.

---

<div class="post-metadata">

**Author:** ![clinton](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@clinton](https://discourse.julialang.org/u/clinton)\
**Post date:** [April 17, 2019, 6:16pm UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/3 "2019-04-17T18:16:13Z")

</div>

Thanks @pfitzseb , it was indeed aliased in .bashrc, so this fixed that.

Code I run locally now proceeds on the remote server, which is great. However, I can’t seem to figure out how to make include statements work for local files- it seems to expect the files are in the home directory of the remote server, yet they are actually local in the same directory as the file I am trying to run. It looks like it is trying to merge local and remote paths. Specifically when it runs `include("FMReg.jl")` I get:

```julia
ERROR: LoadError: could not open file FMReg.jl
Stacktrace:
 [1] include at ./boot.jl:326 [inlined]
 [2] include_relative(::Module, ::String) at ./loading.jl:1038
 [3] include at ./sysimg.jl:29 [inlined]
 [4] include(::String) at ./C:\Users\[...]\Dropbox\Projects\Finometrics\src\Finometrics.jl:1
 [5] top-level scope at none:0
in expression starting at C:\Users\[...]\Dropbox\Projects\Finometrics\src\Finometrics.jl:157

```

I assume I’m missing something obvious here…

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [April 17, 2019, 6:37pm UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/4 "2019-04-17T18:37:56Z")

</div>

Uh, I’m not sure I understand what you’re trying to do – do you have

1. a file locally that you’re trying to run on the server, but `include` looks on the remote instead of local files, or
2. a remote file into which you can’t `include` other remote files?

Regardless of the above, note that `include` is always _relative to the path of the current file’s directory_ (which you can get with `@ __DIR__ `), and not relative to `pwd()`.

---

<div class="post-metadata">

**Author:** ![clinton](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@clinton](https://discourse.julialang.org/u/clinton)\
**Post date:** [April 17, 2019, 7:14pm UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/5 "2019-04-17T19:14:29Z")

</div>

Sure, I guess I wasn’t clear. I have two local files in the same directory. That is, both the file I am running and the file I am trying to include are local. The Julia instance is remote.

So if I understand correctly what you are saying, wouldn’t include then work relative to the path of the local (“current”) file’s directory? When I run print either `pwd()` or `@ __DIR__ ` from the local file I get `/home/.../` as opposed to the local directory.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [April 17, 2019, 7:24pm UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/6 "2019-04-17T19:24:56Z")

</div>

Right, that’s not a supported use case – the remote Julia session can’t access your local file system, so `include` etc doesn’t work. Is there any reason not to work with files on the remote file system? That should be fairly painless with `ftp-remote-edit`.

> [@clinton](#):
>
> When I run print either `pwd()` or `@ __DIR__ ` from the local file I get `/home/.../` as opposed to the local directory.

That sounds wrong. I’m getting  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/3/d35789b4ea0a01a6e60bb1e0c405baf6cee95107.png)  
in a local file with a remote session

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [April 17, 2019, 7:33pm UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/7 "2019-04-17T19:33:21Z")

</div>

I wrote a small function to include remote files  
[https://github.com/ChrisRackauckas/ParallelDataTransfer.jl/blob/3038cb871d514618d8a8cc5cac4c14dc686cc7ab/src/ParallelDataTransfer.jl#L80](https://github.com/ChrisRackauckas/ParallelDataTransfer.jl/blob/3038cb871d514618d8a8cc5cac4c14dc686cc7ab/src/ParallelDataTransfer.jl#L80)  
Maybe it could be of some use here

---

<div class="post-metadata">

**Author:** ![clinton](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@clinton](https://discourse.julialang.org/u/clinton)\
**Post date:** [April 17, 2019, 7:54pm UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/8 "2019-04-17T19:54:05Z")

</div>

Ah, I see. I’m mainly doing it this way so that I can use Git with the atom installation on the local machine. But if it can’t be done, it can’t be done. Since the code is “statically” injected into the main file, I thought it would be possible.

When I run the following in the local file:

```julia
println("$(@ __DIR__ )")
println("$(pwd())")

```

On the repl I see:

```julia
/home/.../
/home/...

```

which is consistent with the remote directory but not the local directory.

@baggepinnen Thanks. I’m trying to avoid spinning up any local processes at all, but if I understand the method correctly this will work well in the scenario with both local and remote processes.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [April 17, 2019, 8:05pm UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/9 "2019-04-17T20:05:48Z")

</div>

> [@clinton](#):
>
> But if it can’t be done, it can’t be done. Since the code is “statically” injected into the main file, I thought it would be possible.

It might be possible to implement, but it’s definitely not working right now. Feel free to open feature requests/issues [here](https://github.com/JunoLab/Juno.jl/issues/new/choose).

---

<div class="post-metadata">

**Author:** ![clinton](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@clinton](https://discourse.julialang.org/u/clinton)\
**Post date:** [April 17, 2019, 8:28pm UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/10 "2019-04-17T20:28:41Z")

</div>

Done! Thanks for clearing all this up.

---

<div class="post-metadata">

**Author:** ![Jorge\_Vieyra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jorge_vieyra/32/6527_2.png) [@Jorge\_Vieyra](https://discourse.julialang.org/u/Jorge_Vieyra)\
**Post date:** [May 23, 2020, 7:57am UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/11 "2020-05-23T07:57:47Z")

</div>

This almost works for me. I got a different error:

> We `tried to launch Julia from `~/julia-1.4.1/bin/julia` but the process failed with `1`

Exit code 1 is a generic as it gets: 1 Catchall for general errors

Any idea on how to debug this?

---

<div class="post-metadata">

**Author:** ![Jorge\_Vieyra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jorge_vieyra/32/6527_2.png) [@Jorge\_Vieyra](https://discourse.julialang.org/u/Jorge_Vieyra)\
**Post date:** [May 23, 2020, 9:49am UTC](https://discourse.julialang.org/t/remote-julia-process-in-juno/23230/12 "2020-05-23T09:49:41Z")

</div>

Ok, found the problem my Julia options included a:

> -J sys\_plots.so

That was not on the remote. Is there a way to set this up separately?
