henry2004y / Vlasiator.jl

Data processor for Vlasiator
https://henry2004y.github.io/Vlasiator.jl/stable/
MIT License
6 stars 4 forks source link

JOSS review: test failure on Julia 1.8 #114

Closed ranocha closed 1 year ago

ranocha commented 1 year ago

On Julia v1.8.2, I get

(@v1.8) pkg> activate .

(Vlasiator_jl) pkg> add Vlasiator
...

(Vlasiator_jl) pkg> test Vlasiator
...
  Downloaded artifact: testdata
┌ Warning: Error requiring `PyPlot` from `Vlasiator`
│   exception =
│    LoadError: PyError ($(Expr(:escape, :(ccall(#= ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'KeyError'>
│    KeyError('Unrecognized key "pcolor.shading" for group "pcolor" and name "shading"')
│      File "/usr/lib/python3/dist-packages/matplotlib/__init__.py", line 1115, in rc
│        raise KeyError(('Unrecognized key "%s" for group "%s" and '
│    
│    Stacktrace:
│      [1] pyerr_check
│        @ ~/.julia/packages/PyCall/ygXW2/src/exception.jl:62 [inlined]
│      [2] pyerr_check
│        @ ~/.julia/packages/PyCall/ygXW2/src/exception.jl:66 [inlined]
│      [3] _handle_error(msg::String)
│        @ PyCall ~/.julia/packages/PyCall/ygXW2/src/exception.jl:83
│      [4] macro expansion
│        @ ~/.julia/packages/PyCall/ygXW2/src/exception.jl:97 [inlined]
│      [5] #107
│        @ ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:43 [inlined]
│      [6] disable_sigint
│        @ ./c.jl:473 [inlined]
│      [7] __pycall!
│        @ ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:42 [inlined]
│      [8] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{String}, nargs::Int64, kw::PyCall.PyObject)
│        @ PyCall ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:29
│      [9] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{String}, kwargs::Base.Pairs{Symbol, String, Tuple{Symbol}, NamedTuple{(:shading,), Tuple{String}}})
│        @ PyCall ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:11
│     [10] #_#114
│        @ ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:86 [inlined]
│     [11] top-level scope
│        @ ~/.julia/packages/Vlasiator/oOdeL/src/plot/pyplot.jl:15
│     [12] include(mod::Module, _path::String)
│        @ Base ./Base.jl:419
│     [13] include(x::String)
│        @ Vlasiator ~/.julia/packages/Vlasiator/oOdeL/src/Vlasiator.jl:1
│     [14] macro expansion
│        @ ~/.julia/packages/Requires/Z8rfN/src/Requires.jl:40 [inlined]
│     [15] top-level scope
│        @ ~/.julia/packages/Vlasiator/oOdeL/src/Vlasiator.jl:54
│     [16] eval
│        @ ./boot.jl:368 [inlined]
│     [17] eval
│        @ ~/.julia/packages/Vlasiator/oOdeL/src/Vlasiator.jl:1 [inlined]
│     [18] (::Vlasiator.var"#231#237")()
│        @ Vlasiator ~/.julia/packages/Requires/Z8rfN/src/require.jl:101
│     [19] macro expansion
│        @ ./timing.jl:382 [inlined]
│     [20] err(f::Any, listener::Module, modname::String, file::String, line::Any)
│        @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:47
│     [21] (::Vlasiator.var"#230#236")()
│        @ Vlasiator ~/.julia/packages/Requires/Z8rfN/src/require.jl:100
│     [22] withpath(f::Any, path::String)
│        @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:37
│     [23] (::Vlasiator.var"#229#235")()
│        @ Vlasiator ~/.julia/packages/Requires/Z8rfN/src/require.jl:99
│     [24] #invokelatest#2
│        @ ./essentials.jl:729 [inlined]
│     [25] invokelatest
│        @ ./essentials.jl:726 [inlined]
│     [26] foreach(f::typeof(Base.invokelatest), itr::Vector{Function})
│        @ Base ./abstractarray.jl:2774
│     [27] loadpkg(pkg::Base.PkgId)
│        @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:27
│     [28] #invokelatest#2
│        @ ./essentials.jl:729 [inlined]
│     [29] invokelatest
│        @ ./essentials.jl:726 [inlined]
│     [30] run_package_callbacks(modkey::Base.PkgId)
│        @ Base ./loading.jl:869
│     [31] _require_prelocked(uuidkey::Base.PkgId)
│        @ Base ./loading.jl:1206
│     [32] macro expansion
│        @ ./loading.jl:1180 [inlined]
│     [33] macro expansion
│        @ ./lock.jl:223 [inlined]
│     [34] require(into::Module, mod::Symbol)
│        @ Base ./loading.jl:1144
│     [35] macro expansion
│        @ ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:380 [inlined]
│     [36] macro expansion
│        @ .../julia-1.8.2/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]                                                                                                   
│     [37] macro expansion
│        @ ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:380 [inlined]
│     [38] macro expansion
│        @ .../julia-1.8.2/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]                                                                                                   
│     [39] top-level scope
│        @ ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:39
│     [40] include(fname::String)
│        @ Base.MainInclude ./client.jl:476
│     [41] top-level scope
│        @ none:6
│     [42] eval
│        @ ./boot.jl:368 [inlined]
│     [43] exec_options(opts::Base.JLOptions)
│        @ Base ./client.jl:276
│     [44] _start()
│        @ Base ./client.jl:522
│    in expression starting at ~/.julia/packages/Vlasiator/oOdeL/src/plot/pyplot.jl:14
└ @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:51
PyPlot: Error During Test at ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:379
  Got exception outside of a @test
  PyError ($(Expr(:escape, :(ccall(#= ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'ValueError'>
  ValueError('Illegal format string "proton/vg_rho"; two marker symbols')
    File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 2787, in plot
      return gca().plot(
    File "/usr/lib/python3/dist-packages/matplotlib/axes/_axes.py", line 1665, in plot
      lines = [*self._get_lines(*args, data=data, **kwargs)]
    File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 225, in __call__
      yield from self._plot_args(this, kwargs)
    File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 366, in _plot_args
      linestyle, marker, color = _process_plot_format(tup[-1])
    File "/usr/lib/python3/dist-packages/matplotlib/axes/_base.py", line 90, in _process_plot_format
      raise ValueError(

  Stacktrace:
    [1] pyerr_check
      @ ~/.julia/packages/PyCall/ygXW2/src/exception.jl:62 [inlined]
    [2] pyerr_check
      @ ~/.julia/packages/PyCall/ygXW2/src/exception.jl:66 [inlined]
    [3] _handle_error(msg::String)
      @ PyCall ~/.julia/packages/PyCall/ygXW2/src/exception.jl:83
    [4] macro expansion
      @ ~/.julia/packages/PyCall/ygXW2/src/exception.jl:97 [inlined]
    [5] #107
      @ ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:43 [inlined]
    [6] disable_sigint
      @ ./c.jl:473 [inlined]
    [7] __pycall!
      @ ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:42 [inlined]
    [8] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{MetaVLSV, String}, nargs::Int64, kw::Ptr{Nothing})
      @ PyCall ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:29
    [9] _pycall!(ret::PyCall.PyObject, o::PyCall.PyObject, args::Tuple{MetaVLSV, String}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
      @ PyCall ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:11
   [10] pycall(::PyCall.PyObject, ::Type{PyCall.PyAny}, ::MetaVLSV, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
      @ PyCall ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:83
   [11] pycall(::PyCall.PyObject, ::Type{PyCall.PyAny}, ::MetaVLSV, ::Vararg{Any})
      @ PyCall ~/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:83
   [12] plot(::MetaVLSV, ::Vararg{Any}; kws::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
      @ PyPlot ~/.julia/packages/PyPlot/NsAWt/src/PyPlot.jl:194
   [13] plot(::MetaVLSV, ::Vararg{Any})
      @ PyPlot ~/.julia/packages/PyPlot/NsAWt/src/PyPlot.jl:190
   [14] macro expansion
      @ ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:384 [inlined]
   [15] macro expansion
      @ .../julia-1.8.2/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
   [16] macro expansion
      @ ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:380 [inlined]
   [17] macro expansion
      @ .../julia-1.8.2/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
   [18] top-level scope
      @ ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:39
   [19] include(fname::String)
      @ Base.MainInclude ./client.jl:476
   [20] top-level scope
      @ none:6
   [21] eval
      @ ./boot.jl:368 [inlined]
   [22] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:276
   [23] _start()
      @ Base ./client.jl:522
WARNING: could not import Vlasiator.vdfslice into Main
Plot UI: Error During Test at ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:472
  Got exception outside of a @test
  UndefVarError: pui not defined
  Stacktrace:
    [1] macro expansion
      @ ~/.julia/packages/Suppressor/tQJeL/src/Suppressor.jl:66 [inlined]
    [2] macro expansion
      @ ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:475 [inlined]
    [3] macro expansion
      @ .../julia-1.8.2/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
    [4] macro expansion
      @ ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:473 [inlined]
    [5] macro expansion
      @ .../julia-1.8.2/share/julia/stdlib/v1.8/Test/src/Test.jl:1357 [inlined]
    [6] top-level scope
      @ ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:39
    [7] include(fname::String)
      @ Base.MainInclude ./client.jl:476
    [8] top-level scope
      @ none:6
    [9] eval
      @ ./boot.jl:368 [inlined]
   [10] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:276
   [11] _start()
      @ Base ./client.jl:522
Test Summary:           | Pass  Error  Total   Time
Vlasiator.jl            |  114      2    116  47.1s
  Reading files         |   56            56   7.7s
  Derived variables     |   33            33   9.4s
  VLSV writing          |    1             1   0.4s
  Rotation              |    3             3   0.7s
  Curvature, Divergence |    3             3   0.6s
  Gradient              |    3             3   0.4s
  FluxFunction          |    3             3   1.6s
  Sampling              |    4             4   1.6s
  VTK                   |    3             3   2.7s
  Log                   |    1             1   1.3s
  Monitor               |    1             1   0.1s
  PyPlot                |           1      1  12.2s
  Plots                 |    3             3   3.4s
  Plot UI               |           1      1   0.3s
ERROR: LoadError: Some tests did not pass: 114 passed, 0 failed, 2 errored, 0 broken.
in expression starting at ~/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:38
ERROR: Package Vlasiator errored during testing

Xref https://github.com/openjournals/joss-reviews/issues/4906

henry2004y commented 1 year ago

This is caused by an unsuccessful installation of PyCall, which in turn affects PyPlot. I did some more tests for Julia 1.8.2/1.8.3 on different platforms:

Platform Affiliation Information Status
Ubuntu PC Intel(R) i5-10210U Passed
Win11 PC Intel(R) i7-10750H Passed
Win10 PC Intel(R) i7-8700k Passed
Turso University of Helsinki AMD EPYC 7452 Passed
Puhti CSC Intel(R) Xeon(R) Gold 6230 Passed
Mahti CSC AMD EPYC 7402 Failed

On Mahti, I see similar error messages as posted above when linking to the system loaded Python. When instead installing a fresh standalone Python via conda:

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

It almost passed all tests except one for contour:

PyPlot: Error During Test at /users/hongyang/.julia/packages/Vlasiator/oOdeL/test/runtests.jl:379
  Got exception outside of a @test
  PyError ($(Expr(:escape, :(ccall(#= /users/hongyang/.julia/packages/PyCall/ygXW2/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'ImportError'>
  ImportError("/appl/spack/v017/install-tree/gcc-8.5.0/gcc-11.2.0-zshp2k/lib64/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /users/hongyang/.julia/conda/3/lib/python3.10/site-packages/contourpy/_contourpy.cpython-310-x86_64-linux-gnu.so)")
    File "/users/hongyang/.julia/conda/3/lib/python3.10/site-packages/matplotlib/__init__.py", line 1423, in inner
      return func(ax, *map(sanitize_sequence, args), **kwargs)
    File "/users/hongyang/.julia/conda/3/lib/python3.10/site-packages/matplotlib/axes/_axes.py", line 6398, in contour
      contours = mcontour.QuadContourSet(self, *args, **kwargs)
    File "/users/hongyang/.julia/conda/3/lib/python3.10/site-packages/matplotlib/contour.py", line 794, in __init__
      kwargs = self._process_args(*args, **kwargs)
    File "/users/hongyang/.julia/conda/3/lib/python3.10/site-packages/matplotlib/contour.py", line 1419, in _process_args
      import contourpy
    File "/users/hongyang/.julia/conda/3/lib/python3.10/site-packages/contourpy/__init__.py", line 3, in <module>
      from ._contourpy import (
...
Test Summary:           | Pass  Error  Total     Time
Vlasiator.jl            |  130      1    131  1m02.5s
  Reading files         |   56            56    11.6s
  Derived variables     |   33            33    13.1s
  VLSV writing          |    1             1     0.4s
  Rotation              |    3             3     0.8s
  Curvature, Divergence |    3             3     0.8s
  Gradient              |    3             3     0.5s
  FluxFunction          |    3             3     1.9s
  Sampling              |    4             4     1.7s
  VTK                   |    3             3     3.0s
  Log                   |    1             1     2.0s
  Monitor               |    1             1     0.2s
  PyPlot                |   14      1     15    22.7s
  Plots                 |    3             3     1.4s
  Plot UI               |    2             2     1.3s
henry2004y commented 1 year ago

I tried again on my previous failed platform Mahti with Julia1.8.5 and Vlasiator v0.9.36, and now it has passed:

Mahti

```julia (@v1.8) pkg> st Status `~/.julia/environments/v1.8/Project.toml` [6e4b80f9] BenchmarkTools v1.3.2 [438e738f] PyCall v1.95.1 [d330b81b] PyPlot v2.11.0 [7d2ba682] Vlasiator v0.9.36 (@v1.8) pkg> test Vlasiator Testing Vlasiator Status `/local_scratch/hongyang/jl_qDiQp9/Project.toml` [8f5d6c58] EzXML v1.1.0 [b964fa9f] LaTeXStrings v1.3.0 [7031d0ef] LazyGrids v0.5.0 [69de0a69] Parsers v2.5.2 [d330b81b] PyPlot v2.11.0 [3cdcf5f2] RecipesBase v1.3.3 [ae029012] Requires v1.3.0 [66db9d55] SnoopPrecompile v1.0.3 [90137ffa] StaticArrays v1.5.12 [fd094767] Suppressor v0.2.1 [7d2ba682] Vlasiator v0.9.36 [64499a7a] WriteVTK v1.16.0 [ade2ca70] Dates `@stdlib/Dates` [4af54fe1] LazyArtifacts `@stdlib/LazyArtifacts` [37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra` [a63ad114] Mmap `@stdlib/Mmap` [de0858da] Printf `@stdlib/Printf` [3fa0cd96] REPL `@stdlib/REPL` [ea8e919c] SHA v0.7.0 `@stdlib/SHA` [10745b16] Statistics `@stdlib/Statistics` [8dfed614] Test `@stdlib/Test` Status `/local_scratch/hongyang/jl_qDiQp9/Manifest.toml` [944b1d66] CodecZlib v0.7.0 [3da002f7] ColorTypes v0.11.4 [5ae59095] Colors v0.12.10 [8f4d0f93] Conda v1.7.0 [8f5d6c58] EzXML v1.1.0 [1a297f60] FillArrays v0.13.6 [53c48c17] FixedPointNumbers v0.8.4 [692b3bcd] JLLWrappers v1.4.1 [682c06a0] JSON v0.21.3 [b964fa9f] LaTeXStrings v1.3.0 [7031d0ef] LazyGrids v0.5.0 [9c8b4983] LightXML v0.9.0 [1914dd2f] MacroTools v0.5.10 [69de0a69] Parsers v2.5.2 [21216c6a] Preferences v1.3.0 [438e738f] PyCall v1.95.1 [d330b81b] PyPlot v2.11.0 [3cdcf5f2] RecipesBase v1.3.3 [189a3867] Reexport v1.2.2 [ae029012] Requires v1.3.0 [66db9d55] SnoopPrecompile v1.0.3 [90137ffa] StaticArrays v1.5.12 [1e83bf80] StaticArraysCore v1.4.0 [fd094767] Suppressor v0.2.1 [3bb67fe8] TranscodingStreams v0.9.11 [81def892] VersionParsing v1.3.0 [7d2ba682] Vlasiator v0.9.36 [64499a7a] WriteVTK v1.16.0 [94ce4f54] Libiconv_jll v1.16.1+2 [02c8fc9c] XML2_jll v2.10.3+0 [0dad84c5] ArgTools v1.1.1 `@stdlib/ArgTools` [56f22d72] Artifacts `@stdlib/Artifacts` [2a0f44e3] Base64 `@stdlib/Base64` [ade2ca70] Dates `@stdlib/Dates` [f43a241f] Downloads v1.6.0 `@stdlib/Downloads` [7b1f6079] FileWatching `@stdlib/FileWatching` [b77e0a4c] InteractiveUtils `@stdlib/InteractiveUtils` [4af54fe1] LazyArtifacts `@stdlib/LazyArtifacts` [b27032c2] LibCURL v0.6.3 `@stdlib/LibCURL` [76f85450] LibGit2 `@stdlib/LibGit2` [8f399da3] Libdl `@stdlib/Libdl` [37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra` [56ddb016] Logging `@stdlib/Logging` [d6f4376e] Markdown `@stdlib/Markdown` [a63ad114] Mmap `@stdlib/Mmap` [ca575930] NetworkOptions v1.2.0 `@stdlib/NetworkOptions` [44cfe95a] Pkg v1.8.0 `@stdlib/Pkg` [de0858da] Printf `@stdlib/Printf` [3fa0cd96] REPL `@stdlib/REPL` [9a3f8284] Random `@stdlib/Random` [ea8e919c] SHA v0.7.0 `@stdlib/SHA` [9e88b42a] Serialization `@stdlib/Serialization` [6462fe0b] Sockets `@stdlib/Sockets` [2f01184e] SparseArrays `@stdlib/SparseArrays` [10745b16] Statistics `@stdlib/Statistics` [fa267f1f] TOML v1.0.0 `@stdlib/TOML` [a4e569a6] Tar v1.10.1 `@stdlib/Tar` [8dfed614] Test `@stdlib/Test` [cf7118a7] UUIDs `@stdlib/UUIDs` [4ec0a83e] Unicode `@stdlib/Unicode` [e66e0078] CompilerSupportLibraries_jll v1.0.1+0 `@stdlib/CompilerSupportLibraries_jll` [deac9b47] LibCURL_jll v7.84.0+0 `@stdlib/LibCURL_jll` [29816b5a] LibSSH2_jll v1.10.2+0 `@stdlib/LibSSH2_jll` [c8ffd9c3] MbedTLS_jll v2.28.0+0 `@stdlib/MbedTLS_jll` [14a3606d] MozillaCACerts_jll v2022.2.1 `@stdlib/MozillaCACerts_jll` [4536629a] OpenBLAS_jll v0.3.20+0 `@stdlib/OpenBLAS_jll` [83775a58] Zlib_jll v1.2.12+3 `@stdlib/Zlib_jll` [8e850b90] libblastrampoline_jll v5.1.1+0 `@stdlib/libblastrampoline_jll` [8e850ede] nghttp2_jll v1.48.0+0 `@stdlib/nghttp2_jll` [3f19e933] p7zip_jll v17.4.0+0 `@stdlib/p7zip_jll` Precompiling project... 1 dependency successfully precompiled in 1 seconds. 35 already precompiled. Testing Running tests... Test Summary: | Pass Total Time Vlasiator.jl | 139 139 1m02.1s Testing Vlasiator tests passed ```

Maybe it's due to some recent fixes in PyCall. Can you check if this works on your test machine @ranocha?

ranocha commented 1 year ago

Seem to work on my system, too.