conda 更新后,python 内核在使用 matplotlib 时崩溃
After conda update, python kernel crashes when matplotlib is used
我用 conda
:
创建了这个简单的环境
conda create -n test python=3.8.5 pandas scipy numpy matplotlib seaborn jupyterlab
jupyter lab
中的以下代码使内核崩溃:
import matplotlib.pyplot as plt
plt.subplot()
我在 Linux
上没有遇到这个问题。问题是当我尝试 Windows 10
.
jupyter lab
控制台(我启动服务器的地方)没有错误,我不知道去哪里调查。
更新 2021-11-06
- 根据 main / packages / freetype.
,conda
的默认 pkgs/main
频道已恢复为 Windows 使用 freetype 2.10.4
- 如果问题仍然存在,请使用
conda list freetype
检查版本:freetype != 2.11.0
- 如果是 2.11.0,则根据解决方案更改版本,或
conda update --all
(前提是 .condarc
配置文件中的默认频道未更改)。
解决方案
- 如果自 2021 年 10 月 27 日起安装 Anaconda, updating
conda
or freetype
后出现这种情况。
- 转到
Anaconda
提示并在任何受影响的环境中降级 freetype 2.11.0
。
conda install freetype=2.10.4
- 与使用
matplotlib
和任何 IDE 的任何软件包相关
- 例如,
pandas.DataFrame.plot
和seaborn
- Jupyter、Spyder、VSCode、PyCharm、命令行。
发现
- 使用 10 月 29 日星期五发布的
conda
的最新更新进行更新后出现问题。
- 使用
conda update --all
更新后,任何 IDE(不仅仅是 Jupyter
)中与 matplotlib
相关的任何内容都存在问题。
- 我在
JupyterLab
、PyCharm
和 python
中从命令提示符测试了这个。
- PyCharm:
Process finished with exit code -1073741819
- JupyterLab:内核刚刚重启,没有相关错误或回溯
- 命令提示符:会短暂出现一个空白的交互式matplotlib window,然后出现一个新的命令行。
- 问题似乎出在
(base)
中的 conda update --all
,然后是任何使用 matplotlib
的地块 API(例如 seaborn
和 pandas.DataFrame.plot
) 在任何环境中杀死内核。
- 我不得不重新安装 Anaconda,但是 不更新
(base)
,然后我的其他环境工作了。
- 我还没有弄清楚具体是什么导致了这个问题。
- 我用
python 3.8.12
和 python 3.9.7
测试了这个问题
- 当前测试:
- 以下是
conda
修订日志。
- 在
conda update --all
之前,此环境可以正常工作,但在更新后,使用 matplotlib
绘图会使 python 内核崩溃
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)}
- 问题似乎是
freetype
- 从
2.11.0
降级到 2.10.4
解决了问题并使环境与 matplotlib
一起工作
- 前往 post 错误报告并发现有 [Bug]: Matplotlib crashes Python #21511
我遇到了同样的问题,经过大量调查和故障排除后,修复非常简单:
conda update -c anaconda numpy
conda upgrade -c conda-forge matplotlib
在那之后 运行 很好,我的视觉效果绘制没有问题。
对于降级到 freetype=2.10.4
无效的任何人。在我的例子中,问题发生在从 conda-forge
频道安装新版本的 scikit-learn=1.11
之后。在尝试了许多选项后,以下对我有用:
- 将
numpy
从 main/pkg
重新安装到 conda-forge
频道
- 重新安装
mkl
软件包 conda -c intel mkl
- 从
conda-forge
重新安装 matplotlib=4.3
这是一项非常严厉的措施,因为您必须重新安装所有依赖于 NumPy(Pandas、TensorFlow 等)的依赖项,但这是唯一对我有用的。
我用 conda
:
conda create -n test python=3.8.5 pandas scipy numpy matplotlib seaborn jupyterlab
jupyter lab
中的以下代码使内核崩溃:
import matplotlib.pyplot as plt
plt.subplot()
我在 Linux
上没有遇到这个问题。问题是当我尝试 Windows 10
.
jupyter lab
控制台(我启动服务器的地方)没有错误,我不知道去哪里调查。
更新 2021-11-06
- 根据 main / packages / freetype. ,
- 如果问题仍然存在,请使用
conda list freetype
检查版本:freetype != 2.11.0
- 如果是 2.11.0,则根据解决方案更改版本,或
conda update --all
(前提是.condarc
配置文件中的默认频道未更改)。
- 如果是 2.11.0,则根据解决方案更改版本,或
conda
的默认 pkgs/main
频道已恢复为 Windows 使用 freetype 2.10.4
解决方案
- 如果自 2021 年 10 月 27 日起安装 Anaconda, updating
conda
orfreetype
后出现这种情况。 - 转到
Anaconda
提示并在任何受影响的环境中降级freetype 2.11.0
。conda install freetype=2.10.4
- 与使用
matplotlib
和任何 IDE 的任何软件包相关- 例如,
pandas.DataFrame.plot
和seaborn
- Jupyter、Spyder、VSCode、PyCharm、命令行。
- 例如,
发现
- 使用 10 月 29 日星期五发布的
conda
的最新更新进行更新后出现问题。 - 使用
conda update --all
更新后,任何 IDE(不仅仅是Jupyter
)中与matplotlib
相关的任何内容都存在问题。- 我在
JupyterLab
、PyCharm
和python
中从命令提示符测试了这个。 - PyCharm:
Process finished with exit code -1073741819
- JupyterLab:内核刚刚重启,没有相关错误或回溯
- 命令提示符:会短暂出现一个空白的交互式matplotlib window,然后出现一个新的命令行。
- 我在
- 问题似乎出在
(base)
中的conda update --all
,然后是任何使用matplotlib
的地块 API(例如seaborn
和pandas.DataFrame.plot
) 在任何环境中杀死内核。 - 我不得不重新安装 Anaconda,但是 不更新
(base)
,然后我的其他环境工作了。 - 我还没有弄清楚具体是什么导致了这个问题。
- 我用
python 3.8.12
和python 3.9.7
测试了这个问题
- 当前测试:
- 以下是
conda
修订日志。 - 在
conda update --all
之前,此环境可以正常工作,但在更新后,使用matplotlib
绘图会使 python 内核崩溃
- 以下是
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)}
- 问题似乎是
freetype
- 从
2.11.0
降级到2.10.4
解决了问题并使环境与matplotlib
一起工作
- 从
- 前往 post 错误报告并发现有 [Bug]: Matplotlib crashes Python #21511
我遇到了同样的问题,经过大量调查和故障排除后,修复非常简单:
conda update -c anaconda numpy
conda upgrade -c conda-forge matplotlib
在那之后 运行 很好,我的视觉效果绘制没有问题。
对于降级到 freetype=2.10.4
无效的任何人。在我的例子中,问题发生在从 conda-forge
频道安装新版本的 scikit-learn=1.11
之后。在尝试了许多选项后,以下对我有用:
- 将
numpy
从main/pkg
重新安装到conda-forge
频道 - 重新安装
mkl
软件包conda -c intel mkl
- 从
conda-forge
重新安装
matplotlib=4.3
这是一项非常严厉的措施,因为您必须重新安装所有依赖于 NumPy(Pandas、TensorFlow 等)的依赖项,但这是唯一对我有用的。