0

I was trying to install python 3.7 in my Ubuntu virtualbox using 'sudo apt-get install python3.7'. However, I got the below output: -

Building dependency tree       
Reading state information... Done
python3.7 is already the newest version (3.7.4-2~16.04.york1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libpython3.7 : Depends: libpython3.7-stdlib (= 3.7.4-2~16.04.york1) but 3.7.4-1+xenial2 is to be installed
 libpython3.7-dev : Depends: libpython3.7-stdlib (= 3.7.4-2~16.04.york1) but 3.7.4-1+xenial2 is to be installed
 libpython3.7-stdlib : Depends: libpython3.7-minimal (= 3.7.4-1+xenial2) but 3.7.4-2~16.04.york1 is to be installed
 python3.7 : Depends: libpython3.7-stdlib (= 3.7.4-2~16.04.york1) but 3.7.4-1+xenial2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Afterwards, I tried executing 'apt-get -f install' as recommended in the above output, but then I got the below: -

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libpython3.7-stdlib
The following packages will be upgraded:
  libpython3.7-stdlib
1 upgraded, 0 newly installed, 0 to remove and 209 not upgraded.
4 not fully installed or removed.
Need to get 0 B/1,756 kB of archives.
After this operation, 66.6 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 189831 files and directories currently installed.)
Preparing to unpack .../libpython3.7-stdlib_3.7.4-2~16.04.york1_amd64.deb ...
Unpacking libpython3.7-stdlib:amd64 (3.7.4-2~16.04.york1) over (3.7.4-1+xenial2) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.7-stdlib_3.7.4-2~16.04.york1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.7/distutils/__init__.py', which is also in package python3.7-distutils 3.7.4-1+xenial2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libpython3.7-stdlib_3.7.4-2~16.04.york1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Update:

Even though the error says that python3.7 is already there, when I execute python, I get the below:

Python 2.7.12 (default, Oct  8 2019, 14:14:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.

And below when I run 'python3': -

Python 3.5.2 (default, Oct  8 2019, 13:06:37) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.

All I want to do is to install python 3.7.

Can anyone kindly help me with this error?

SharkJ
  • 49
  • 1
  • 12

1 Answers1

0

I see following in your logs

python3.7 is already the newest version (3.7.4-2~16.04.york1).

It says python3.7 is already install.

can you just try python or python3 on command line, see what it says? if you see something like below, it has successfully installed

  Python 3.7.3 (v3.7.3 Oct  3 2017, 00:32:08) 
 [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on XXX
 Type "help", "copyright", "credits" or "license" for more information.
ShivYaragatti
  • 398
  • 2
  • 8
  • I updated my question with the answer to your request. Can you please look upon it? – SharkJ Oct 14 '19 at 06:02
  • could you try by creating virtualenv, 1) create directory./venv 2) virtualenv --system-site-packages -p python3 ./venv 3)source ./venv/bin/activate 4) pip install --upgrade pip see if it works and also check https://stackoverflow.com/questions/51279791/how-to-upgrade-python-version-to-3-7 – ShivYaragatti Oct 14 '19 at 10:08