9

I am trying to learn charting in Python and keep getting this message in Jupyter:

The kernel appears to have died. It will restart automatically.

My other basic programs are working, so it looks like using Matplotlib is causing this problem. Any thoughts on how to resolve this?

import matplotlib.pyplot as plt

plt.plot()
plt.show()

Screenshot of message I am getting

tdy
  • 36,675
  • 19
  • 86
  • 83
ps1495
  • 151
  • 1
  • 2
  • 9
  • Have you already taken a look here? https://stackoverflow.com/a/47547114 The suggestion is to reinstall the faulty library – Lorenzo Jan 15 '21 at 10:06
  • Thank you very much for your prompt response. I tried that already. I also uninstalled and reinstalled Jupiter and I'm still getting the same error. – ps1495 Jan 16 '21 at 01:53
  • what is your OS? How did you install both Jupyter and Python? – Lorenzo Jan 17 '21 at 15:24

4 Answers4

16

if you don't solve the problem after using method above, you can try this:

import os    
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'

add two lines of codes in your python code. This mothed is also useful to pycharm.

yinghaodang
  • 193
  • 1
  • 8
  • 2
    why do we need to add this line of code ? is there an permenant solution instead of adding it all the time – npkp Apr 20 '23 at 13:47
  • In 2023 with latest conda, this worked for me. The freetype upgrade in other answers didn't work. – Shital Shah Aug 30 '23 at 08:08
1

I try the solution of this video, based on this post, and it worked for me:

  • Run Anaconda Prompt as administrator
  • conda install --yes freetype=2.10.4
1

I did the following :

conda install --yes freetype=2.10.4

it works. Great!

buddemat
  • 4,552
  • 14
  • 29
  • 49
1suming
  • 11
  • 3
1

If the libiomp5md.dll file is not in the binary exectuables folder of your environment, then this may be the cause of the kernel dying.

  1. Download the libiomp5md.dll file from a trusted online source. I used https://www.dll-files.com/libiomp5md.dll.html and downloaded the latest version. I do not condone the use of this link, and please do your own research to find a trusted source to download this file.

  2. Navigate to -> ./anaconda3/envs/your_env_name/Library/bin and add the libiomp5md.dll file to that folder.

  3. matplotlib should now work without kernel dying, as it did for me.