I am new to Python and Jupyter Notebook. I have Anaconda installed on my Windows 11 computer. I am running Jupyter Notebook in a virtual environent. The problem I'm encountering happens when I attempt to run the following...
import torch
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import torch.nn as nn
X = torch.linspace(1,50,50).reshape(-1,1)
torch.manual_seed(71)
e = torch.randint(-8,9,(50,1),dtype=torch.float)
y = 2*X + 1 + e
plt.scatter(X.numpy(),y.numpy())
The error I get is
"The kernel appears to have died. It will restart automatically."
I think I have narrowed the issue down to matplotlib, as it is the only new element I have imported, and only the cell referencing "plt.scatter" causes the kernel to die.
I have tried the following solutions
Run Anaconda Prompt as administrator
conda install --yes freetype=2.10.4
which results in
"# All requested packages already installed."
I also tried
conda update mkl
printing 'Hello World' works fine, as does using numpy and torch from what I can tell.
It's worth mentioning that when the kernel dies, my command window shows the following:
[I 16:30:08.979 NotebookApp] Kernel started: 503c71ae-ced0-4147-8f23-7cdad416d503, name: python3
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
[I 16:30:23.983 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
WARNING:root:kernel 503c71ae-ced0-4147-8f23-7cdad416d503 restarted
Any help would be greatly appreciated.