-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kernel not restarting sometimes #13336
Comments
I have the same symptom in the IDE.
Tensorflow is HUGE. My RAM is limited to 8GB. Also, there might be something going on in the tensorflow package. In any case, this is not a Spyder bug. I realize that this is not the reply you hoped for. How much RAM do you have? What is your OS? |
Have a look here: https://github.com/tensorflow/tensorflow/issues |
Also, you could try this in case pypi is out of date: I am doing it myself. Well, that didn't work out. Blew up another way. Trying out tensorflow-cpu (omits the GPU portion). That didn't work out either. Giving up on installing locally. Good luck! |
@texadactyl It's not a TensorFlow bug; this didn't occur in Spyder 4.1.3. So it's either Spyder or its dependencies. And TensorFlow doesn't eat much RAM from simply being imported. |
How do you explain crashing in python3 when Spyder is not involved? |
@texadactyl Bad install or dependencies, most likely. My Task Manager shows a 120MB increase in RAM usage from it - so unless your device can't afford it, |
Have you tried running python3 interactively in a terminal window. What happens? |
This issue looks similar to yours: #12768 |
Also, have you tried this in a Jupyter notebook? |
@texadactyl My RAM figure is from running Python in Anaconda Powershell Prompt. The linked issue has an unrelated exception (I don't have any exception). Jupyter works fine. |
So, |
@OverLordGoldDragon, please share with us the specs of your conda environment, so I can try to reproduce this problem on my side. For that, please run the following command from the Anaconda prompt:
replacing |
@ccordoba12 Better yet, I'll give the exact steps for recreating the environment;
Run |
This is not correct because you're mixing pip and conda packages, and that's what's probably making the kernel crash. Please create a new environment, install tensorflow with conda and try again. |
@ccordoba12 I understand it's not recommended to do so, but some necessary packages are unavailable with Anaconda and I've been using pip for a long time; currently conda supports only up to TF 2.1.0 on Windows. This same install (and much more pip's) worked fine with Spyder 4.1.3. I'm fine downgrading, but unsure how. |
You can create a new env with
|
It... fixed itself? Haven't seen it in past two days despite intensive use, and I haven't installed / uninstalled anything in the env. I'd give it more time to be sure, but still strange. |
@ccordoba12 Nevermind, it's been back - on and off, no clue what the deal is. Not a bother so long as I can keep spawning more console windows though. Reproduced with TF 2.2.0 and 2.3.0. |
@ccordoba12 Found a different way to reproduce: importing a compiled C code#define PY_SSIZE_T_CLEAN
#include <Python.h>
static PyObject *
spam_system(PyObject *self, PyObject *args)
{
const char *command;
int sts;
if (!PyArg_ParseTuple(args, "s", &command))
return NULL;
sts = system(command);
return PyLong_FromLong(sts);
}
static PyMethodDef SpamMethods[] = {
{"system", spam_system, METH_VARARGS,
"Execute a shell command."},
{NULL, NULL, 0, NULL} /* Sentinel */
};
static struct PyModuleDef spammodule = {
PyModuleDef_HEAD_INIT,
"spam", /* name of module */
NULL, /* module documentation, may be NULL */
-1, /* size of per-interpreter state of the module,
or -1 if the module keeps state in global variables. */
SpamMethods
};
PyMODINIT_FUNC
PyInit_spam(void)
{
return PyModule_Create(&spammodule);
} setup.pyfrom distutils.core import setup, Extension
module1 = Extension('spam',
sources = ['spammodule.c'])
setup (name = 'PackageName',
version = '1.0',
description = 'This is a demo package',
ext_modules = [module1]) Run import spam
spam.system('h') TensorFlow does import from |
Update as of 2021/03/29 This issue still persists. I realize that there's likely a ton of other bugs to squish and we really appreciate the work you guys are doing. That said, the latest versions of Tensorflow/Keras have some really nice features that I (we'd) love to take advantage of... As far as I can tell, the latest conda build does not have the latest TF/Keras build and still requires pip to install. Here's my dependencies, which is mostly the latest conda build plus pip-installed TF/keras, SHAP, XGBoost and upgraded qtconsole from 5.0.2 to 5.0.3 (which isn't available in conda either). (see attached txt file to save space) ########## Edit: @ccordoba12, I wanted to provide some context/clarity to the above. I believe the issue comes down to conda's availability of Tensorflow versions, which is different depending on the user's operating system. As of the timing of this comment, conda will download and install tensorflow 2.4.1 for Linux only... Windows users receive 2.3.0 and MacOS receive 2.0.0. See the following URL for reference: https://anaconda.org/anaconda/tensorflow (this'll likely change in the future) Tensorflow 2.4.1 for Windows does exist and can be installed using pip, but not conda. Also, I conda update --all'd today, which upgraded qtconsole to 5.0.3 on my base environment. That's great, because now we wont get that annoying warning when we boot up Spyder! |
I realize that the team is busy with the 5.0 release, which won't load due to an issue with No module named 'qdarkstyle.colorsystem'. Consequently, I have found a solution to this existing thread for v4.x. After testing the install of Tensorflow with Conda (instead of pip), the kernel continues to hang/not restart when requested. The solution to this is to explicitly call exit() in console. This seems to work (i.e. restart the kernel) in Spyder when using Tensorflow/Keras. I hope this helps someone else. |
Problem still persists with Spyder 5.2.0. @loewenm Good advice! You can also close the console tab (clicking on X) instead of typing exit() in the console window. I got this message today after trying to restart:
|
Fixed by #19411 If the frontend receives an error while restarting, it will abort. But if the kernel sends an error while closing, then the frontend aborts, even though the new kernel is fine. |
import tensorflow
is one way to reproduce: clip. Further, 4.1.4 prints INFO-level messages (also shown), which didn't occur in 4.1.3, now needing manually settingos.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
to disable.It also doesn't always reproduce; still unsure how it works exactly.
The text was updated successfully, but these errors were encountered: