Running a Julia script line by line

2,379 views
Skip to first unread message

Henrik L Nordmark

unread,
Feb 28, 2014, 5:28:23 AM2/28/14
to julia...@googlegroups.com

Is there a way of running a Julia script line by line?

When I use R or R Studio, I am able to write an R script and run whatever line of code my cursor is on by holding down Ctrl + R. And if I highlight a few lines of code and use that key stroke combination, it will specifically run those highlighted lines of code. Is there something equivalent to this in either Julia or Julia Studio?

Kind regards,

Henrik.


Oliver Lylloff

unread,
Feb 28, 2014, 6:11:45 AM2/28/14
to julia...@googlegroups.com
Hi Henrik,

Have you checked out IJulia? https://github.com/JuliaLang/IJulia.jl

Best,
Oliver

Jacob Quinn

unread,
Feb 28, 2014, 9:00:48 AM2/28/14
to julia...@googlegroups.com
Feel free to check out https://github.com/karbarcca/Sublime-IJulia if you use or are up for using sublime text. It has exactly the features you're talking about (since I came from being an R Studio user myself...). Namely, pressing shift+enter without text selected will send the current line to the repl, shift+enter with text selected will send the selected text to the repl, ctrl+shift+enter will run the entire file, line by line, and a recently added features is hitting f5 will run `include("file")` in the repl (a julia command for running an entire file).

Let me know if you need any help getting it setup.

-Jacob

Marek Gagolewski

unread,
Feb 28, 2014, 12:57:18 PM2/28/14
to julia...@googlegroups.com
It's a pity that Sublime is proprietary and not open source software.

Dear Henrik, I'm also a power Rstudio user who couldn't got used to (at the begining) to IJulia. A few months ago I said to myself "I'll wait for a nice RStudio-like IDE and then I'll start learning it". Luckily after a few IJulia sessions now I find the notebook-style workflow more efficient and I'm able to enjoy this powerful programming environment. Just give it a few tries. :)


Douglas Bates

unread,
Feb 28, 2014, 1:54:46 PM2/28/14
to julia...@googlegroups.com
On Friday, February 28, 2014 4:28:23 AM UTC-6, Henrik L Nordmark wrote:

Is there a way of running a Julia script line by line?

When I use R or R Studio, I am able to write an R script and run whatever line of code my cursor is on by holding down Ctrl + R. And if I highlight a few lines of code and use that key stroke combination, it will specifically run those highlighted lines of code. Is there something equivalent to this in either Julia or Julia Studio?


Before RStudio there was ESS, Emacs Speaks Statistics, which has supported R and Julia for some time.  The same keystrokes for sending a single line of code (ctrl-C ctrl-N) or a block of code or a whole buffer to be evaluated work for R source code and Julia source code buffers.

If you are already familiar with emacs then this is an easy transition.  Whether it is worthwhile learning emacs to be able to use this capability is another matter.
 

Henrik L Nordmark

unread,
Mar 4, 2014, 2:04:17 PM3/4/14
to julia...@googlegroups.com
Thank you all for your suggestions and comments on the matter.   :-)

I had not previously heard of IJulia nor of Sublime-IJulia and I am happy to give both a go.

Alas, I have run into some difficulties with the IJulia installation. I started out by using the Anaconda Python installer to get an installation of iPython. Once I finished with that, I opened Julia 0.2.1 and typed "Pkg.add("IJulia"). When that finished running I got a warning message saying that Homebrew and Nettle had build errors.

The troubleshooting section suggested that I tried updating all my packages using "Pkg.update()" and then rebuilding the two packages using "Pkg.build("Homebrew")" and "Pkg.build("Nettle")". Unfortunately, I got the same build errors as before.

I tried running IJulia despite those build errors. It looked initially as if things might be okay, the web interface started up as expected and I was able to open a new notebook. However, if I try to run anything even a simple line of code such as "1+1", I immediately get a kernel error saying that the kernel has died and will restart automatically. And by the looks of things, it gets restarted and dies ad infinitum.

Any thoughts on what might be going wrong and how to fix this?

PS: Should this go into a new thread or is it acceptable to keep this as part of the current thread since it is an extension to my original question? I am not sure what is the proper etiquette for follow up questions such as these.

Jason Solack

unread,
Mar 4, 2014, 4:20:10 PM3/4/14
to julia...@googlegroups.com, quinn....@gmail.com
Hi!  I've tried using IJulia in sublime  text because i love the idea of that funcitonality... when i try to run it i get this error when i start sublime text:

Plugin_host.exe
The program can't start because libgcc_s_seh-1.dll is missing from your computer.  Try reinstalling the program to fix the error.

Any idea why i might be getting that error? 

Ps. i'm on a windows 7 machine!

Isaiah Norton

unread,
Mar 4, 2014, 5:36:33 PM3/4/14
to julia...@googlegroups.com
Does Julia otherwise work when started directly?

Jacob Quinn

unread,
Mar 4, 2014, 5:52:06 PM3/4/14
to julia...@googlegroups.com
Hey Jason,

This is a known issue and is supposed to be fixed on master Sublime-IJulia. I'm not sure if you have the latest or not, but one way ot make sure is to remove and reinstall the package within sublime (ctrl+shift+p, type "remove package", select "IJulia", ctrl+shift+p, type "install package", then "IJulia").

If it still doesn't seem to work, then it looks like my recent fix didn't cover enough cases, feel free to open an issue here: https://github.com/karbarcca/Sublime-IJulia/issues?state=open

Cheers,

-Jacob

Jason Solack

unread,
Mar 4, 2014, 8:24:11 PM3/4/14
to julia...@googlegroups.com, quinn....@gmail.com
thank you, i've opened an issue!
Reply all
Reply to author
Forward
0 new messages