Not able to use PyPlot in the usual way

juno
pyplot

#1

I still have problems to apply PyPlot using JuliaPro v0.6.1.1. Prior to this version I used following lines after launching Juno:

using PyPlot
x = linspace(0,2pi,200); y = sin.(x+2*cos.(x));
plot(x,y)
The graph was then displayed in an extra window.

Now, using JuliaPro v0.6.1.1 this does not work anymore. Instead of the above lines I always have to apply the the following code:

using PyCall
pygui(:tk) # or pygui() ## this line is necessary
using PyPlot
x = linspace(0,2pi,200); y = sin.(x+2*cos.(x));
plot(x,y)

It seems that the first two lines are a prerequisite to use PyPlot at least in my JuliaPro installation

When I try to use a different Backup e.g. qt or qt5

using PyCall
pygui(:qt) # or pygui(:qt5)
ENV[“PYTHON”]=""
Pkg.build(“PyCall”)
using PyPlot
x = linspace(0,2pi,200); y = sin.(x+2*cos.(x));
plot(x,y)

I‘ve got two error messages:
The first one:

This application failed to start because it could not find or
load the Qt platform plugin 'windows‘ ….

and subsequently:

Runtime Error

_R6034 _
…….

Any suggestion are welcome


#2

What’s the result of "versioninfo()"
In my case, i use JuliaPro 0.6.0+MKL in manjaro, I always got a “segmentation fault” when plotting with PyPlot. I set the python environment as “my/anaconda3.6/bin/python” or “” and rebuilt the PyCall and PyPlot packages. Problem was not solved. After a lot of time, I just gave up, and installed two version of Julia in my computer: JuliaPro 0.6.0+MKL and Julia 0.6.1.


#3

@111 Thank you for your reply. I did not find any information in the versionifo()

Julia Version 0.6.1
Commit 0d7248e2ff* (2017-10-24 22:15 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel® Core™ i5-4200U CPU @ 1.60GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

with respect to my problem.

Meanwhile I un-installed and re-installed JuliaPro-0.6.1.1. After launching Juno the following lines are entered:

Pkg.update() # ok

ENV[“PYTHON”]=""
Pkg.build(“PyCall”) # ok

using PyPlot

InitError: PyError (ccall(@pysym(:PyImport_ImportModule), PyPtr, (Cstring,), name)
The Python package mpl_toolkits.mplot3d could not be found by pyimport. Usually this means that you did not install mpl_toolkits.mplot3d in the Python version being used by PyCall. PyCall is currently configured to use the Julia-specific Python distribution installed by the Conda.jl package. To install the mpl_toolkits.mplot3d module, you can use pyimport_conda("mpl_toolkits.mplot3d", PKG), where PKG is the Anaconda package the contains the module mpl_toolkits.mplot3d, or alternatively you can use the Conda package directly (via using Conda followed by Conda.add etcetera). Alternatively, if you want to use a different Python distribution on your system, such as a system-wide Python (as opposed to the Julia-specific Python), you can re-configure PyCall with that Python. As explained in the PyCall documentation, set ENV[“PYTHON”] to the path/name of the python executable you want to use, run Pkg.build(“PyCall”), and re-launch Julia. ) <type ‘exceptions.ImportError’> ImportError(‘No module named mpl_toolkits.mplot3d’,) during initialization of module PyPlot
in require at base\loading.jl:405
_in require at base\loading.jl:464
_in require_from_serialized at base\loading.jl:200
_in include_from_serialized at base\loading.jl:157
in init at PyPlot\src\init.jl:205
in pyimport at PyCall\src\PyCall.jl:374
in macro expansion at PyCall\src\exception.jl:81
in pyerr_check at PyCall\src\exception.jl:61
in pyerr_check at PyCall\src\exception.jl:56

As suggested in the error message I tried

using PyCall
pyimport_conda(“mpl_toolkits.mplot3d”, “mpl_toolkits”)

PyObject <module ‘mpl_toolkits.mplot3d’ from 'C:\JuliaPro-0.6.1.1\pkgs-0.6.1.1\v0.6\Conda\deps\usr\lib\site-packages\mpl_toolkits\mplot3d_init.pyc’>_

then

using PyPlot
x = linspace(0,2pi,200); y = sin.(x+2*cos.(x));
plot(x,y)

I’ve got the same error pop-up windows as described above.

This application failed to start because it could not find or
load the Qt platform plugin 'windows‘ ….

and subsequently:

Runtime Error
_R6034 _
…….

I have no idea at all how to resolve this problem? Any hint are highly wellcome!


#4

Finally I did it.

I installed Ananacoda3 and execute

ENV[“PYTHON”] = "c:\Users\Carsten\Anaconda3\python.exe"
Pkg.build(“PyCall”)

after closing Juno and re-launching I insert

using PyPlot
x = linspace(0,2pi,200); y = sin.(x+2*cos.(x));
plot(x,y)

things works at expected.
In addition the Backend changed from :tk to :qt5 which was in the beginning not possible.