Installation Instructions


For this course three software pieces are required:

   1. The programming language, Julia.

   2. A programming environment, Visual Studio Code or Atom, along with the proper extensions for the Julia programming language. We recommend the first option.

   3. The algorithmic design tool, Khepri.


This page contains the instructions for the required installations as well as some beginner tips on how to use either programming environment.

 

1. Installing the Julia programming language

 

First, install Julia: https://julialang.org/downloads/

More specifically, use: https://julialang-s3.julialang.org/bin/winnt/x64/1.7/julia-1.7.2-win64.exe

We recommend that you accept the default installation options.

 

2. OPTION A: Installing the Atom Programming Environment

 

Second, install Atomhttps://atom.io/

More specifically, use: https://atom.io/download/windows_x64

Again, we recommend that you accept the default installation options.

 

Install the Juno extension

Third, launch Atom and install Juno.

In Atom, either choose Install Package in the list of options that appear or go to Settings (Ctrl+,) and go to the Install panel. Type uber-juno into the search box and hit Enter. Click the Install button on the package of the same name and wait. Atom will install several packages and will inform you when it's done. You can answer Yes to all questions presented by Atom.

 

Opening the Julia REPL

When the installation completes, you will have a pane at the bottom (REPL) for interacting with Julia. If the REPL does not show, go to the Juno menu in the top bar and choose Open REPL (Ctrl+J Ctrl+O). Alternatively, use the new Juno tab, which should have appeared at the left of your workspace after the Juno installation. Find the REPL icon in the tab and click on it. The icon resembles a rectangular screen with the symbols >_ on it.


2. OPTION B: Installing the Visual Studio Code Programming Environment

 

Second, install Visual Studio Code: https://code.visualstudio.com/

More specifically, use: https://code.visualstudio.com/Download#

Again, we recommend that you accept the default installation options.


Installing the Julia Extension

Third, launch Visual Studio Code and install the Julia extension.

In Visual Studio Code, click the View menu in the top bar, and choose Extensions (Ctrl+Shift+X).

In the extensions pane, type Julia into the search engine (on top) and select the Julia extension by clicking the install button. Visual Studio Code will install it. When the installation completes, restart Visual Studio Code.

 

Launching the Terminal and the Julia REPL

To run code, or to visualize the results of any program you run, you must launch the Terminal (or REPL). If this tab is not already visible at the bottom of your workspace, go to the View menu in the top bar and choose Terminal (Ctrl+ç in a PT keyboard; Ctrl+` in a US keyboard).

The terminal, at the bottom of your screen, should indicate that you are running Julia. If you do not see a Julia prompt in your terminal (julia>), change the dropdown menu on the top right corner of the terminal to the Julia REPL option.

Another option to start the Julia REPL is available directly through the Command Pallete. Go to the View menu in the top bar and choose Command Pallete (Ctrl+Shift+P). Type Julia: Start REPL in the search engine that appears and select the corresponding option. The terminal should appear at the bottom of your workspace. The same can be achieved with the following key bindings: Alt+J Alt+O


3. Installing the Khepri algorithmic design tool

 

With the cursor in the REPL press EnterJulia should have started and will begin its own installation process. When it's done, press the ] key. You will notice the Julia prompt (julia>) change to a package installation prompt (pkg>). In front of it, write:

add Khepri

When it's done, press backspace (<--) to return to the Julia prompt (julia>).

 

To test if the installation worked, write the following lines of code in the REPL and evaluate each one by clicking Enter after each instruction:

using Khepri

backend(autocad)

circle()

 

After AutoCAD starts, you see an AutoCAD dialog asking if you want to load Khepri, click on the button 'Always Load'. You should then see a circle in AutoCAD.

Note: in case the REPL shows errors and messages such as

Please, close AutoCAD and retry.

or 

Please, start/restart AutoCAD.

just do what it says.


4. OPTION A: Beginner tips for Atom users

 

Opening a Julia file

As you have seen, you can write and run programs directly in the Julia REPL. However, these instructions cannot be saved for later use. The REPL is useful for testing parts of your program and for visualizing the results of program runs. For more complex developments, you should work on a Julia file that can be saved to your computer.

To begin programming, open a new text file. Go to the Juno menu in the top bar and choose New Julia File. Alternatively, click on the New Julia File icon on the Juno pane to the left of your workspace. The icon resembles a sheet of paper with the symbols </> on it. You can now start developing Julia code within the file.

Note that Atom offers you a blank file (untitled) to start with, or you can also open another one in the File menu, with the option New File (Ctrl+N). These files, however, are not Julia files. If you started developing a program in such a file and wish to convert it to Julia, save it as a Julia file on your computer. Select the File menu in the top bar and choose Save As (Ctrl+Shift+S). The Julia extension will not show in the Save as type dropdown menu. Hence, you must add the extension (*.jl) yourself to the file name (e.g. Untitled.jl).

 

Running Code

There are several options to run the code in your program. You may run the full program, or you may prefer to run only parts of it.

To run the full program, use the Run all (Ctrl+Shift+Enter) option in the Juno pane or the Juno menu. In the Juno pane, the icon resembles a triangle. The results of your program will be shown in the REPL.

To run parts of the program, use the Run Block option (Shift +Enter) in the Juno pane or the Juno menu. In the Juno pane, the icon resembles a lightning bolt. This action will cause the evaluation of the current line (where your cursor is) or selection. The result of each instruction will appear inline in the program file.

Other useful actions include:

   Interrupt Julia (Ctrl+Shift+C) interrupts or cancels a process. It is useful to break infinite loops or erroneous runs. In the Juno pane, the icon resembles a pause symbol.

   Strop Julia (Ctrl+J Ctrl+K) for exiting the Julia REPL. In the Juno pane, the icon resembles a stop symbol, a square with rounded corners.

   In the Juno menu, there is also an option for cleaning the REPL history. Click on Clear REPL (Ctrl+L or Ctrl+J Ctrl +C).


4. OPTION B: Beginner tips for Visual Studio Code users

 

Opening a Julia file

As you have seen, you can write and run programs directly in the Julia REPL. However, these instructions cannot be saved for later use. The REPL is useful for testing parts of your program and for visualizing the results of program runs. For more complex developments, you should work on a Julia file that can be saved to your computer.

To begin programming, open a new text file. Go to the File menu in the top bar and choose New File (Ctrl+N). This will open a new text file. You now have two options to convert it into a Julia file:

A.      On the bottom right corner of the workspace, you will notice the file is cataloged as Plain Text in the Select Language Mode button. Click on it to change the file type. A search engine will appear, where you should write and select Julia. Your file should now be recognized as a Julia file.

B.      The same effect can be achieved by saving the new text file with the Julia extension. Select the File menu in the top bar and choose Save As (Ctrl+Shift+S). In the Save as type dropdown menu select the Julia (*.jl) option, or simply add the extension yourself to the file name (e.g. Untitled.jl).

You can now start developing Julia code within the file.

 

Running Code

There are several options to run the code in your program. You may run the full program, or you may prefer to run only parts of it. In either case, the results of each run will show in the Julia REPL.

To run the full program click Shift+Enter when your cursor is anywhere within the program file

To run only parts of the file, you can use Ctrl+Enter, which sends the current line (where your cursor is) or selection to the REPL, or use Alt+Enter, which runs the current instruction and moves your cursor downwards simultaneously.

Other useful commands include:

   Ctrl+D or Alt+J Alt+K for exiting the Julia REPL

   Ctrl+C to interrupt or cancel a process. Useful to break infinite loops or erroneous runs.

   Ctrl+L to clear terminal screen.

 

Inline visualization of results

We have shown you how to visualize program results in the REPL. There are other options for the visualization of results, namely inline visualization, which allows you to see the results of your program directly in the program file, in front of the line you just ran. Go to the File menu in the top bar, choose Preferences, and then Settings (Ctrl+,)Here open the Extensions drop-down menu and find Julia. In the Julia extension settings menu, change the default options in Execution: Result Type to inline or to both.


⚠️Troubleshooting

Julia REPL fails to start and an error message with either of the following texts appears: The terminal process failed to launch: Path to shell executable is not a file of a symlink or Path to shell executable does not exist.

If this is the case, Visual Studio Code could not find the Julia.exe file to launch the Julia shell in the editor. You must provide the path by hand.

Go to the File menu in the top bar, choose Preferences, and then Settings (Ctrl+,)Here open the Extensions drop-down menu and find Julia. In the Julia extension settings menu, find the Julia: Executable Path option. You will paste the correct path on the text box below. But first, find the file on your computer:

A.      The Julia.exe should be located deep in the AppData hidden folder. You will find this folder on your user folder (Users > *User Name*) if you check the Hiden items option on the View > Show/Hide tap. Alternatively, type %APPDATA% on the Windows File Explorer search engine and step back one folder. When in the AppData folder, open the following folders in sequence: AppData > Local > Programs > Julia > Julia-*.*.* > bin (*.*.* represents the Julia version you installed).

Copy this file path, all the way to the Julia.exe file, and paste it on Visual Studio Code. Add a second set of \ to each folder level. The final link should look something like C:\\Users\\*User Name*\\AppData\\Local\\Programs\\Julia\\Julia-*.*.*\\bin\\julia.exe

B.       If the file is not located on the AppData folder, as suggested, find Julia's shortcut either on your Desktop or Start Menu. Right-click on the icon and choose the option Open File Location. This will most likely lead you to another shortcut, so repeat the process until you reach the Julia.exe file. At this stage, follow the remaining steps in option A.