1

As per advice here I have ensured that:

export PATH=~/anaconda/bin:$PATH

Is written into my .bash_profile file. However when using conda (i.e conda --version) the command is still not recognised:

-bash: conda: command not found

Why isn't conda working?

Anaconda installed itself into /anaconda rather than /anaconda3 as many resources tend to suggest.

Here's my .bash_profile in full:

# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc
if [ -f $(brew --prefix)/etc/bash_completion ]; then
    source $(brew --prefix)/etc/bash_completion
fi
  source '/Users/deepthought/Desktop/GoogleCloudSDK/google-cloud-sdk/path.bash.inc'
fi
  source '/Users/deepthought/Desktop/GoogleCloudSDK/google-cloud-sdk/completion.bash.inc'
fi

# added by Anaconda2 4.3.0 installer
export PATH="/Users/deepthought/anaconda2/bin:$PATH"

# added by Anaconda2 4.3.0 installer
export PATH="//anaconda/bin:$PATH"

# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/deepthought/n/google-cloud-sdk/path.bash.inc' ]; then source '/Users/deepthought/n/google-cloud-sdk/path.bash.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/deepthought/n/google-cloud-sdk/completion.bash.inc' ]; then source '/Users/deepthought/n/google-cloud-sdk/completion.bash.inc'; fi

# added by Anaconda3 4.3.1 installer
export PATH="/anaconda/bin:$PATH"

export PATH=~/anaconda/bin:$PATH

On advice from comments echo $PATH gives:

/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
Community
  • 1
  • 1
goose
  • 2,502
  • 6
  • 42
  • 69
  • 1
    I see a lot of things in your profile but not `export PATH=~/anaconda3/bin:$PATH`. There's `//anaconda/bin`, `/anaconda/bin` (which are the same) but not with homedir. – Jean-François Fabre May 05 '17 at 19:51
  • 1
    still no `~` in your profile file... That didn't change anything. – Jean-François Fabre May 05 '17 at 19:59
  • I've just added export PATH=~/anaconda/bin:$PATH to the end of the file, saved and restarted my terminal. The problem persists. Is that what you are suggesting I should do? As I'm sure you can tell editing the path is not something I'm overly familiar with. – goose May 05 '17 at 20:01
  • is your terminal running `bash` by default? can you [edit] your question to show your new `.bashrc` file? – Jean-François Fabre May 05 '17 at 20:02
  • Sure thing, I've edited the question to reflect .bash_profile, is that the equivalent of .bashrc? I don't believe I'm running bash by default, but not 100% sure. On googling it I was lead to check preferences and saw nothing set as a startup command. Is that where running bash by default would have been chosen? – goose May 05 '17 at 20:09
  • @Jean-FrançoisFabre I believe goose is using OSX, and the common terminal emulators on OSX run as login shells so you should use `.bash_profile` – juanpa.arrivillaga May 05 '17 at 20:09
  • best way would be to `echo $PATH` and see if your path is there before attempting to run the command. Also, add an `echo` in the bash resource file to see if it's executed on terminal startup. – Jean-François Fabre May 05 '17 at 20:10
  • Results from echo $PATH do look very different (see above). Is this likely the cause then, am I not editing the right file? – goose May 05 '17 at 20:14
  • type `echo $SHELL` in your prompt. Maybe your default shell isn't `bash` but `sh`. – Jean-François Fabre May 05 '17 at 20:30
  • That shows /bin/bash – goose May 05 '17 at 20:31
  • 2
    You should put the conda stuff in `.bashrc` rather than `.bash_profile`. The latter is sourced only for your login shells but not for terminals you open during a graphics session. See [this question](https://askubuntu.com/questions/121073/why-bash-profile-is-not-getting-sourced-when-opening-a-terminal). – a_guest May 05 '17 at 20:52
  • Brilliant! Putting export PATH="/anaconda/bin:$PATH" into .bashrc and restarting the terminal has solved it. Thanks all for the help. Other than just generally understanding more about UNIX systems, is there any particular topic anyone would recommend I read up on to help me help myself with this sort of thing? – goose May 05 '17 at 20:56
  • Just keep browsing related questions on stackoverflow and you'll come across a few things you can learn from ;) – a_guest May 05 '17 at 21:10

0 Answers0