Help installing/running JupyterLab in a conda environment

Hi, I’m very unskilled with virtual environments, and I have been trying to use conda, from a mini-conda installation, for that. I know I might break things up because sometimes I need to pip install things on this environment and I know this can break the conda tracking of libraries, this could be one these instances.

I have tried uninstalling and re-installing with conda install jupyter and conda install jupyterlab. I get this error when trying to launch jupyter lab:

(blimp) [villares@L340 ~]$ jupyter lab
Traceback (most recent call last):
  File "/home/villares/miniconda3/envs/blimp/bin/jupyter-lab", line 6, in <module>
    from jupyterlab.labapp import main
  File "/home/villares/miniconda3/envs/blimp/lib/python3.7/site-packages/jupyterlab/labapp.py", line 14, in <module>
    from jupyterlab_server import slugify, WORKSPACE_EXTENSION
  File "/home/villares/miniconda3/envs/blimp/lib/python3.7/site-packages/jupyterlab_server/__init__.py", line 4, in <module>
    from .app import LabServerApp
  File "/home/villares/miniconda3/envs/blimp/lib/python3.7/site-packages/jupyterlab_server/app.py", line 9, in <module>
    from .server import ServerApp
  File "/home/villares/miniconda3/envs/blimp/lib/python3.7/site-packages/jupyterlab_server/server.py", line 20, in <module>
    from notebook.notebookapp import aliases, flags, NotebookApp as ServerApp
  File "/home/villares/miniconda3/envs/blimp/lib/python3.7/site-packages/notebook/notebookapp.py", line 83, in <module>
    from .services.contents.manager import ContentsManager
  File "/home/villares/miniconda3/envs/blimp/lib/python3.7/site-packages/notebook/services/contents/manager.py", line 17, in <module>
    from nbformat import sign, validate as validate_nb, ValidationError
  File "/home/villares/miniconda3/envs/blimp/lib/python3.7/site-packages/nbformat/__init__.py", line 32, in <module>
    from .validator import validate, ValidationError
  File "/home/villares/miniconda3/envs/blimp/lib/python3.7/site-packages/nbformat/validator.py", line 12, in <module>
    from .json_compat import get_current_validator, ValidationError
  File "/home/villares/miniconda3/envs/blimp/lib/python3.7/site-packages/nbformat/json_compat.py", line 10, in <module>
    import jsonschema
  File "/home/villares/miniconda3/envs/blimp/lib/python3.7/site-packages/jsonschema/__init__.py", line 34, in <module>
    __version__ = metadata.version("jsonschema")
AttributeError: module 'importlib_metadata' has no attribute 'version'

Please advise…

If you think you’ve messed up your environment by pip installing something the easiest solution is probably to create a new conda environment, install JupyterLab and any other packages using conda, check everything works, and finally pip install the packages that aren’t available through conda.

2 Likes

Thanks, @manics!

I’m not sure how I broke my main env, but creating a fresh one got me running jupyter lab without doing anything else! Now I just have to watch out and see if I can avoid (or at least understand) the things that broke it.

1 Like