1

I have a VM with: OS: Ubuntu 16.04.1 LTS Kernel: Linux 4.4.0-59-generic Architecture: x86-64

In this system, there were 2 versions of python: 2.7.12 and 3.5. Pip was also installed. Pip version is:

pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)

Every time pip install <package> was run, I got error. The main error was because lsb_release -a returned error. I ran lsb_release -a from console and I got invalid syntax error:

File "/usr/bin/lsb_release", line 64
print("No LSB modules are available.", file=sys.stderr)
                                           ^

The header of lsb_release file has the following:

#!/usr/bin/python3 -Es

But the system does not seem to know how to get to python3, even though the symbolic link was set for python3 to python3.5, using the following command:

sudo ln -s /usr/bin/python3.5 /usr/bin/python3

The output of command ls -l /usr/bin/python* is the following:

lrwxrwxrwx 1 root root       9 Dec  9  2015 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root       9 Dec  9  2015 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3546104 Nov 19 01:35 /usr/bin/python2.7
lrwxrwxrwx 1 root root      33 Nov 19 01:35 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config
lrwxrwxrwx 1 root root      16 Dec  9  2015 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root       9 Jan 26 09:07 /usr/bin/python3 -> python3.5
-rwxr-xr-x 2 root root 3546104 Jan 19 14:23 /usr/bin/python3.5
lrwxrwxrwx 1 root root      33 Nov 17 11:23 /usr/bin/python3.5-config -> x86_64-linux-gnu-python3.5-config
-rwxr-xr-x 2 root root 3546104 Jan 19 14:23 /usr/bin/python3.5m
lrwxrwxrwx 1 root root      34 Nov 17 11:23 /usr/bin/python3.5m-config -> x86_64-linux-gnu-python3.5m-config
lrwxrwxrwx 1 root root      16 Mar 23  2016 /usr/bin/python3-config -> python3.5-config
lrwxrwxrwx 1 root root      10 Jun  6  2016 /usr/bin/python3m -> python3.5m
lrwxrwxrwx 1 root root      17 Mar 23  2016 /usr/bin/python3m-config -> python3.5m-config
lrwxrwxrwx 1 root root      16 Dec  9  2015 /usr/bin/python-config -> python2.7-config

Checking the version of python3.5, I got back the version of 2.7:

$ /usr/bin/python3.5 --version
Python 2.7.12

Something does not look right from my system, when I execute ll -a /usr/share/man/man1 | grep python. The output is:

-rw-r--r--  1 root root   3367 Dec  9  2015 dh_python2.1.gz
-rw-r--r--  1 root root   3280 May 18  2016 dh_python3.1.gz
lrwxrwxrwx  1 root root     14 Dec  9  2015 python.1.gz -> python2.7.1.gz
lrwxrwxrwx  1 root root     14 Dec  9  2015 python2.1.gz -> python2.7.1.gz
-rw-r--r--  1 root root   5640 Nov 19 01:32 python2.7.1.gz
lrwxrwxrwx  1 root root     38 Nov 19 01:35 python2.7-config.1.gz -> x86_64-linux-gnu-python2.7-config.1.gz
lrwxrwxrwx  1 root root     21 Dec  9  2015 python2-config.1.gz -> python2.7-config.1.gz
lrwxrwxrwx  1 root root     14 Jun  6  2016 python3.1.gz -> python3.5.1.gz
-rw-r--r--  1 root root   5174 Nov 17 10:43 python3.5.1.gz
lrwxrwxrwx  1 root root     38 Nov 17 11:23 python3.5-config.1.gz -> x86_64-linux-gnu-python3.5-config.1.gz
lrwxrwxrwx  1 root root     14 Nov 17 11:23 python3.5m.1.gz -> python3.5.1.gz
lrwxrwxrwx  1 root root     39 Nov 17 11:23 python3.5m-config.1.gz -> x86_64-linux-gnu-python3.5m-config.1.gz
lrwxrwxrwx  1 root root     21 Mar 23  2016 python3-config.1.gz -> python3.5-config.1.gz
lrwxrwxrwx  1 root root     15 Jun  6  2016 python3m.1.gz -> python3.5m.1.gz
lrwxrwxrwx  1 root root     22 Mar 23  2016 python3m-config.1.gz -> python3.5m-config.1.gz
lrwxrwxrwx  1 root root     21 Dec  9  2015 python-config.1.gz -> python2.7-config.1.gz
-rw-r--r--  1 root root    921 Nov 19 00:15 x86_64-linux-gnu-python2.7-config.1.gz
lrwxrwxrwx  1 root root     39 Nov 17 11:23 x86_64-linux-gnu-python3.5-config.1.gz -> x86_64-linux-gnu-python3.5m-config.1.gz
-rw-r--r--  1 root root    907 Nov 23  2013 x86_64-linux-gnu-python3.5m-config.1.gz
lrwxrwxrwx  1 root root     38 Mar 23  2016 x86_64-linux-gnu-python3-config.1.gz -> x86_64-linux-gnu-python3.5-config.1.gz
lrwxrwxrwx  1 root root     39 Mar 23  2016 x86_64-linux-gnu-python3m-config.1.gz -> x86_64-linux-gnu-python3.5m-config.1.gz
lrwxrwxrwx  1 root root     38 Dec  9  2015 x86_64-linux-gnu-python-config.1.gz -> x86_64-linux-gnu-python2.7-config.1.gz

The 3.5 package, x86_64-linux-gnu-python3.5-config.1.gz, has a symbolic link to 3.5m. Is it odd?

The problem now is how to correct the python3 point to the correct version. Is there a way to do so?

Thank you

  • Please edit this question to include the output of ls -l /usr/bin/python*. – Eliah Kagan Jan 26 '17 at 4:25
  • Check this question. – Alfabravo Jan 26 '17 at 5:37
0

The problem was the python versions 2.7.12 and 3.5.2 have messed up on the VM. A quick solution is just to purge the VM and create another one. This resolved my problem.

0

You just purge lsb-release package and install again it will solve your problem.

 $ sudo apt purge lsb-release
 $ sudo apt install lsb-release 

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.