1

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

j0h
  • 14,548
  • 28
  • 104
  • 178
  • 1
    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) – Raffa Jul 23 '23 at 17:39

0 Answers0