-2

After successfully running

echo 'export PATH="$PATH : /c/users /pc/anaconda 3:/c/users/pc/anaconda 3/ Scripts"'>>  .bashrc
echo 'alias python="winpty python.exe"'>> .bashrc
source . bashrc

When I then tried to activate conda by running activate conda it says could not find conda environment or your shell is not configured properly.

How can I fix this?

Robert
  • 6,055
  • 26
  • 41
  • 54
  • 1
    You have spaces in the `PATH`, which would only be correct if your paths actually have them. – Robert Jun 02 '22 at 18:36
  • Is the name of the environment 'conda'? – S3DEV Jun 02 '22 at 18:37
  • Given gitbash emulates a Linux environment, I believe the command will be `. activate [envname]` (without the brackets, of course). – S3DEV Jun 02 '22 at 18:47
  • Thanks for noticing ! But there was no spaces in the path originally..here its just a mistake ..by mistake I added a space between users and forward slash in the first line ! – Tulika Karmokar Jun 02 '22 at 19:35
  • My conda environment or directory is /c/users/pc/anaconda – Tulika Karmokar Jun 02 '22 at 19:40
  • I tried activate /c/users/pc/anaconda also it doesn't work... – Tulika Karmokar Jun 02 '22 at 19:42
  • It appears that you might not have an environment to activate. What are the contents to the `c:/users/pc/anaconda/envs` directory? Have you run the `conda create …` command? – S3DEV Jun 02 '22 at 19:53
  • pc@DESKTOP-4P5G9SJ MINGW64 ~ $ c:/users/pc/anaconda3/envs bash: c:/users/pc/anaconda3/envs: Is a directory – Tulika Karmokar Jun 03 '22 at 06:12
  • 1
    no i didn't used conda create commmand ? how to use it ? is it necessary because i already added conda to bashrc file – Tulika Karmokar Jun 03 '22 at 06:15
  • The `activate` program is used to *activate a virtual environment*. If you haven’t created any environments, then there are obviously none to be activated. [Docs linked here](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands). I’d recommend *understanding* environments and their use before proceeding. – S3DEV Jun 03 '22 at 10:03
  • pc@DESKTOP-4P5G9SJ MINGW64 ~ $ conda --version conda 4.12.0 pc@DESKTOP-4P5G9SJ MINGW64 ~ $ python --version Python 3.9.12 pc@DESKTOP-4P5G9SJ MINGW64 ~ $ conda env list # conda environments: # base * C:\Users\pc\anaconda3 pc@DESKTOP-4P5G9SJ MINGW64 ~ $ activate base pc@DESKTOP-4P5G9SJ MINGW64 ~ $ python Python 3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)] :: Anaco nda, Inc. on win32 Warning: This Python interpreter is in a conda environment, but the environment has not been activated. Libraries may fail to load. – Tulika Karmokar Jun 03 '22 at 15:09
  • i did activated my conda env but still it says that conda is not activated – Tulika Karmokar Jun 03 '22 at 15:11
  • when i activated conda using anaconda prompt there it is working – Tulika Karmokar Jun 03 '22 at 15:19
  • hey thanks ! problem is solved ! i gave command – Tulika Karmokar Jun 03 '22 at 15:29
  • conda init bash – Tulika Karmokar Jun 03 '22 at 15:29
  • and then i closed the shell and again opened it ..and it worked – Tulika Karmokar Jun 03 '22 at 15:30

0 Answers0