简体   繁体   English

将环境模块加载到 Jupyter Notebook/Lab

[英]Load Environment Modules into Jupyter Notebook/Lab

I am running JupyterLab through a server (which is managed remotely, I am a user without sudo access).我正在通过服务器运行 JupyterLab(这是远程管理的,我是没有 sudo 访问权限的用户)。 I want to use CUDA but in order to do so I have to load it in as a module using module load bash command when in terminal.我想使用 CUDA 但为了这样做,我必须在终端中使用module load bash 命令将其作为模块加载。

The CUDA package is already installed, so I'm presuming that module load merely adds paths that point to where the package is. CUDA package 已经安装,所以我假设模块加载只是添加了指向 package 所在位置的路径。 I cannot use !module load cuda in Jupyter, so I cannot use CUDA at all.我不能在 Jupyter 中使用!module load cuda ,所以我根本不能使用 CUDA。 CUDA installation also requires sudo access. CUDA 安装也需要 sudo 访问权限。

I've tried using %env to add environment variables but beyond that I am really stuck.我试过使用%env添加环境变量,但除此之外我真的卡住了。

Is there a way I can use module load or properly point to where the package is, because the Python library I'm using unfortunately keeps throwing this error when trying to import it有没有办法可以使用module load或正确指向 package 所在的位置,因为不幸的是,我正在使用的 Python 库在尝试导入它时一直抛出此错误

libcudart.so.9.2: cannot open shared object file: No such file or directory

All help appreciated所有帮助表示赞赏

It seems module command is not recognized in the environment you try to use.在您尝试使用的环境中似乎无法识别module命令。 So first you need to define this shell function by sourcing module initialization script.所以首先你需要通过采购模块初始化脚本来定义这个 shell function 。 Such script can be found in /usr/share/Modules/init on Red Hat like systems.这样的脚本可以在类似 Red Hat 的系统上的/usr/share/Modules/init中找到。

After running:运行后:

source /usr/share/Modules/init/bash

You should get the module shell function defined, then doing a module avail will tell you if a cuda modulefile is available for load with module load cuda . You should get the module shell function defined, then doing a module avail will tell you if a cuda is available for load with module load cuda .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM