Dustin K MacDonald

Menu
  • Home
  • About
  • Economic and Community Development
  • Nonprofit Management
    • Counselling and Service Delivery
    • Suicide Prevention / Crisis Intervention
  • Politics and Governance
  • Math and Statistics
  • Salesforce
Menu

When a New Package Kills Your Python Kernel: A Guide

Posted on August 11, 2021August 11, 2021 by Dustin

Introduction

We’ve all been there. You go to accomplish what seems like a small change, tweak or update to a computer program and everything goes bananas. In my case, I was downloading the package handson-ml2, the companion to the excellent machine learning textbook.

The terminal code was supposed to have me create a virtual environment and then activate the package inside that environment but clearly I did not follow those instructions correctly.

Whatever the case, I was left with a Jupyter Notebook that could not start a Python kernel. Yikes! After about 90 minutes I was back, so here are some directions if you find yourself in this situation.

Short Version

  • At the Anaconda Prompt, type “where python” (without quotes) to find your Python.exe file
  • Type “jupyter kernelspec list” (no quotes) to find your list of kernels
  • Find the one that starts with Python 3 and navigate to that path, it likely looks like this: python3 C:\Users\Dustin\AppData\Roaming\jupyter\kernels\python3
  • Open up the kernel.json file in a text editor and fix the path so that it looks like the one from where python above – make sure you use \\ instead of \ ones (so C:\Dustin would actually be C:\\Dustin)
  • Reopen your Anaconda Prompt as Administrator and run conda update conda and conda update jupyter-notebook (saying yes to update each time)
  • Open Jupyter Notebook and navigate to the Environment tab
  • Click Update Index

And you’re done!

Long Version (with extra steps)

This long version is the actual set of steps I took. The short version removed a couple of steps that I feel were troubleshooting only and didn’t help. It also adds a lot more detail as to what each of the commands do.


1. Open Anaconda Prompt

2. Type “where python” (no quotes) That will tell you where your Python.exe is, it should be in C:\Users\YourName\anaconda3\python.exe, something like that.

where Python command

Note that the AppData/Local version of Python is NOT the one I want. That’s a temporary one. The one I really want is the one in the Anaconda file.

3. Type “jupyter kernelspec list” (again no quotes)

jupyter kernelspec command

In my case, I have only one kernel on my system. If you had multiple kernels, they would be listed here. Find the one that isn’t broken. (If you’re not sure, you likely only have the one like me.)

4. Go to the file path indicated, and open up kernel.json in a text editor

Path to my kernel.json config file

5. Make sure the path listed for argv is the same one that where python told you. Use double back slashes.

kernel.json file

Then save. In my case, the package installation and environment creation I had attempted to do previously changed my environment so Jupyter Notebook couldn’t find the kernel at all. That’s what it was failing.

6. After updating the path, I uninstalled Anaconda, then I deleted the 3GB of junk it left in the anaconda3 folders there (what did the uninstaller do if not delete that?) I don’t think steps 6 or 7 are really necessary but I was troubleshooting.

7. Then I reinstalled Anaconda Navigator.

8. After reinstalling Anaconda, I re-opened Anaconda Prompt but this time as admin. I ran conda update conda and conda update anaconda-navigator (saying yes to update each time)

9. After updating conda and Anaconda Navigator, I reopened Anaconda Navigator, clicked the Environment tab, clicked Update Index.

Update Index

Now when I reopen Anaconda Navigator it detects that I have Jupyter Notebook installed. When I reopen Jupyter, the kernel doesn’t die. Hope this helps if your kernel dies from a botched package in the future

Hope this helps!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Privacy Policy

See here for our privacy policy. This site uses affiliate links and Adsense ads to provide targeted advertising.

Tags

analytical technique assessment communication community development counselling crisis chat crisis intervention data science eastern university economic development education empathy evaluation forecasting fundraising governance information technology intelligence intelligence analysis keokuk county language learning legal management peer support personal development phd politics professional development protective factors psychosocial risk factors safety planning salesforce sigourney social media statistics suicide suicide assessment suicide risk assessment technology terrorism training university of the cumberlands violence risk assessment youth

Recommended Posts

  • Conducting Psychosocial Assessments
  • DCIB Model of Suicide Risk Assessment
  • ABC Model of Crisis Intervention
  • My Friend is Suicidal - What do I do?

Recent Posts

  • ITS833 Information Governance
  • Enhanced Care Management (ECM) with Salesforce
  • ITS835 Enterprise Risk Management
  • Glorifind Christian Search Engine
  • Sigourney Iowa Election Results, 2023

Archives

  • November 2023 (6)
  • October 2023 (1)
  • September 2023 (3)
  • August 2023 (1)
  • July 2023 (1)
  • May 2023 (1)
  • March 2023 (1)
  • February 2023 (2)
  • January 2023 (4)
  • December 2022 (2)
  • May 2022 (1)
  • April 2022 (2)
  • March 2022 (1)
  • February 2022 (1)
  • December 2021 (1)
  • October 2021 (1)
  • August 2021 (2)
  • May 2021 (3)
  • December 2020 (1)
  • November 2020 (4)
  • July 2020 (1)
  • June 2020 (1)
  • April 2020 (1)
  • March 2020 (4)
  • February 2020 (7)
  • January 2020 (1)
  • November 2019 (1)
  • October 2019 (2)
  • September 2019 (4)
  • August 2019 (2)
  • March 2019 (1)
  • February 2019 (1)
  • January 2019 (1)
  • December 2018 (4)
  • November 2018 (3)
  • October 2018 (3)
  • September 2018 (19)
  • October 2017 (2)
  • September 2017 (2)
  • August 2017 (1)
  • July 2017 (39)
  • May 2017 (3)
  • April 2017 (4)
  • March 2017 (4)
  • February 2017 (4)
  • January 2017 (5)
  • December 2016 (4)
  • November 2016 (4)
  • October 2016 (5)
  • September 2016 (4)
  • August 2016 (5)
  • July 2016 (5)
  • June 2016 (5)
  • May 2016 (3)
  • April 2016 (2)
  • March 2016 (2)
  • February 2016 (2)
  • January 2016 (4)
  • December 2015 (2)
  • November 2015 (2)
  • October 2015 (2)
  • September 2015 (2)
  • August 2015 (1)
  • June 2015 (2)
  • May 2015 (5)
  • April 2015 (3)
  • March 2015 (8)
  • February 2015 (12)
  • January 2015 (28)

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Recent Comments

  • Dustin on Starting a Crisis Line or Hotline
  • HAPPINESSHEALTHCOURAGE, LLC on Starting a Crisis Line or Hotline
  • ITS833 Information Governance - Dustin K MacDonald on University of the Cumberlands PhD in Information Technology
  • Elected Officials in Sigourney, Iowa - Dustin K MacDonald on Sigourney Iowa Election Results, 2023
  • ITS 835 Enterprise Risk Management - Dustin K MacDonald on University of the Cumberlands PhD in Information Technology

Tags

analytical technique assessment communication community development counselling crisis chat crisis intervention data science eastern university economic development education empathy evaluation forecasting fundraising governance information technology intelligence intelligence analysis keokuk county language learning legal management peer support personal development phd politics professional development protective factors psychosocial risk factors safety planning salesforce sigourney social media statistics suicide suicide assessment suicide risk assessment technology terrorism training university of the cumberlands violence risk assessment youth
© 2023 Dustin K MacDonald | Powered by Minimalist Blog WordPress Theme