Package: jupyterlab-genv
GPU Environment Management for JupyterLabA JupyterLab extension for managing GPU environments usinggenv.Thegenvextension lets you interactively control, configure and monitor the GPU resources that your Jupyter Notebooks are using.🏃🏻 Be an early runner in the genv community!Join our Slack channel with the creators ofgenvand start building your models faster!Installation and setup support as well as best practice tips and tricks directly for your use-caseDiscuss possible featuresMonthly coffee breaks to get to know the rest of the communityLooking forward to seeing you as a part of the community!Table of ContentsGetting StartedInstallationCondaPipInstallgenvKernelsUsageActivate Your EnvironmentAttach GPUs to Your EnvironmentSee Devices and EnvironmentsDevelopmentPublishPyPICondaGetting StartedRead thegenvreferenceto get started.InstallationRequirementsJupyterLab >= 3.0CondaIf you are usingConda, it is best to install thejupyterlab_genvpackagefrom the channelconda-forge:condainstall-cconda-forgejupyterlab_genvPipAlternatively, you can installjupyterlab_genvfromPyPIusingpip:pipinstalljupyterlab_genvInstallgenvKernelsAfter installingjupyterlab_genv, you will need to installgenvJupyter kernels using:python-mjupyterlab_genvinstallUsageActivate Your EnvironmentTo activate your environment, you will have to select agenvkernel.Then, click theGPUsbutton on the Jupyter Notebook toolbar.
A dialog should pop up where you can choose either to create a new environment for your Jupyter Notebook, or to use an existing one.Then, you can open a terminal activated in your environment.
From there you will be able to configure the environment and attach devices.Attach GPUs to Your EnvironmentConfiguring the environment and attaching devices is done from thegenvterminal.Make sure to restart your kernel after running the command in the terminal for it to take effect.See Devices and EnvironmentsYou can open the devices and environments widgets to see information.Open the command palette (Command/Ctrl Shift C) and typeGPUs.DevelopmentSetupYou will need to create a virtual environment once using the command:condacreate-njupyterlab_genv--override-channels--strict-channel-priority-cconda-forge-cnodefaultsjupyterlab=3cookiecutternodejsjupyter-packaginggitThen, activate the virtual environment when you want to work on the project:condaactivatejupyterlab_genvInstallUse the following commands to install the Python package and enable it in JupyterLab:# Install package in development modepipinstall-e.# Link your development version of the extension with JupyterLabjupyterlabextensiondevelop.--overwrite# Server extension must be manually installed in develop modejupyterserverextensionenablejupyterlab_genvIf you make any changes you will need to rebuild the extension Typescript source using:jlpm buildAlternatively, you can watch the source directory using:jlpm watchWith thejlpm watchcommand running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).RunRun JupyterLab using the command:jupyterlabRunningSHELL=bash jupyter lab --no-browseris even betterUninstall# Server extension must be manually disabled in develop modejupyterserverextensiondisablejupyterlab_genv
pipuninstalljupyterlab_genvIn development mode, you will also need to remove the symlink created byjupyter labextension developcommand.
To find its location, you can runjupyter labextension listto figure out where thelabextensionsfolder is located.
Then you can remove the symlink namedjupyterlab_genvwithin that folder.ReferenceList all kernel provisionersjupyterkernelspecprovisionersInstall a kernel provisionerTo add a kernel provisioner to a kernel spec, edit itskernel.jsonfile.
For example, to install a kernel provisioner for thepython3kernel spec, run:vim$CONDA_PREFIX/share/jupyter/kernels/python3/kernel.jsonAnd add:"metadata": {
  "kernel_provisioner": {
    "provisioner_name": "genv-provisioner"
  }
}List all available kernel specsls-la$CONDA_PREFIX/share/jupyter/kernels/List all running kernelsls-la$(jupyter--runtime-dir)/kernel-*.jsonList Jupyter server extensionsjupyterserverextensionlistList JupyterLab extensionsjupyterlabextensionlistPublishThejupyterlab_genvpackage is manually published to bothPyPIandconda-forge.We do not publish the frontend part as an npm package because the Python package is a prebuilt server extension, and the frontend part alone is useless.Also make sure to update thechangelog(here'show) and lint the project by runningnpm run lint.Bump VersionThecookiecutter templateusestbumpfor bumping the version.
However, for some reason this does not work at the moment, and we bump the version manually.Search for the current version in the project files and replace the relevant instances.
Here is a list of files that you should update:package.jsonpackage-lock.jsonpyproject.toml(alsoherefor futuretbumpsupport)jupyterlab_genv/_version.pyAfter pushing these changes, create a release onGitHub.PyPIPrerequisitespipinstallbuildtwinetbumpCreate a Python PackageCreate a Python source package (.tar.gz) and the binary package (.whl) in thedist/directory using:python-mbuildpython setup.py sdist bdist_wheelis deprecated and will not work for this package.Then, upload the package toPyPIusing:twineuploaddist/*We upload to PyPI with the organizational userrunaiCondaThe Conda package is managed using itsfeedstock.After publishing toPyPI, update theversionandsha256fields in the recipemeta.yamlfile.A few minutes after pushing these changes, you should be able to see that the Condapackageversion was updated.You can get the SHA256 hash fromPyPI