JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
475 stars 87 forks source link

Problem in using PyPlot in Julia #578

Open Demaria00 opened 7 months ago

Demaria00 commented 7 months ago

I have a problem using PyPlot in a Julia code. When I write "using PyPlot" goes well, but when I try to plot something it does not work and it continues to compile and compile without stopping. I tries the to test the package from the command window and the result is the following

test PyPlot Testing PyPlot Status C:\Users\Andrea\AppData\Local\Temp\jl_ClYuuj\Project.toml [5ae59095] Colors v0.12.10 [b964fa9f] LaTeXStrings v1.3.1 [438e738f] PyCall v1.96.4 [d330b81b] PyPlot v2.11.2 [81def892] VersionParsing v1.3.0 [6462fe0b] Sockets [8dfed614] Test Status C:\Users\Andrea\AppData\Local\Temp\jl_ClYuuj\Manifest.toml [3da002f7] ColorTypes v0.11.4 [5ae59095] Colors v0.12.10 [8f4d0f93] Conda v1.10.0 [53c48c17] FixedPointNumbers v0.8.4 [682c06a0] JSON v0.21.4 [b964fa9f] LaTeXStrings v1.3.1 [1914dd2f] MacroTools v0.5.13 [69de0a69] Parsers v2.8.1 [aea7be01] PrecompileTools v1.2.0 [21216c6a] Preferences v1.4.1 [438e738f] PyCall v1.96.4 [d330b81b] PyPlot v2.11.2 [189a3867] Reexport v1.2.2 [81def892] VersionParsing v1.3.0 [0dad84c5] ArgTools v1.1.1 [56f22d72] Artifacts [2a0f44e3] Base64 [ade2ca70] Dates [f43a241f] Downloads v1.6.0 [7b1f6079] FileWatching [b77e0a4c] InteractiveUtils [b27032c2] LibCURL v0.6.4 [8f399da3] Libdl [37e2e46d] LinearAlgebra [56ddb016] Logging [d6f4376e] Markdown [a63ad114] Mmap [ca575930] NetworkOptions v1.2.0 [de0858da] Printf [9a3f8284] Random [ea8e919c] SHA v0.7.0 [9e88b42a] Serialization [6462fe0b] Sockets [2f01184e] SparseArrays v1.10.0 [10745b16] Statistics v1.10.0 [fa267f1f] TOML v1.0.3 [8dfed614] Test [cf7118a7] UUIDs [4ec0a83e] Unicode [e66e0078] CompilerSupportLibraries_jll v1.0.5+1 [deac9b47] LibCURL_jll v8.4.0+0 [29816b5a] LibSSH2_jll v1.11.0+1 [c8ffd9c3] MbedTLS_jll v2.28.2+1 [14a3606d] MozillaCACerts_jll v2023.1.10 [4536629a] OpenBLAS_jll v0.3.23+2 [bea87d4a] SuiteSparse_jll v7.2.1+1 [83775a58] Zlib_jll v1.2.13+1 [8e850b90] libblastrampoline_jll v5.8.0+1 [8e850ede] nghttp2_jll v1.52.0+1 Precompiling project... 16 dependencies successfully precompiled in 35 seconds. 4 already precompiled. Testing Running tests... [ Info: PyPlot is using Matplotlib 3.8.3 with Python 3.10.13 ┌ Warning: getindex(o::PyObject, i::Integer) is deprecated, use get(o, i - 1) instead. │ caller = top-level scope at runtests.jl:9 └ @ Core C:\Users\Andrea.julia\packages\PyPlot\2MlrT\test\runtests.jl:9 ERROR: Package PyPlot errored during testing (exit code: 3228369022)

I'm currently using Version 1.10.0 (2023-12-25).

How can I fix the problem?

For sure I will be very happy if you can give me a resolution about the problema.

Thanks a lot!

PallHaraldsson commented 7 months ago

I'm not debugging right now, but consider: "See also PythonPlot.jl for a version of PyPlot.jl using the alternative PythonCall.jl package."

It's a drop-in replacement, and maybe time to deprecate PyPlot... It see it (its test) use "deprecated"/warn, though I think the ERROR unrelated. It tests ok for me:

[ Info: PythonPlot is using Matplotlib 3.8.3 with Python 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 21:10:00) [GCC 12.3.0]

ufechner7 commented 6 months ago

PyPlot is working fine for me on Windows 10 and on Linux, better than PythonPlot.

Did you try:

mkdir MyProject
cd MyProject
julia --project="."
using Pkg
ENV["PYTHON"]=""
pkg"add PyPlot"

quit Julia, restart it with julia --project and then create a plot?