Unable to Get Panel Working with Jupyter notebook

Are you using conda or pip?

I am using Conda

I got that error when I first started using Panel because I had accidentally installed Panel in a different environment than the one from which I had launched Jupyter. Didn’t realize it until I manually launched Jupyter from within the environment. Maybe that’s not your error, but that’s what happened to me.

Easy check is to run
conda search panel
from your preferred environment and if it does show up then launch Jupyter from the same conda prompt.

1 Like

… or mamba if you prefer…

Here is the output

I do not know what to do next?

Try running conda list panel, and see if you have installed panel in the environment you are running jupyter notebook in.

1 Like

Thanks for the suggestion

What do I do next to solve the issue?

Try to start jupyter, if panel still cannot be imported, run these commands in notebook cells:

  1. !conda list panel
  2. !conda info
  3. !ls
1 Like

What do I do next?

Run the other commands I suggested.

The !ls command is to see if you have a file named panel.py in your folder, which you shouldn’t have.

!ls is a Unix Command won’t work on Windows Machine. I did !dir it did not work either.

Did you run !conda list panel from within Jupyter?

Yes I did my friend from command prompt. If I run it from Jupyter I get

try these commands to update conda enviroment

conda update -n base conda
conda update --all

You’re on a pretty recent version of conda already which is good. In a notebook could you run?

import sys
print(sys.executable)

This is to check the path to the Python executable that is used in the Notebook.

Out of curiosity, how did you install conda? Did you install get it via the Anaconda Distribution or via some other ways?

Thanks for your suggestions, unfortunately it did not work

image

I got Conda via Anaconda Distribution, i.e. I installed Python first, then Anaconda months later

Thanks!

So the path to the Python executable isn’t the path to your base conda environment, that’s the issue. How do you launch JupyterLab?

Now as you have conda you could also just decide to create a virtual environment with Panel and the other libraries you need for what you’re doing. Environments are cheap! Just run conda create -n chooseanenvname Python=3.9 panel pandas jupyterlab (pick the Python version that you want, and add the packages that you need), then activative it and you should be good.