Package: nb-conda-store-kernels
nb_conda_store_kernelsThis extension enables a Jupyter Notebook or JupyterLab application to access environments stored in Conda-Store and run kernels for Python, R, and other languages. When a kernel from an external environment is selected, the environment is downloaded, extracted, conda environment is automatically activated, and finally the kernel is launched. This package was heavily inspired bynb_conda_kernels.Any notebook launched via anb_conda_store_kernelkernel will have
notebook metadata about the environment used. This provides a powerful
mechanism for running the notebook later in a reproducible way.{
    ...,
    "kernelspec": {
        ...,
        "name": "conda-store://<namespace>/<environment_name>:<build-id>",
        ...,
    },
    ...
}The package works by defining a custom KernelSpecManager that calls the Conda-Store REST API for available conda environments with required packages. It dynamically modifies each KernelSpec so that it can be properly run from the notebook environment. When you create a new notebook, these modified kernels will be made available in the selection list. Additionally withoutConda-PackUsageThis package does not needpiporcondato run properly but
currently only run on Linux. It should be installed in the environment
from which you run Jupyter Notebook or JupyterLab. It is recommended
for installnb_conda_store_kernslvia Conda due to activation hooks
which simplify the installation but there is no strong reason to use
conda.condainstall-cconda-forgenb_conda_store_kernelsAlternativelypipworks as well but requires one additional step.pipinstallnb_conda_store_kernels
python-mnb_conda_store_kernels.install--enable# python -m nb_conda_store_kernels.install --disable # to disablepython -m nb_conda_store_kernels.install --enablesimply modifies a
single jupyter setting. If that did not work (it should and is a bug
if not) you need to add the following setting tojupyter_config.py.mkdir~/.jupyterecho'c.JupyterApp.kernel_spec_manager_class = "nb_conda_store_kernels.manager.CondaStoreKernelSpecManager"'>~/.jupyter/jupyter_conifg.pyIn order tonb_conda_store_kernelsto connect properly to
Conda-Store it needs several environment variables set. Under the
coversconda-storethe client is being using and hasdetailed
documentationon configuration.export CONDA_STORE_URL=http(s)://...
export CONDA_STORE_AUTH=none|basic|token
# export CONDA_STORE_USERNAME=... # using basic auth 
# export CONDA_STORE_PASSWORD=... # using basic auth
# export CONDA_STORE_TOKEN=...    # using token authFinally launch JupyterLab!jupyterlabConnecting to existing conda-store serverVisit conda-store server you are using and get a token for your given
user via vising the/userendpoint after you login.dockerrun-p8888:8888-eCONDA_STORE_TOKEN=...quansight/nb-conda-store-kernels:v0.1.5Use with nbconvert, voila, papermill,...Sincenb_conda_store_kernelsuses theconda-storeclient under the
covers these use cases are supported by the client with proper
environment variables being set. There are plans to extend other tools
to use Conda-Store.conda-storerunnamespace/environment--python-c"print('Hello, Conda-Store!')"DevelopmentStart Conda-Store serverdocker-compose up --build
jupyter labLogin to Conda-Store atlocalhost:5000and
create a new environment.Copyright 2022 Quansight LLCRedistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.