My suggestion is to start from the begging. I had the same issue in my VM and I fixed with these steps:
- SSH to you VM from the Google Cloud Console
- Run
$ ls
command to see if the anaconda3 directory is there
- If it is execute
$ rm -rf anaconda3
. This will force to delete the directory and all its data.
- After that execute
$ exit
to exit the VM or close the window to terminate session.
- SSH to the VM again
- 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].
- Download the Anaconda Bash Script. Execute:
$ cd /tmp
$ curl -O https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh
- 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
- Run the Anaconda Script
$ bash Anaconda3-5.2.0-Linux-x86_64.sh
- Pres
ENTER
. Keep pressing enter until the first question comes up.
- When asked Do you accept the license terms? [yes|no], type
yes
hit ENTER.
- 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] >>>
- Hit ENTER. This will take some time and a lot of files will be installed.
- 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.
- Now you should see:
Thank you for installing Anaconda3!
- When asked Do you wish to proceed with the installation of Microsoft VSCode? [yes|no] type
no
and hit ENTER.
- Go to main directory by executing
$ cd
- If you execute
$ ls
. You should see the anaconda3
directory there.
- You can activate the anaconda environment by executing:
$ source anaconda3/bin/activate
- Now you should see
(base) [YOUR_USERNAME]@ubuntu-linux-os:~$
. Which (base) means you are inside that environment.
- Execute:
$ conda --version
- You should get
conda 4.5.4
response.
- 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.