# Conda command in the jupyterlab console

**URL:** <https://discourse.jupyter.org/t/conda-command-in-the-jupyterlab-console/8617>\
**Category:** JupyterHub\
**Created:** [April 2, 2021, 9:55am UTC](https://discourse.jupyter.org/t/conda-command-in-the-jupyterlab-console/8617 "2021-04-02T09:55:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarineChap](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/marinechap/32/3519_2.png) [@MarineChap](https://discourse.jupyter.org/u/MarineChap)\
**Post date:** [April 2, 2021, 9:55am UTC](https://discourse.jupyter.org/t/conda-command-in-the-jupyterlab-console/8617/1 "2021-04-02T09:55:26Z")

</div>

Good morning everyone,

When using conda activate myenv in the jupyterlab console (spawn through k8s jupyterhub), I have this error :

```auto
    CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
    To initialize your shell, run

        $ conda init <SHELL_NAME>

    Currently supported shells are:
      - bash
      - fish
      - tcsh
      - xonsh
      - zsh
      - powershell

    See 'conda init --help' for more information and options.

    IMPORTANT: You may need to close and restart your shell after running 'conda init'.

```

I tried to add this line in my config.yaml as advised in diverse others places.

```auto
hub:
  extraConfig:
    001_config: |
      c.NotebookApp.terminado_settings = { 'shell_command': ['bash'] }

```

But that makes no difference in the console.  
Could you advised me on how to fix this problem please ?

**More info after debugging:**  
It seems that .bashrc is not sourced. when doing `source .bashrc` in my console it works. How I can configurate it to be sourced automatically ?

Thanks

---

<div class="post-metadata">

**Author:** ![MarineChap](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/marinechap/32/3519_2.png) [@MarineChap](https://discourse.jupyter.org/u/MarineChap)\
**Post date:** [April 2, 2021, 11:21am UTC](https://discourse.jupyter.org/t/conda-command-in-the-jupyterlab-console/8617/2 "2021-04-02T11:21:19Z")

</div>

Fixed by adding in my custom docker image :  
`echo source $HOME/.bashrc >> /etc/profile`

However, it is more feel like a workaround instead of an actual fix. If someone has a better solution, I am still interested.  
Thanks

---

<div class="post-metadata">

**Author:** ![minrk](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/minrk/32/13_2.png) [@minrk](https://discourse.jupyter.org/u/minrk)\
**Post date:** [April 2, 2021, 6:57pm UTC](https://discourse.jupyter.org/t/conda-command-in-the-jupyterlab-console/8617/3 "2021-04-02T18:57:48Z")

</div>

If you are already in a login shell environment and it’s not getting sourced, you might want to add `source ~/.bashrc` to `~/.bash_profile`. I still get confused about which one is run when.

To get a proper shell environment, I think it’s a good idea to launch a ‘login shell’, which does things like source bashrc, profiles, etc.

For me, I often set the ENTRYPOINT to ensure this happens for Jupyter user images:

```bash
#!/bin/bash -l
# the -l means login shell, which sources profiles, etc.
# extra env setup could go here
# this bit means launch whatever command I was given
# which probably starts `jupyterhub-singleuser` or something
exec "$@"

```

---

<div class="post-metadata">

**Author:** ![MarineChap](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/marinechap/32/3519_2.png) [@MarineChap](https://discourse.jupyter.org/u/MarineChap)\
**Post date:** [April 6, 2021, 7:32am UTC](https://discourse.jupyter.org/t/conda-command-in-the-jupyterlab-console/8617/4 "2021-04-06T07:32:55Z")

</div>

Thanks for the tip, i will test it.
