0

What I would love from this question is advice please on

  • best way to install python 3.7 as the default python
  • best way to install packages

I'm very new to the command line. I'm in the middle of a Data Science boot camp and trying out some things on Ubuntu, however, many of the commands we're learning don't seem to be installed (including the installer...).

e.g. python

iboopedu@CODE1026:/mnt/c/Users/shane$ python

Command 'python' not found, but can be installed with:

sudo apt install python3
sudo apt install python
sudo apt install python-minimal

You also have python3 installed, you can run 'python3' instead.

e.g. pip

iboopedu@CODE1026:/mnt/c/Users/shane$ pip install python

Command 'pip' not found, but can be installed with:

sudo apt install python-pip

iboopedu@CODE1026:/mnt/c/Users/shane$ sudo apt install python-pip
[sudo] password for iboopedu:
Sorry, try again.
[sudo] password for iboopedu:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-pip

e.g. virtualenv

iboopedu@CODE1026:/mnt/c/Users/shane$ virtualenv test

Command 'virtualenv' not found, but can be installed with:

sudo apt install virtualenv

iboopedu@CODE1026:/mnt/c/Users/shane$ sudo apt install virtualenv
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package virtualenv

Troubleshooting

I also use a Mac, and on Terminal and all of the above commands work fine without any special set-up or install, running python from Anaconda.

Given this, I've attempted to replicate running python from Anaconda on Ubuntu.

I've tried the following without success:

  1. Changed PATH manually to include Anaconda's python.exe
iboopedu@CODE1026:/mnt/c/Users/shane/Documents$ echo $PATH
/mnt/c/Users/shane:/mnt/c/Users/shane/Anaconda3/Library/bin:/mnt/c/Users/shane/Anaconda3/Scripts:/mnt/c/Users/shane/Anaconda3:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2018.817.0_x64__79rhkp1fndgsc:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/Windows Live/Shared:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/GNU/GnuPG/pub:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Users/shane/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/shane/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin
  1. Reinstalled Anaconda with install option to auto add Anaconda to PATH
iboopedu@CODE1026:/mnt/c/Users/shane$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_1804.2018.817.0_x64__79rhkp1fndgsc:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/Windows Live/Shared:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files (x86)/GNU/GnuPG/pub:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Users/shane/Anaconda3:/mnt/c/Users/shane/Anaconda3/Library/mingw-w64/bin:/mnt/c/Users/shane/Anaconda3/Library/bin:/mnt/c/Users/shane/Anaconda3/Scripts:/mnt/c/Users/shane/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/shane/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin

That's where I am, hopefully someone can help! Thanks in advance.

iboopedu
  • 29
  • 1
  • 2
  • 1
    What Ubuntu version ? – Liso Apr 25 '19 at 04:03
  • The package `python-pip` (https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=python-pip) is found in the 'universe' repository which is enabled by default for any Ubuntu flavor, but needs to be enabled by the owner for Ubuntu (main) as it's a community supported package (Ubuntu main provides only Canonical supported; https://help.ubuntu.com/community/Repositories/Ubuntu). – guiverc Apr 25 '19 at 04:10
  • Version 1804.2018.817.0 – iboopedu Apr 26 '19 at 04:10
  • Thanks @guiverc I've had a look around the documentation you linked to above, however am not quite sure where go with it for what i'm trying to do. I know I have python 3.7 as part of Anaconda, however I don't know how to install/run 3.7. The other commands (pip, virtualenv) I've been told are included in 3.7, so my understanding was, once I have have 3.7 I should be able to use them. So what I'm seeking to understand is how best to install 3.7, Anaconda or otherwise, and really how best to install packages in general. Quite new to this so I hope all the above makes sense, thanks! – iboopedu Apr 26 '19 at 05:24
  • I have no knowledge of anaconda so i'm ignoring that. `pip` & `pip3` just need install via `sudo apt install python-pip` providing 'universe' is enabled on your system (automatic on flavors, manual on Ubuntu itself covered in link already provided for gui, or command via https://help.ubuntu.com/community/Repositories/CommandLine page from previously provided link). Ubuntu releases are *yy.mm* in format in general (with exceptions like IoT releases are [Ubuntu Core] *yy* only) so are you using something under WSL? – guiverc Apr 26 '19 at 06:44
  • Thanks @guiverc I uncommented the universe rows in `sources.list` and was able to then run `sudo apt install python3-pip`. `so are you using something under WSL?` - not sure what you mean by this. – iboopedu May 01 '19 at 07:11
  • Unfortunately addressing the `pip` install does not answer my main question above. I should (I believe) be able to install `Python 3.7` from `Anaconda`. I have added the location of the `python.exe` file to `PATH`, however when I try to install using `sudo apt install python`, it brings back v2.7. `python3` which is already installed is 3.6. How can I install 3.7 from Anaconda? – iboopedu May 01 '19 at 07:22

0 Answers0