# Can not actiavte a conda environment in jupyter

**URL:** <https://discourse.jupyter.org/t/can-not-actiavte-a-conda-environment-in-jupyter/25051>\
**Category:** Notebook\
**Created:** [April 8, 2024, 8:16pm UTC](https://discourse.jupyter.org/t/can-not-actiavte-a-conda-environment-in-jupyter/25051 "2024-04-08T20:16:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EarlyBird](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@EarlyBird](https://discourse.jupyter.org/u/EarlyBird)\
**Post date:** [April 8, 2024, 8:16pm UTC](https://discourse.jupyter.org/t/can-not-actiavte-a-conda-environment-in-jupyter/25051/1 "2024-04-08T20:16:39Z")

</div>

Anaconda and pytorch where first installed. Then I a started jupyter notebook and a python3 notebook. The command “conda activate pytorch” gives an error message:  
[https://s9.gifyu.com/images/SVe2l.png](https://s9.gifyu.com/images/SVe2l.png)

How do I activate a conda environment?

Sven

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [April 8, 2024, 8:47pm UTC](https://discourse.jupyter.org/t/can-not-actiavte-a-conda-environment-in-jupyter/25051/2 "2024-04-08T20:47:56Z")

</div>

That isn’t where you want to be doing this. What are you using a guide to how to use Anaconda/conda? Did you work through the Anaconda-provided guide to using it?

[Here in the ‘Getting Started’, under ’ Starting conda’](https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#starting-conda) it tells you how to do start with all three systems:

- Windows: “Open either the Command Prompt (cmd.exe) or PowerShell.”
- MacOS: …a couple of steps… and then “Open the Terminal application.”
- Linux: “Open a terminal window.”

(My under standing from [here](https://stackoverflow.com/a/58245152/8508004) and [here](https://stackoverflow.com/a/58099552/8508004) is that you can use the Anaconda prompt, too. If you have that and/or are working on Windows.)

Then below that on that page is the ‘Creating environments’ initial getting-started’ step. Meaning you needed to do the steps above to get ready to do those.

Similarly, elsewhere in the documentation is [‘Managing environments’](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#managing-environments), where it says “Use the terminal for the following steps”.

* * *

With the environments then made, subsequently you can then choose them when you open Jupyter using the Anaconda-described routes for launching Jupyter. [Here’s the options for opening in Windows](https://clouds.eos.ubc.ca/~phil/docs/problem_solving/02-Jupyter-Notebooks/02.04-Opening-a-Jupyter-Notebook.html).

If you want to do more complex routes or troubleshoort, see [here](https://stackoverflow.com/a/58068850/8508004) or [here](https://stackoverflow.com/a/43197286/8508004).

* * *

You can use **some** `conda` commands in a Jupyter notebook with the help of the magic symbol, like `%conda install ...` or `%conda list`. However, you need an active terminal/console session to initialize and activate an environment because the active environment session is attached to that active console.  
This wouldn’t happen when you try it in Jupyter because console commands get run off in a temporary shell session that gets ended after it running. This there is nothing to bind your environment-use session, too.

---

<div class="post-metadata">

**Author:** ![EarlyBird](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@EarlyBird](https://discourse.jupyter.org/u/EarlyBird)\
**Post date:** [April 12, 2024, 7:16pm UTC](https://discourse.jupyter.org/t/can-not-actiavte-a-conda-environment-in-jupyter/25051/3 "2024-04-12T19:16:14Z")

</div>

Thank you very much for your time and effort to write this. I am still reading and fighting my way through the tutorials. Will try and follow it.

Do you mind writing more question to you here?  
I am working on a MAC 10.15

Best regards  
Sven

---

<div class="post-metadata">

**Author:** ![EarlyBird](https://avatars.discourse-cdn.com/v4/letter/e/3ab097/32.png) [@EarlyBird](https://discourse.jupyter.org/u/EarlyBird)\
**Post date:** [May 21, 2024, 7:11pm UTC](https://discourse.jupyter.org/t/can-not-actiavte-a-conda-environment-in-jupyter/25051/4 "2024-05-21T19:11:19Z")

</div>

Thank you fomightez,

This did fix the problem. Great.

Regards  
Sven
