# Notebook Issue - Attempted Relative Import With No Known Parent Package

**URL:** <https://discourse.jupyter.org/t/notebook-issue-attempted-relative-import-with-no-known-parent-package/12594>\
**Category:** Notebook\
**Created:** [January 15, 2022, 3:34pm UTC](https://discourse.jupyter.org/t/notebook-issue-attempted-relative-import-with-no-known-parent-package/12594 "2022-01-15T15:34:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ewright](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@ewright](https://discourse.jupyter.org/u/ewright)\
**Post date:** [January 15, 2022, 3:34pm UTC](https://discourse.jupyter.org/t/notebook-issue-attempted-relative-import-with-no-known-parent-package/12594/1 "2022-01-15T15:34:41Z")

</div>

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.

 ![jupyter not working](https://canada1.discourse-cdn.com/flex031/uploads/jupyter/original/2X/a/ae089b884fb1fdb7fc54f7fc383330935ed0ae13.jpeg)

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [January 15, 2022, 6:23pm UTC](https://discourse.jupyter.org/t/notebook-issue-attempted-relative-import-with-no-known-parent-package/12594/2 "2022-01-15T18:23:34Z")

</div>

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](https://docs.anaconda.com/anaconda/install/verify-install/).

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](https://setapp.com/how-to/uninstall-anaconda-on-mac) and re-installing following [the most current instructions from Anaconda](https://docs.anaconda.com/anaconda/install/mac-os/). 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](https://docs.anaconda.com/anaconda/install/mac-os/#using-the-command-line-install):

> “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.”

---

<div class="post-metadata">

**Author:** ![ewright](https://avatars.discourse-cdn.com/v4/letter/e/58f4c7/32.png) [@ewright](https://discourse.jupyter.org/u/ewright)\
**Post date:** [January 15, 2022, 8:11pm UTC](https://discourse.jupyter.org/t/notebook-issue-attempted-relative-import-with-no-known-parent-package/12594/3 "2022-01-15T20:11:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bollwyvl](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/bollwyvl/32/904_2.png) [@bollwyvl](https://discourse.jupyter.org/u/bollwyvl)\
**Post date:** [September 13, 2023, 12:37pm UTC](https://discourse.jupyter.org/t/notebook-issue-attempted-relative-import-with-no-known-parent-package/12594/5 "2023-09-13T12:37:54Z")

</div>

Also not that the stock Anaconda Distribution and `miniconda` both use `anaconda.com` as their default package source: depending upon whose behalf you are working, this may be a violation of the terms of service. Additionally, those packages (and `anaconda.org/anaconda`) usually lag behind the upstreams by up to a quarter.

The upstream in question, in this case, is [`conda-forge`](http://conda-forge.org/), which is distributed from `anaconda.org/conda-forge`. Most of the jupyter-related packages are maintained by the same folk that write the software, and actively try to keep even historical versions working correctly.

You can use a non-encumbered `base` environment from [GitHub - conda-forge/miniforge: A conda-forge distribution.](https://github.com/conda-forge/miniforge) ([pretty download page](https://conda-forge.org/miniforge/)), including `Mambaforge`, which provides the speedier, more robust, and generally more helpful-when-failing `mamba` CLI, a drop-in replacement for `conda`. Keeping this environment small, and up-to-date, helps ensure your interactive computing doesn’t break your interactive package management.

Finally: however you install your `base` environment, it is recommended to build up your jupyter environment(s) _outside_ of that `base`, ideally starting with an `environment.yml` that provides at least _some_ sanity pins, a la:

```yaml
name:
  - my-jupyter-env
channels:
  - conda-forge
dependencies:
  - python >=3.10,<3.11
  - jupyterlab >=4.0.5,<5
  - notebook >=7,<8
  # etc...

```

And then:

```bash
mamba env update --file environment.yml --name my-jupyter-env

```

While the two arguments are _optional_, it’s a good habit to be explicit.
