Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
A great feature of Jupyter Notebooks is that they can be used for more languages than just Python. Let me show you how to install and use Julia in your Notebooks.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Before we can use any other language,
we have to install it.
0:00
I'm going to use the Julia language for
this example, but
0:03
there are many others available.
0:05
Check the teacher's notes for
more information.
0:06
Running other languages in the Notebook
is controlled by the installed kernels.
0:09
So that's something you want to watch
out for in documentation and searches.
0:12
So to install Julia,
we can visit julialang.org,
0:15
and we can download the version for our OS.
0:21
So I am currently running Mac OS, so
that's the one I need to download and
0:26
install, and then once it's downloaded,
we can open it up.
0:30
And for Mac OS we just have to drag it to
our applications folder, for Windows or
0:38
Linux you will have other steps
that you will have to complete.
0:43
Okay?
0:49
And now we should be able to
open up the Julia application,
0:54
and now we have the Julia shell.
0:57
So that's cool, so
now we have the Julia shell, and
0:59
we can install the IJulia
kernel right now if we want.
1:03
Now this the kernel, like I mentioned
before, for using Julia with IPython or
1:05
Jupyter Notebooks.
1:10
The installer assumes that we're starting
from pretty much nothing, though.
1:11
And so it wants to install Anaconda and
all this other stuff for you.
1:14
We're not starting from nothing though,
we already have something set up.
1:17
So I need to tell it where
our Jupyter install is.
1:20
So, I'm gonna go to my terminal and
I will open up a new tab, and
1:22
I will say, which Jupyter, and
this tells me the path to Jupyter.
1:28
So I'm gonna copy that.
1:35
And over here in Julia,
1:38
I have to tell this Julia where it is
that we're working and where Jupyter is.
1:39
Now if you're on Windows, there's a good
chance that the path that you got here
1:45
is going to have a C/ at the front of it,
you'll need to change it to C: so
1:49
that it works.
1:54
So then we're gonna start
this inside the Julia prompt.
1:55
So we're gonna say ENV["JUPYTER"] = and
1:57
then the path that we had from before,
okay?
2:02
So now that that's there, we can now
tell it to add the IJulia package.
2:05
This can take a while.
2:11
All right, so now that that's installed,
it's time to relaunch our Notebook Server.
2:14
So, over here we have the tab where the
Notebook Server's running, I'll end that,
2:19
and I need to restart that.
2:24
So I'll just run Jupyter Notebook again.
2:26
And it's gonna ask me, or
it's gonna open up a new tab.
2:31
So now I can click New and
I can choose Julia as well as Python 3.
2:36
So I'm gonna choose Julia as
a new Julia Notebook, and
2:39
I'm gonna call this Julia Learning.
2:42
And you don't have to name it,
you can leave this untitled if you want.
2:47
Here inside this code block,
I need to put in some Julia code.
2:50
Now, I don't know Julia, so
I'm not gonna do anything fancy.
2:53
I'm just gonna be like 1 + 2.0, and Iām
gonna do println("Hello Treehouse") and
2:55
then I will Ctrl+Enter to run that,
and I get Hello Treehouse.
3:03
So nice, it works just like
the Python version of the Notebook.
3:09
Being able to code in multiple languages
in one tool is a really great feature.
3:13
It means that you can use the language
that's appropriate to the problem without
3:17
having to completely change your tool set.
3:20
There are many more kernels available too,
so if you want to use Scala, Ruby, and
3:22
other languages, you can.
3:25
If you want to learn more about Julia,
I've included a link in the teacher's
3:27
notes, it's a quick
introduction to the language.
3:30
Or if you just want to play around
with Jupyter Notebooks a bit more,
3:32
I've linked to a collection
of Notebooks too.
3:35
I hope you've found Jupyter Notebooks
to be an interesting and useful tool.
3:37
If I might make a suggestion, keep
a Notebook open as you're learning Python
3:41
here on Treehouse, and well, everywhere.
3:43
When you learn something new, try it out
in the Notebook, and take some notes too.
3:46
Then you can come back,
see your notes, see and run your code,
3:49
and hopefully give
yourself a nice refresher.
3:52
I'll see you next time.
3:54
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up