Search code examples
anacondaidejupyterjupyter-labjupyter-extensions

How can I make anaconda automatically install jupyterlab extensions in every new environment I create?


I would like to have the exact same setup of jupyterlab in every new anaconda environment. Just like I can define some default packages to be installed when creating an environment with

conda config --add create_default_packages package1 package2

I would like to install a few jupyterlab extensions. I can install them by using the command

jupyter labextension install,

but this is a jupyterlab command and not a conda one. Is there a way of creating a script, that would execute only once after creating an environment, or some other mechanism that would let me automate this process?


Solution

  • With JupyterLab 3+.0+ you should not need to install extensions with jupyter labextension install; instead installation with pip install or conda install is now the recommended approach for most users (see documentation).

    Extensions installable with pip/conda* do not require Node.js and are therefore more robust and user-friendly; we call them "prebuilt extensions", in contrast to the old "source extensions". We are considering removing support for installing source extensions by end users in a future version of JupyterLab (but not for advanced users and system administrators who should still be able to access this mechanism) as source extensions proved to be causing more trouble than benefit for an average user, and users so far were happy with the transition.

    Please also see:

    If extension is not on conda-forge you can always contribute a recipe for it. If that's the case let me know and I can help you with the next steps.

    *) or any other package manager which is able to place a .js file in appropriate location - this is not limited to Python ecosystem