sudospawner icon indicating copy to clipboard operation
sudospawner copied to clipboard

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

Open potoo0 opened this issue 4 years ago • 1 comments

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

  • OS: centos7
  • Version(s):
jupyter core     : 4.7.1
jupyter-notebook : 6.2.0
qtconsole        : not installed
ipython          : 7.24.1
ipykernel        : 5.5.5
jupyter client   : 6.1.11
jupyter lab      : 3.0.16
nbconvert        : 6.0.7
ipywidgets       : 7.6.3
nbformat         : 5.0.8
traitlets        : 5.0.5

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?

potoo0 avatar Jun 24 '21 05:06 potoo0

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:

welcome[bot] avatar Jun 24 '21 05:06 welcome[bot]