Home:ALL Converter>Process finished with exit code 137 in PyCharm

Process finished with exit code 137 in PyCharm

Ask Time:2017-04-07T09:17:36         Author:shawe

Json Formatter

When I stop the script manually in PyCharm, process finished with exit code 137. But I didn't stop the script. Still got the exit code 137. What's the problem?

Python version is 3.6, process finished when running xgboost.train() method.

Author:shawe,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/43268156/process-finished-with-exit-code-137-in-pycharm
WolfiG :

From my experience (Python 3.9.13, MacOSX 12.4), the "SIGKILL" behavior can happen as well if the python code causes low memory. If you run the same code from the command line\n$>python your_module.py\n\nthe code will crash as well.\nI work with quite large Pandas DataFrames (millions of rows, some dozen columns). I have a MacMini with 8 GB RAM and observed that the SIGKILL appears if the memory consumed by Python (MacOS activity monitor) exceeds about 60 GB.",
2022-07-27T12:34:05
ykaner :

Exit code 137 means that your process was killed by (signal 9) SIGKILL . In the case you manually stopped it - there's your answer. \n\nIf you didn't manually stop the script and still got this error code, then the script was killed by your OS. In most of the cases, it is caused by excessive memory usage. ",
2018-06-18T13:19:13
AliAlavi :

This is an OOM (Out-Of-Memory):\nThe sigkill comes from the Kernel because it's out of free memory.\n\nbuy more RAM\nuse an iterative approach to process data in smaller chunks, which\nfits into RAM\nrun your program once without PyCharm (PyCharm requires 1 GiB of RAM\nor more)\nincrase swap, but you're warned, it's deadly slow\ncreated virtual memory\n",
2022-08-30T05:51:31
BrB :

{In my experience}\n\nthis is because of Memory issue. \nWhen I try to train ml model using sklearn fit with full data set , it abruptly breaks and gives whereas with small data it works fine.\n\nProcess finished with exit code 137 (interrupted by signal 9: SIGKILL)\nInterestingly this is not caught in Exception block either",
2020-01-13T17:56:58
ASJ :

If you are in Ubuntu, increase the SWAP memory. It will work. Use htop to see SWAP usage, when it is full, it will give error 137.",
2021-06-23T13:46:49
user11009049 :

It's not always a memory issue. In my case subprocess.Popen was utilized and it was throwing the error as 137 which looks like signalKILL and the cause is definitely not the memory utilization, because during the runtime it was hardly using 1% of memory use. This seems to be a permission issue after more investigation. I simply moved the scripts from /home/ubuntu to the root directory.",
2019-02-03T16:15:44
Camilo :

I had the same error. In my case was related to excessive memory usage. Solved after reseting/cleaning my cache data adding the following code for every variable that will not be used anymore : \n\nMyVariableName = None\n",
2019-02-01T16:03:43
Huaiyu Huang :

In my case, my RAM ran out, whether it is real or virtual.\nSplit your data into small pieces or expand your virtual memory.\nI choose the latter.\nFollowing scipts works on my ubuntu 20.04 TLS.\n# disable the use of swap\nsudo swapoff -a\n\n# create the SWAP file. Make sure you have enough space on the hard disk.\n# here is my size, the total size is bs*count B\nsudo dd if=/dev/zero of=/swapfile bs=1024 count=136314880 status=progress\n# output:\n# 139458259968 bytes (139 GB, 130 GiB) copied, 472 s, 295 MB/s\n# 136314880+0 records in\n# 136314880+0 records out\n# 139586437120 bytes (140 GB, 130 GiB) copied, 472.372 s, 296 MB/s\n\n# Mark the file as SWAP space:\nsudo mkswap /swapfile\n# output:\n# Setting up swapspace version 1, size = 130 GiB (139586433024 bytes)\n# no label, UUID=25a565d9-d19c-4913-87a5-f02750ab625d\n\n# enable the SWAP.\nsudo swapon /swapfile\n\n# check if SWAP is created\nsudo swapon --show\n# output:\n# NAME TYPE SIZE USED PRIO\n# /swapfile file 130G 0B -2\n\n# Once everything is set, you must set the SWAP file as permanent, else you will lose the SWAP after reboot. Run this command:\necho '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab\n\nAfter you run your process, memory will grow.\nHere is mine:\n\nGood Luck!\nreference 1,reference 2",
2021-02-22T09:49:10
codeasaurusRekt :

I've recently run into this error installing PyCharm on an M1 Mac Mini. It was accompanied by an error that said my SDK was invalid upon compilation of a project. It turns out this was due to my Python Interpreter being pointed at a strange directory, I'm not 100% how this happened.\nI went to Preferences > Project:yourProject > Python Interpreter and selected a valid SDK from the drop-down (in my case Python 3.8). You'll know the package is valid because it will populate the package list below with packages.\nAgain, not sure how it happened on install, but this solved it.",
2021-12-06T21:10:03
Alex Horvath :

My python process get killed with the 137 error code because my Docker for Windows memory limit was set too low.",
2020-04-17T13:32:21
rva :

\nIf anyone else were installing pycharm on mac and got the code 137 in PyCharm error while doing a simple print('test') command it most certainly is because of the path to interpreter being present in the new project created.\nThe error I believe is because of python being installed through brew and it not showing up in the "Python X.YZ /Library/Frameworks/Python.framework/Versions/X.YZ/bin/pythonX" path\nWork around uninstall installed python version using brew and then manually install it.\nNow it would appear under the interpreter path which is under "Preferences-> Project -> Python Interpreter -> Gear symbol -> add base interpreter" point this to under /Library/Frameworks/.... path\n",
2021-12-18T21:23:24
yy