4
votes

If I try to plot anything with Julia 0.6.0 (using Plots or PyPlot) on Windows 8.1 I get a runtime error message:

Runtime error:

Program; C:\Users\c\AppData\Local\Julia-0.6.0\bin\julia.exe R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.

and julia exits. Reinstalling julia and the plotting packages did not help. Any ideas how to fix this?

3
I've never seen that error before (I'm associated with Plots). Are you using JuliaPro?Michael K. Borregaard
@michael-k-borregaard No, I installed the Julia executable for Windows (64-bit version).christine
Could you try the plotly backend? Could be a PyPlot issue.Michael K. Borregaard
Yes, it looks like this is a Python integration issue unrelated to Plots github.com/JuliaPy/PyCall.jl/issues/87 . From skimming that issue it looks like it should be fixed - do you have the most updated versions of python and PyCall?Michael K. Borregaard
Thanks, it was indeed related to PyCall. With reinstalling again and Pkg.build("PyCall") and setting ENV("PYTHON") it now works.christine

3 Answers

1
votes

This answer is thanks to this discussion on github, as well as the comments on the question.

This should not be an issue with Julia itself, rather with the python/anaconda installation on the system or Qt's configuration.

Try the following:

Open a new REPL/session and type:

ENV["MPLBACKEND"]="qt4agg"

You can also try changing the python environment variable for Julia, then rebuilding the PyCall Julia package:

ENV["PYTHON"]="";
Pkg.build("PyCall")

On my system (Win 10 Fall Update, ver 1703, build 15063.674), I have to set ENV["MPLBACKEND"]="qt4agg" every time that I start the Julia REPL (you can also add it to the startup file, .juliarc.jl ). Afterwards, using Plots and subsequent calls function properly.

1
votes

For me the answer was to first make sure I had a Python install that had matplotlib installed. My system, for whatever reason, has multiple installs of multiple versions of Python. Run python.exe and try importing matplotlib.

import matplotlib

If none of them can successfully import matplotlib then install a version that comes with it installed or install it from source (see the matplotlib website for instructions).

When you find one that doesn't return an error make sure Julia knows where it is. The quickest way is directly through Julia (ENV["PYTHON"] = "C:\\PythonDirectory\\python.exe", ENV["PYTHON"] = "" will default to the version of Python installed by PyPlot). Setting it in Julia will not modify the Windows environmental variables and will be the first place PyCall looks.

Alternatively, you can add it to the environment variables, either user or system level environmental variables should do.

  • PYTHON is the variable name
  • C:\PythonDirectory\python.exe is the value

Restart your computer so the environmental variables are used.

Open Julia and make sure the Python environmental variable is recognized.

ENV["PYTHON"] # Should return the directory you set above

Try setting it yourself if it's still not correct.

ENV["PYTHON"] = "C:\\PythonDirectory\\python.exe"

Rebuild PyCall in Julia (rebuilding PyPlot should work as well).

Pkg.build("PyCall")

That should do it.


My setup is as follows.

  • Windows 10 with all updates until the beginning of November 2017
  • Julia 0.6.0 64bit
  • Python 2, Anaconda 2, Anaconda 3, and miniconda (via PyPlot standard install) all installed with no environmental variables

PyPlot was working the last time I used it a few weeks ago but I suspect the big fall update from Windows screwed up something.

0
votes

This is what I have done. I followed their ideas and it seems that I have not installed "Matplotlib" yet. And then I opened the cmd window and input

python -mpip install -U pip;
python -mpip install -U matplotlib

I am using the newest version: python 3.6; And finally it works.