PyPlot crashes REPL after re-install

Hello community,

I deleted the miniconda by mistake, then installed back again. Unfortunately the pyplot doesn’t work anymore. I found the python version in miniconda is updated to 3.9, while the previous one was 3.7. Is there any way to downgrade the version of python in miniconda (installed within julia)? Anyone can give me some advice?

pyplot()
Plots.PyPlotBackend()

julia> plot(log, 1:10)

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ff9abad87f7 -- unknown function (ip: 00007ff9abad87f7)
in expression starting at none:0
unknown function (ip: 00007ff9abad87f7)
unknown function (ip: 00007ff9abad202f)
unknown function (ip: 00007ff9abadc223)
unknown function (ip: 00007ff9d4df4de1)
unknown function (ip: 00007ff9d4df9db8)
PyArg_CheckPositional at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
Py_NewReference at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyType_GenericAlloc at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
Py_NewReference at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
Py_NewReference at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
Py_NewReference at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
Py_NewReference at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
Py_NewReference at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyVectorcall_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyObject_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
Py_NewReference at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
Py_NewReference at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyVectorcall_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyObject_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyVectorcall_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyObject_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
Py_NewReference at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
Py_NewReference at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyVectorcall_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyObject_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyVectorcall_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyObject_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyEval_EvalFrameDefault at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyFunction_Vectorcall at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyType_GenericAlloc at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyVectorcall_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
PyObject_Call at C:\Users\hez\.julia\conda\3\python39.dll (unknown line)
macro expansion at C:\Users\hez\.julia\packages\PyCall\3fwVL\src\exception.jl:95 [inlined]      
#107 at C:\Users\hez\.julia\packages\PyCall\3fwVL\src\pyfncall.jl:43 [inlined]
disable_sigint at .\c.jl:458 [inlined]
__pycall! at C:\Users\hez\.julia\packages\PyCall\3fwVL\src\pyfncall.jl:42 [inlined]
_pycall! at C:\Users\hez\.julia\packages\PyCall\3fwVL\src\pyfncall.jl:29
_pycall! at C:\Users\hez\.julia\packages\PyCall\3fwVL\src\pyfncall.jl:11 [inlined]
#_#114 at C:\Users\hez\.julia\packages\PyCall\3fwVL\src\pyfncall.jl:86 [inlined]
PyObject at C:\Users\hez\.julia\packages\PyCall\3fwVL\src\pyfncall.jl:86
py_drawfig at C:\Users\hez\.julia\packages\Plots\LSKOd\src\backends\pyplot.jl:287
_before_layout_calcs at C:\Users\hez\.julia\packages\Plots\LSKOd\src\backends\pyplot.jl:1458    
prepare_output at C:\Users\hez\.julia\packages\Plots\LSKOd\src\plot.jl:217
showjuno at C:\Users\hez\.julia\packages\Plots\LSKOd\src\output.jl:251
show at C:\Users\hez\.julia\packages\Plots\LSKOd\src\output.jl:210
unknown function (ip: 00000000842a809f)
show at .\multimedia.jl:111
displayinplotpane at C:\Users\hez\.julia\packages\Atom\bfwsW\src\display\showdisplay.jl:67      
display at C:\Users\hez\.julia\packages\Atom\bfwsW\src\display\showdisplay.jl:118
display at .\multimedia.jl:328
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1703 [inlined]
jl_f__call_latest at /cygdrive/c/buildbot/worker/package_win64/build/src\builtins.c:714
#invokelatest#2 at .\essentials.jl:708 [inlined]
invokelatest at .\essentials.jl:706 [inlined]
print_response at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\REPL\src\REPL.jl:247
#40 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\REPL\src\REPL.jl:231
jfptr_YY.40_55978.clone_1 at C:\Users\hez\Downloads\julia-1.6\lib\julia\sys.dll (unknown line)  
with_repl_linfo at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\REPL\src\REPL.jl:462
print_response at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\REPL\src\REPL.jl:229
do_respond at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\REPL\src\REPL.jl:798
unknown function (ip: 000000006860e1d7)
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1703 [inlined]
jl_f__call_latest at /cygdrive/c/buildbot/worker/package_win64/build/src\builtins.c:714
#invokelatest#2 at .\essentials.jl:708 [inlined]
invokelatest at .\essentials.jl:706 [inlined]
run_interface at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\REPL\src\LineEdit.jl:2441
jfptr_run_interface_56082.clone_1 at C:\Users\hez\Downloads\julia-1.6\lib\julia\sys.dll (unknown line)
run_frontend at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\REPL\src\REPL.jl:1126
#44 at .\task.jl:411
jfptr_YY.44_54905.clone_1 at C:\Users\hez\Downloads\julia-1.6\lib\julia\sys.dll (unknown line)  
jl_apply at /cygdrive/c/buildbot/worker/package_win64/build/src\julia.h:1703 [inlined]
start_task at /cygdrive/c/buildbot/worker/package_win64/build/src\task.c:833
Allocations: 150359331 (Pool: 150303899; Big: 55432); GC: 163

If the Python version has changed you probably just need to rebuild PyCall, as in

pkg> build PyCall

Yes I did. Actually I found the way to downgrade version of python by :

using Conda
Conda.add("python=3.7") # or anyother version you want

Even after build PyCall again, the problem is stil there…

I have never used pyplot, at least not directly. As for now, my guess would be to try to reinstall it. You may also provide some additional info, however, I see that you are on cygwin so its slightly additionally complicating the situation. Hard to say if I am able to help to resolve it, however, I guess this might be useful info for some specialist. My best advice would be to try and use PythonCall.jl. With full respect to PyCall.jl, its a lot to like about PythonCall.jl.

# Some PyCall.jl and Conda.jl checks:
using PyCall
PyCall.pyversion 
PyCall.python
PyCall.libpython  
PyCall.pyprogramname 
PyCall.conda
using Conda
Conda.ROOTENV 
Conda.bin_dir(:uniref)
Conda.PYTHONDIR