jupyterhub / sudospawner

Spawn JupyterHub single-user servers with sudo
BSD 3-Clause "New" or "Revised" License
50 stars 41 forks source link

How to switch/activate the conda env when the jupyterlab startup? #70

Open potoo0 opened 3 years ago

potoo0 commented 3 years ago

I want activate user's own conda env when jupyterlab start up. So I put conda activate ENVNAMEcommand to .bashrc, but not working.

let's say activate py38_user2 for user2:

user2's bashrc

conda activate py38_user2

personal set up

conda env list:

# conda environments:
#
py38_user2                *  /home/user2/.conda/envs/py38_user2
base                               /u01/miniconda3

jupyterhub_config.py

c.Spawner.notebook_dir = '~/notebooks'
c.Spawner.default_url = '/lab'

c.LocalProcessSpawner.shell_cmd = ["bash", "-l", "-c"]
c.Spawner.args = ["--KernelSpecManager.ensure_native_kernel=False"]
c.JupyterHub.spawner_class = 'sudospawner.SudoSpawner'

c.PAMAuthenticator.open_sessions = False
c.LocalAuthenticator.create_system_users = True
c.PAMAuthenticator.add_user_cmd = ['adduser', '-m']

Is there any way to switch/activate the conda environment when the lab startup?

welcome[bot] commented 3 years ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada: