-
Notifications
You must be signed in to change notification settings - Fork 8
Full Installation Guide for Julia, Modia3D, Modia
The following installation guidelines are for Julia v1.6.3 under Windows 10. If it is possible use a portable version. For Linux or Mac users the installation steps should be quite similar.
These installation guidelines are a full version, it includes Modia3D and Modia Packages. Modia3D uses the DLR Visualization Library for 3D simulation. Further, two plotting packages, Makie and PyPlot are supported.
Julia might fill up your user profile so be aware by installing Julia under Windows. We'd recommend you creating a new environment variable JULIA_DEPOT_PATH = <path-to-julia-home>/.julia
before installing Julia. How to set an environment variable under Windows 10 is explained here. A path should not contain a whitespace.
Please read the following guidelines carefully.
There is a known issue , you'd might encounter problems during installation of Julia v1.6.3 under Windows 10. It might help setting JULIA_DEPOT_PATH = C:/Users/Neumayr/.julia
. Here 'Neumayr' is my user name, or skip setting the environment variable. Hopefully, this bug will be fixed soon...
For further information about ModiaSim project visit https://github.com/ModiaSim .
You need to define where all Julia packages like Modia and Modia3D are stored.
- Create an environment variable called
JULIA_DEPOT_PATH
- Set
JULIA_DEPOT_PATH = <path-to-julia-home>/.julia
(e.g.<path-to-julia-home>/.julia = D:/home/.julia
)
- Set
Decide between two plot packages.
NOTE: You have to choose ENV["MODIA_PLOT_PACKAGE"] = "Makie"
in your startup.jl file afterwards.
NOTE: You have to choose ENV["MODIA_PLOT_PACKAGE"] = "PyPlot"
in your startup.jl file afterwards.
It might be a bit tricky running PyPlot
the first time. There are two ways of using PyPlot
:
- Install/use your own Anacondy Python distribution.
- Check if Anaconda Python is already installed
-
Remark: Do not use the Anaconda installation from Visual Studio in
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64
-
Remark: Do not use the Anaconda installation from Visual Studio in
- Download the latest stable version of Anaconda Python, based on the platform you are using
- Set an environment variable or add it to the startup.jl file afterwards
ENV["PYTHON"] = "<path-to-python-installation>/python.exe"
- Check if Anaconda Python is already installed
- Use the Python distribution delivered with Julia.
- Add the following environment variables to your startup.jl file.
ENV["PYTHON"] = ""
ENV["CONDA_JL_USE_MINIFORGE"] = "1"
- Add the following environment variables to your startup.jl file.
Modia3D uses the DLR Visualization Library for 3D simulations. Download and install the free DLR SimVis Community Edition, e.g. with https://visualization.ltx.de/ . If you don't use the DLR Visualization Library result animation is switched of.
- Set an environment variable or add it to the startup.jl file afterwards
ENV["DLR_VISUALIZATION"] = "<path-to-library>/Visualization/Extras/SimVis"
- Download the latest stable version of Julia, based on the platform you are using, if available use a portable version from the Julia homepage https://julialang.org/downloads/
- Unzip Julia (portable) in your Julia installation directory
<path-to-julia-installation>
- E.g.
<path-to-julia-installation> = D:/software/julia-1.6.3
- E.g.
- Add the Julia installation directory to the
PATH
environment variablePATH = <path-to-julia-installation>\bin
- Test Julia
- Open a command window (cmd), write down
julia
- This will open the Julia command window. The Julia command line is called
REPL
- This will open the Julia command window. The Julia command line is called
- If Julia starts: Congratulations!! 🥇 👍
- Otherwise open
<path-to-julia-installation>/bin/julia.exe
, if this works go back to step 3
- Open a command window (cmd), write down
- Close Julia window, or type
exit()
Downloading, installing and testing packages take some time, so be patient and drink a cup of coffee.
- Open a Julia
REPL
- Open a command window (cmd), write down
julia
. This opens a JuliaREPL
- Open a command window (cmd), write down
- If you want to use
PyPlot
for plotting, you have to deal with the following instructions, otherwise skip this point and go to 3.- Please, follow instructions from https://github.com/ModiaSim/Modia.jl/wiki/Installing-PyPlot-in-a-robust-way
- If it's not working try
Pkg.add("PyCall")
,Pkg.build("PyCall")
andPkg.add("PyPlot")
several times, and also with a different order.
- Adding some packages, typing the following into the
REPL
- Do you want to use Modia3D with Modia?
] add Revise, ModiaBase, ModiaLang, Modia, Modia3D
- Do you want to use Modia3D without Modia?
] add Revise, ModiaLang, Modia3D
- Furthermore, one or more of the following packages should be installed in order to be able to generate plots:
-
] add ModiaPlot_PyPlot
--> if plotting with PyPlot desired -
] add ModiaPlot_GLMakie
-- if plotting with GLMakie desired -
] add ModiaPlot_WGLMakie
-- if plotting with WGLMakie desired -
] add ModiaPlot_CairoMakie
-- if plotting with CairoMakie desired
-
- It is recommended to also add the following packages, in order that all tests and examples can be executed in your standard environment:
] add Measurements, MonteCarloMeasurements, Distributions
- Further packages are needed (list might not be complete):
] add Unitful, DifferentialEquations, StaticArrays, DoubleFloats
- Do you want to develop your own package?
] dev "path-to-my-package"
- Do you want to use Modia3D with Modia?
- Configure Julia with a
startup.jl
file- Create folder
config
under<path-to-julia-home>/.julia
- Open startup.jl template, adapt it to your needs and save it under
<path-to-julia-home>/.julia/config/startup.jl
- Create folder
- Test Modia3D and Modia packages
- Open a Julia
REPL
using Modia3D
include("$(Modia3D.path)/test/Tutorial/BouncingSphere.jl")
- Further tests are available under
include("$(Modia3D.path)/test/runtests.jl")
using Modia
include("$(Modia.path)/examples/FilterCircuit.jl")
exit()
- Open a Julia
I recommend you using a portable VS Codium or VS Code version as editor for Julia. VS Codium is a clone of VS Code. It’s identical to VS Code with the single biggest difference that unlike VS Code, VS Codium doesn’t track your usage data.
For further information see https://vscodium.com/
- Download VS Codium (Portable) https://portapps.io/app/vscodium-portable/
- Install VS Codium/Code
For further information see https://www.julia-vscode.org/docs/dev/gettingstarted/#Installation-and-Configuration-1
- Start or open VS Codium
<path-to-VSCodium>\vscodium-portable.exe
- Select View and then click Extensions to open Extension View.
- Enter the term
julia
in the marketplace search box. Click the green Install button to download the extension.
NOTE: It is recommended that you restart VS Codium after installation.
If you managed to start Julia from command window, which means you installed Julia into a standard location on Mac or Windows, or if the Julia binary is on your PATH
environment, the Julia VS Codium extension automatically finds your Julia installation. You do not need to configure the extension. Otherwise you have to configure your extension: see https://www.julia-vscode.org/docs/dev/gettingstarted/#Installation-and-Configuration-1
- Select File and then click Open Folder... and browse to folder
<path-to-julia-home>/.julia/packages/Modia3D
- Open
~/test/Tutorial/BouncingSphere.jl
- Select View and then click Command Palette... and choose Julia: Execute File
- If more tabs are opened in your editor the actual file will be executed
- You could create a shortcut for that
- See also https://www.julia-vscode.org/docs/dev/userguide/runningcode/
VS Code, Jupyter, Juno, Pluto.jl, Vim, Emacs, SublimeText, NotePad++ (see listed editors: Julia Editors)
- VS Code (see the above installation guide)
- Jupyter (see https://github.com/JuliaLang/IJulia.jl)
- If not already done, install Anaconda Python
- Open a Julia
REPL
and writeusing Pkg
Pkg.add("IJulia")
using("IJulia")
-
notebook()
--> opens a Jupyter notebook
- Juno/Atom
- It is a handy editor, but there is no further development progress. Bug fixes are still done.
For further remarks or if you encounter problems, please feel free to contact Andrea Neumayr (andrea.neumayr[at]dlr.de).