-
Notifications
You must be signed in to change notification settings - Fork 38
Installing PyPlot in a robust way
Installing PyPlot
with Pkg.add("PyPlot")
often fails. In this case it is recommended to install PyPlot
in the following way:
-
Install a Python 3.x distribution that contains Matplotlib.
Recommended: Anaconda distribution.
Advantage: very robust;
Disadvantage: > 3 GByte memory needed;
ModiaMath is based on the Python 3.x version of Matplotlib where some keywords are different to the Python 2.x version.
On Windows 10, either provide ajulia_start.bat
file with the following content (and add<path-to-julia-installation>\bin
to the path environment variable):call <path-to-Anaconda3>\Anaconda3\Scripts\activate.bat julia
and always start julia by calling
julia_start
,
or (my preference), add additionally the following directories to the path environment variable:<path-to-Anaconda3>\Anaconda3 <path-to-Anaconda3>\Anaconda3\Library\mingw-w64\bin <path-to-Anaconda3>\Anaconda3\Library\usr\bin <path-to-Anaconda3>\Anaconda3\Library\bin <path-to-Anaconda3>\Anaconda3\Scripts <path-to-Anaconda3>\Anaconda3\bin <path-to-Anaconda3>\Anaconda3\condabin
and start julia by calling
julia
-
Include the path to the Python executable in your startup file (Julia 1.0:
<path-to-user>/.julia/config/startup.jl
):
ENV["PYTHON"] = joinpath("<path-above-Anaconda3>", "Anaconda3", "python.exe")
-
Start Julia, give the command
ENV["PYTHON"]
in the REPL, and check whether the path is correct (if you made a typo in the startup file, Julia might use another Python executable and PyPlot might crash Julia). -
If you have used a different Python installation before, execute the command
]build PyCall
(orusing Pkg; Pkg.build("PyCall")
, exit Julia and start Julia again. -
Install PyPlot via
]add PyPlot
(orusing Pkg; Pkg.add("PyPlot")
)