Score:1

how do i write a script to activate a conda virtual enviornment?

au flag
j0h

I have a conda virtual environment where I run code for voice processing. I want to write a script so that I can open a shell in this virtual environment to listen for commands. I can launch the virtual environment from a shell using conda activate chatting but when I try to make this into a script, I get this error:

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

    $ conda init <SHELL_NAME>

so I added conda init bash to my script:

#!/bin/bash
#conda init bash
#source activate chatting
#conda activate chatting
eval $(conda shell.bash hook)
source activate chatting
conda activate chatting
bash -i
#conda activate chatting

But it still gives me the same error. How can I make a script the activate my conda virtual environment?

I do see some similar questions here, but none of the recommended solutions solve the problem.

conda activate not working in a bash file

Activating conda environment in "startup applications" script

Raffa avatar
jp flag
Related: [How to launch gnome-terminal and activate a python virtual environment?](https://askubuntu.com/q/1477525) and [Using /usr/bin/env python3 to point to virtual environment in 22.04](https://askubuntu.com/q/1459024)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.