Notebook Issue - Attempted Relative Import With No Known Parent Package

Hello all,
I have been having trouble with my Jupyter notebook recently. First of all the Python3 kernel no longer shows up when I try to create a new file. On top of that, all my .ipynb files on Github are unable to be opened because it says Invalid Notebook – The Notebook Does Not Appear to Be Valid JSON. When I try to re-install a Python3 kernel on my terminal I get another error, “attempted relative import with no known parent package”. Something clearly has gone very wrong. I have attached photos. Thank you in advance to anyone who can help me get this back running again.

Do you know what changed around the times things stopped working? For example, did you upgrade your MacOS and then it stopped working?

Fortunately, it looks like you installed Anaconda. I’d stick with working in conda then.
In the image, you are working in the base conda environment.
Are you still able to activate other environments you made and run notebooks there?
Are you able to run conda list when in your environments like shown here.

If you run which python is it using the Python installed by Anaconda?

Not advising this yet, however, depending on how much you want to invest in sorting out issues on your system, you may want to start to consider this…
How many environments and things have you made? If not many, it may just be easier to start over by uninstalling Anaconda and re-installing following the most current instructions from Anaconda. It looks like you had Python 3.8 on there so and so the default stuff is already like 2 years old. Plus, depending on your MacOX you may be better off with a graphical installation now because I note it says here:

“Unlike the graphical install, installing the shell file will place it in ~/anaconda<2 or 3> by default, not ~/opt. This is due to limitations with installing .pkg files on macOS Catalina.”

Hi fomightez, Thank you very much for the reply. The bug started around the time I started using VSCode. I am going to try deleting Anaconda completely from my mac and reinstall. I have all my code saved in other places on my computer so it shouldn’t delete anything important.

1 Like