Search code examples
pythonlinuxubuntuanacondaconda

conda activate fails (results in IndexError: list index out of range)


I have a fresh copy of Ubuntu 22.04 that I'm running in a Hyper-V virtual machine in Windows 11 Pro. I just installed Anaconda from anaconda.com. Everything seems fine (I've also added Conda to the path.)

I created a new environment using:

conda create --name proto202211

Environment is created successfully and conda tells me:

to activate this environment, use $ conda activate proto202211

So I do that, but I get a long ERROR REPORT and the environment fails to activate. I rebooted the Linux machine. Same thing. I created a new environment, myenv, and I can't switch to that either (same error). I can list the environments, and conda sees proto202211 and myenv. It recognizes that they're there. But if I try to activate them, I get this long failure.

I've attached images of the errors that I'm getting.

First part of the error message

Second part of the error message

Help.


Solution

  • I found the solution to this problem. After installing anaconda I manually edited my PATH using:

    echo "export PATH=$PATH:/home/nate/anaconda3/bin">> ~/.bashrc

    This was a bad idea. I removed that line from .bashrc using gedit, restarted bash, and now I can switch environments.

    I got the idea to try this from this similar (but non-identical) question: unable to activate existing conda environments