What is an elegant way to use Julia on a Linux server?

I know I can just throw a well-written script into the server and run it by command julia myScript.jl, or I can start julia and type some little code directly in the REPL. But is that all?

I would like to learn some better ways to use Julia on Linux server, just like I use it in VS Code on Windows, is there any?

For example, what IDE should I use, what packages should I install to improve the user experience (do packages OhMyREPL.jl, Revise.jl, etc still work?) , and what workflow is better to follow? And so on.

Thanks for reading.

2 Likes

Have a look at GitHub - dmolina/DaemonMode.jl: Client-Daemon workflow to run faster scripts in Julia which avoids the package load and compile time when running the same (or similar) scripts on a server again and again.

3 Likes

If you want to connect remotely, have you tried the web based UIs?
There is Pluto or Jupyter notebook for notebook style programming, or JupyterLab for an experience that is closer to an IDE.

1 Like

Now I can just connect the server through Xshell. I’m not sure how can I use Pluto or Jupyter notebook :thinking:

Everything that works on Windows works on Linux, too.

I’m confused by the fact that you say “Linux server”, but then ask if packages meant for interactive use still work. Presumably it’s not a server if you want interactivity? Why do you use the word “server”?

1 Like

Connect over SSH with Visual Studio Code

Remote Development · Julia in VS Code (julia-vscode.org)

Use vscode remote and everything is similar to local.

11 Likes

I mean, I would just do the development of the code on my laptop, push the code to git and pull it on the server if I want to run it on the server…

Advantage: A console like Xshell is sufficient on the server
Disadvantage: You have to install Julia and all packages twice

1 Like

This package doesn’t seem to work at all, at least on nightly Julia, and the implementation seems kludgy. The idea is cool, though.

Well, you cannot expect ANY package to work on nightly Julia…

The problem is with the package, not with Julia.

I see. thanks! So it seems that the user should be the server’s server to serve the server in the server’s manner. :grinning:

Thank you for sharing! It seems everyone uses it in this way. :handshake: :handshake:

I am going to be slightly rude here. For Julia, Linux is not ‘special’ in any way.
If you could say more about what you are trying to achieve perhaps?
Also do try a Pluto notebook - I think that project is fantastic.

If you have firewalled access to a Linux server and only have the ssh port open you can ‘tunnel’ traffic to a Pluto notebook port. However let us assume you can use the port without tunnelling.

2 Likes

For Pluto or Jupyter, you just need to install the packages on the server and run them. Also you might have to ensure that the UIs accept a connection from outside the server, not sure if it is done by default.
Then you can access them from any web browser in the same network as the server and the computations will run on the server, while the UI is in your browser.

1 Like

But it is a bit depending on how you want to use your Julia server. Lets say, you want to have your raspberry pi run Julia and do some coding from time to time? Then I would go with Jupyter or Pluto.
Is your server serving only you, or do you plan to have multiple users access and run Julia on that server at the same time?

1 Like

Thank you for your patience! Sorry, maybe my question is too presumptuous. As a Julia new learner, I just want to learn some good ways from other predecessors to use Julia. :handshake: :handshake:

At present, I can only access the server through Xshell, and I would like to implement the method you mentioned remotely from the laptop, but I don’t know what prerequisites are required. :thinking:

Are you admin on the server? If it is not a production server I would say you could just give Pluto a try.
The package is registered, so if you are on your server, you can just “]add Pluto”. Take a look here GitHub - fonsp/Pluto.jl: 🎈 Simple reactive notebooks for Julia . If you do Pluto.run(;host = “0.0.0.0”) tf will listen to a port on that machine, so you, from your Laptop, try going into a browser and do "http://{ip_of_server}:{port}

1 Like

As a Julia new learner you are very welcome here. Please ask questions!
Can you tell us if you are using a Windows or Mac laptop?

If you use Windows I would advise you to install and use Mobaxterm
MobaXterm free Xserver and tabbed SSH client for Windows (mobatek.net)

2 Likes

In my workflow I use nvim https://neovim.io instead of VSCode and works nicely. If you add tmux tmux - Wikipedia to this you have a good combo that runs in Terminal. One tmux pane with the REPL and another pane with the script open with nvim. (Obviously in the middle a good Revise.jl GitHub - timholy/Revise.jl: Automatically update function definitions in a running Julia session). Something that I wonder now is how to do an easy profiling of code, assuming that we use only the terminal.

1 Like

I usually do

using Profile
workload()  # to force compilation
@profile workload()
Profile.print(format = :flat)

Not as nice output as you can get in a GUI but in most cases effective enough.

1 Like