conda更新后,使用matplotlib时python内核崩溃

jto*_*lem 46 python windows matplotlib freetype conda

我创建了这个简单的环境conda

conda create -n test python=3.8.5 pandas scipy numpy matplotlib seaborn jupyterlab
Run Code Online (Sandbox Code Playgroud)

以下代码使jupyter lab内核崩溃:

import matplotlib.pyplot as plt

plt.subplot()
Run Code Online (Sandbox Code Playgroud)

我没有遇到这个问题Linux。问题是当我试穿时Windows 10

控制台(我启动服务器的地方)上没有错误jupyter lab,我不知道在哪里调查。

Tre*_*ney 74

更新2021-11-06

  • 默认pkgs/main通道已恢复为 Windowsconda使用,每个main / packages / freetypefreetype 2.10.4
  • 如果您仍然遇到问题,请使用conda list freetype检查版本:freetype != 2.11.0
    • 如果是2.11.0,则根据解决方案更改版本,或者conda update --all(前提是配置文件中的默认通道未更改.condarc)。

解决方案

  • 如果这种情况发生在安装Anaconda、更新之后condafreetype自 2021 年 10 月 27 日以来。
  • 在任何受影响的环境中转到Anaconda提示符并降级freetype 2.11.0
    • conda install freetype=2.10.4
  • matplotlib与任何使用的包和任何 IDE 相关
    • 例如,pandas.DataFrame.plotseaborn
    • Jupyter、Spyder、VSCode、PyCharm、命令行。

发现

  • 使用 10 月 29 日星期五发布的最新更新进行更新后出现问题conda
  • 使用 更新后,任何 IDE(不仅仅是 )中conda update --all与 相关的任何内容都会出现问题。 matplotlibJupyter
    • 我在JupyterLabPyCharm、 和python命令提示符中对此进行了测试。
    • PyCharm:Process finished with exit code -1073741819
    • JupyterLab:内核刚刚重新启动,没有相关错误或回溯
    • 命令提示符:将短暂出现一个空白的交互式 matplotlib 窗口,然后出现一个新的命令行。
  • 问题似乎出在conda update --allin 上(base),然后任何使用matplotlib(例如seabornpandas.DataFrame.plot)的绘图 API 都会在任何环境中杀死内核。
  • 我必须重新安装 Anaconda,但不更新 Anaconda(base),然后我的其他环境就可以工作了。
  • 我还没有弄清楚具体是什么导致了这个问题。
  • python 3.8.12我用和测试了这个问题python 3.9.7
  • 当前测试:
    • 以下是conda修订日志。
    • 在此环境之前conda update --all可以正常工作,但在更新之后,使用 进行绘图会导致matplotlibpython 内核崩溃
  2021-10-31 10:47:22  (rev 3)
     bokeh  {2.3.3 (defaults/win-64) -> 2.4.1 (defaults/win-64)}
     click  {8.0.1 (defaults/noarch) -> 8.0.3 (defaults/noarch)}
     filelock  {3.0.12 (defaults/noarch) -> 3.3.1 (defaults/noarch)}
     freetype  {2.10.4 (defaults/win-64) -> 2.11.0 (defaults/win-64)}
     imagecodecs  {2021.6.8 (defaults/win-64) -> 2021.8.26 (defaults/win-64)}
     joblib  {1.0.1 (defaults/noarch) -> 1.1.0 (defaults/noarch)}
     lerc  {2.2.1 (defaults/win-64) -> 3.0 (defaults/win-64)}
     more-itertools  {8.8.0 (defaults/noarch) -> 8.10.0 (defaults/noarch)}
     pyopenssl  {20.0.1 (defaults/noarch) -> 21.0.0 (defaults/noarch)}
     scikit-learn  {0.24.2 (defaults/win-64) -> 1.0.1 (defaults/win-64)}
     statsmodels  {0.12.2 (defaults/win-64) -> 0.13.0 (defaults/win-64)}
     sympy  {1.8 (defaults/win-64) -> 1.9 (defaults/win-64)}
     tqdm  {4.62.2 (defaults/noarch) -> 4.62.3 (defaults/noarch)}
     xlwings  {0.24.7 (defaults/win-64) -> 0.24.9 (defaults/win-64)}
Run Code Online (Sandbox Code Playgroud)