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.
… or mamba if you prefer…
conda list panel, and see if you have installed panel in the environment you are running jupyter notebook in.
Try to start jupyter, if panel still cannot be imported, run these commands in notebook cells:
!conda list panel
Run the other commands I suggested.
!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?
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?
I got Conda via Anaconda Distribution, i.e. I installed Python first, then Anaconda months later
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.