Working Through “Killed: 9” Message When Launching Python

Having just returned from paternity leave, it has been at least 8 months since I used Python on my OS Monterey M1 laptop. To my surprise, I could not use it. Any time I would type python, ipython, or try to launch an environment using conda, the command line returned a “Killed: 9” message. Everything else seems fine: I could launch R, browse my file system, copy and move stuff around, etc., so the problem seems localized to Python. Restarting my computer did not solve the issue, but since I am not the first person to experience this problem I thought resolving it would be easy. How wrong I was.

The internet suggests that the error message arises from consuming too much memory, but I do not think that is the case for me since I had not used Python in a while and anything memory intensive goes on my server. A couple of other people suggest reinstalling xcode, but Apple wants me to update from Monterey to do that. No. The switch to Monterey two years ago was painful enough and I do not have the patience to update my operating system and deal with the inevitable broken apps for a fix that may not work. I should not have to stay on Apple’s cutting edge for my computer to remain functional. The most common suggestion involved reinstalling pcre2 and gettext plus installing another program called UPX. I had and have no idea what they are, but since using UPX was the most common answer I found, I tried it. The problem with all of these UPX suggestions is they are poorly written: I am told to “decompress the binary with upx -d /path/to/App.app/MacOS/App”, which is clear if you an expert system administrator and useless otherwise. Am I decompressing the upx binary? The binary for pcre2 or gettext, or the binary for Python (doesn’t make sense)? And which app are we talking about, the one that prompted the Stackoverflow question? If that’s the case, the answer is not applicable for me since I have not tried to install a program, I simply want to use a program I have used for years.

Noticing that I would also receive the kill message with conda, I chose to uninstall my Anaconda distribution. However, the way you are told to do it requires using conda, which I cannot do. Instead, I removed the anaconda directory in my home folder. I then reinstalled Anaconda using the command line without a problem. Now, typing python or ipython into the command line gives me this error message: /Users/Zack/anaconda/bin/python: No such file or directory. Instead, launching Python requires the following line: anaconda3/python.app/Contents/MacOS/python. ipython, which I prefer, is available at anaconda3/bin/ipython. Either launches Python 3.10.9, and the packages downloaded as part of the Anaconda distribution are there.

This solution is good enough for now. I should use a symlink so that I can launch the Anaconda Python with just the command Python and I need to remake my virtual environments. However, I have spent 90′ getting to this point and have to move on to other work. Computers are frustrating.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.