1

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?

Mateusz
  • 17
  • 5
  • Note that Jupyter shouldn't need to be installed in more than one environment. A single dedicated Jupyter environment (with all your extensions) plus `nb_conda_kernels` can load any other environment as a kernel. – merv Jan 16 '22 at 20:13

1 Answers1

4

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

krassowski
  • 13,598
  • 4
  • 60
  • 92
  • I wasn't aware I could just add a package to conda, although it does make sense now that I think about it. I have found the documentation on conda-forge about contributing recipes, but is there anything I should look out for? Or are there any differences when contributing a jupyterlab extension as opposed to contributing a library-type package? – Mateusz Jan 10 '22 at 13:41
  • Nothing special; there is a good practice of running a [`pip check`, `server extension` and `labextension list` checks](https://github.com/conda-forge/jupyterlab-git-feedstock/blob/9a303d40256d0cb79bf4c1a119625c24e6bb0e40/recipe/meta.yaml#L38-L42). There are some helpful experienced folks in Jupyter who are either regular recipe contributors or even members of the conda-forge team, so please ask on https://gitter.im/jupyterlab/jupyterlab in case of issues. Also, before starting work it is a good idea to check with the maintainer if they agree that extension is ready for conda-forge. – krassowski Jan 10 '22 at 23:02
  • That's great, thank you so much for the advice! – Mateusz Jan 11 '22 at 17:35