Jupyter Lab throws error after upgrade

I used conda update --all on my env today - everything ran fine but now the upgraded JupyterLab does not start. Can anyone help please?

This is the error I get on invoking jupyter lab:

Traceback (most recent call last):
  File "/Users/vishad.bhalodia/anaconda3/envs/mfe_env/bin/jupyter-lab", line 6, in <module>
    from jupyterlab.labapp import main
  File "/Users/vishad.bhalodia/anaconda3/envs/mfe_env/lib/python3.8/site-packages/jupyterlab/labapp.py", line 15, in <module>
    from jupyter_server.serverapp import flags
  File "/Users/vishad.bhalodia/anaconda3/envs/mfe_env/lib/python3.8/site-packages/jupyter_server/serverapp.py", line 83, in <module>
    from jupyter_server.services.sessions.sessionmanager import SessionManager
  File "/Users/vishad.bhalodia/anaconda3/envs/mfe_env/lib/python3.8/site-packages/jupyter_server/services/sessions/sessionmanager.py", line 22, in <module>
    from jupyter_server.traittypes import InstanceFromClasses
  File "/Users/vishad.bhalodia/anaconda3/envs/mfe_env/lib/python3.8/site-packages/jupyter_server/traittypes.py", line 7, in <module>
    from traitlets.utils.descriptions import describe
ModuleNotFoundError: No module named 'traitlets.utils.descriptions'

Conda Info:

active environment : mfe_env
    active env location : /Users/vishad.bhalodia/anaconda3/envs/mfe_env
            shell level : 1
       user config file : /Users/vishad.bhalodia/.condarc
 populated config files : /Users/vishad.bhalodia/.condarc
          conda version : 4.11.0
    conda-build version : 3.20.5
         python version : 3.8.5.final.0
       virtual packages : __osx=10.16=0
       base environment : /Users/vishad.bhalodia/anaconda3  (writable)
      conda av data dir : /Users/vishad.bhalodia/anaconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
          package cache : /Users/vishad.bhalodia/anaconda3/pkgs
       envs directories : /Users/vishad.bhalodia/anaconda3/envs
               platform : osx-64
             user-agent : conda/4.11.0 requests/2.22.0 CPython/3.8.5 Darwin/21.3.0 OSX/10.16
                UID:GID : 501:20
             netrc file : None
           offline mode : False

Output of conda list here


Just going off the error message, you might just need to…

conda install -c conda-forge -n mfe_env 'traitlets>=5'

…which should handle when that API landed. Your listing claims you have an up-to-date one, but… what conda thinks is installed, and what is actually there may well not be very accurate, anymore. With a large selection of conda channels, and non-trivial pip packages, it can be rather hard to tell what is going on.

Rather than fighting with upgrading your environment interactively, I can highly recommend capturing the “leaf” packages you want, and channels you want to get them from, in an enviornment.yml, and starting a new environment.

It would then look something like:

name: mfe_env_2
- conda-forge
- nodefaults
- python =3.8
# all the other packages
- pip
- pip:
  - the-pip-packages

You’ll also probably want to…

conda install -c conda-forge -n base mamba

…a drop-in replacement for conda, which excels at handling large environments like this… and provides much clearer answers when things go wrong.

So the end, you should be able to type:

mamba env update

…and get an internally-consistent env on disk.


Thank you for the detailed reply! - I definitely need to make a clean env. I rolled back my env to the previous snapshot for now - it seems traitlets 5.1.1 is the root cause (I already had 5.0.5 installed)

Edit: looks like traitlets latest version is working fine with jupyterlab 3.2.9 - so some other package in my env may be the cause.

For those that come along after: traitlets 5.1.1 definitely has_ that api and is not broken in any way.

Again, my point is with heavy mixing of interactive pip and conda (or apt or brew, for that matter), neither will be able to know what’s actually installed, eventually.