2

I have a problem with Anaconda3 in Google Cloud VM with Ubuntu. I installed Anaconda3 successfully, but I cannot call conda. Here is code from my terminal.

eko_rudiawan@google-ubuntu:~$ $PATH
-bash: /home/eko_rudiawan/bin:/home/eko_rudiawan/.local/bin:/opt/ros/kinetic/bin:/usr/local/sbin:/usr/local/bin:/us
r/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin: No such file or directory
eko_rudiawan@google-ubuntu:~$ which python
/usr/bin/python
eko_rudiawan@google-ubuntu:~$ export PATH="/home/eko_rudiawan/anaconda3/bin:$PATH"
eko_rudiawan@google-ubuntu:~$ which python
/home/eko_rudiawan/anaconda3/bin/python
eko_rudiawan@google-ubuntu:~$ conda --version
conda: command not found
eko_rudiawan@google-ubuntu:~$
merv
  • 67,214
  • 13
  • 180
  • 245
Eko Rudiawan
  • 187
  • 3
  • 9
  • Possible duplicate [How to run Conda](https://stackoverflow.com/a/55526573/570918). Note the newer recommendation is to use `conda init` instead of editing `PATH`. Also, is `conda` not an executable in your `anaconda3/bin/` folder? – merv Apr 05 '19 at 00:17

2 Answers2

3

My suggestion is to start from the begging. I had the same issue in my VM and I fixed with these steps:

  1. SSH to you VM from the Google Cloud Console
  2. Run $ ls command to see if the anaconda3 directory is there
  3. If it is execute $ rm -rf anaconda3. This will force to delete the directory and all its data.
  4. After that execute $ exit to exit the VM or close the window to terminate session.
  5. SSH to the VM again
  6. Now we will install the anaconda3. I will post the commands below but you can refer to this documentation: How To Install Anaconda on Ubuntu 18.04 [Quickstart].
  7. Download the Anaconda Bash Script. Execute:
$ cd /tmp
$ curl -O https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh
  1. Verify the Data Integrity of the Installer
$ sha256sum Anaconda3-5.2.0-Linux-x86_64.sh

Output
09f53738b0cd3bb96f5b1bac488e5528df9906be2480fe61df40e0e0d19e3d48  Anaconda3-5.2.0-Linux-x86_64.sh
  1. Run the Anaconda Script
$ bash Anaconda3-5.2.0-Linux-x86_64.sh
  1. Pres ENTER. Keep pressing enter until the first question comes up.
  2. When asked Do you accept the license terms? [yes|no], type yes hit ENTER.
  3. When asked:
Anaconda3 will now be installed into this location:
/home/[YOUR_USERNAME]/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/home/[YOUR_USERNAME]/anaconda3] >>> 
  1. Hit ENTER. This will take some time and a lot of files will be installed.
  2. When asked Do you wish the installer to prepend the Anaconda3 install location to PATH in your /home/cusnir/.bashrc ? [yes|no], type yes hit ENTER.
  3. Now you should see: Thank you for installing Anaconda3!
  4. When asked Do you wish to proceed with the installation of Microsoft VSCode? [yes|no] type no and hit ENTER.
  5. Go to main directory by executing $ cd
  6. If you execute $ ls. You should see the anaconda3 directory there.
  7. You can activate the anaconda environment by executing: $ source anaconda3/bin/activate
  8. Now you should see (base) [YOUR_USERNAME]@ubuntu-linux-os:~$. Which (base) means you are inside that environment.
  9. Execute: $ conda --version
  10. You should get conda 4.5.4 response.
  11. However you can also do that without the step 18. Just when you SSH to the VM execute conda --version and you should see the anaconda's version.
Andrei Cusnir
  • 2,735
  • 1
  • 14
  • 21
1

Old question but I just encountered the same issue. I only needed to do step 19 to get conda to work. No need to start over. However the fix didn't stick - had to repeat on next terminal session.

GDB
  • 3,379
  • 2
  • 26
  • 38