user11542207
user11542207

Reputation:

Terminal does not start in Ubuntu 18.04

I tried to install Django Framework in Ubuntu. and i am using python 3.8. but in normal instalation, Django 1.1 had been installed. and i changed the python3 alternative to python3.8 . and usuing python3 -m pip install django. and i installed Django(v 3.3) and used it. but after the changing the alternative, the Terminal doesn't open and start.

i deleted python3.6 from my ubuntu. and the problems had been started after that.

it seems some programs in linux run in python3.6 and after deleting that,

i can't fix the problems and the Terminal windows does not open. i tried other ways (changing the gnome-terminal file, changing the alternative to default v3.6 and fix the Broken distro), but they didn't help me. i can't open Terminal, and when i ran sudo apt update i recieved this Errors:

Any idea?

      File has unexpected size (1133 != 1128). Mirror sync in progress? [IP: ***.**.***.** 80]   
 Release file created at: Wed, 06 May 2020 19:27:45 +0000 Fetched 1,762 B in 2s (932 B/s)  Traceback (most recent call last):   File "/usr/lib/cnf-update-db", line 8, in <module>
        from CommandNotFound.db.creator import DbCreator   File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 7, in <module>
        import sqlite3   File "/usr/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
        from sqlite3.dbapi2 import *   File "/usr/lib/python3.6/sqlite3/dbapi2.py", line 23, in <module>
        import datetime   File "/usr/lib/python3.6/datetime.py", line 8, in <module>
        import math as _math ModuleNotFoundError: No module named 'math' Error in sys.excepthook: Traceback (most recent call last):   File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
        from apport.fileutils import likely_packaged, get_recent_crashes   File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
        from apport.report import Report   File "/usr/lib/python3/dist-packages/apport/report.py", line 12, in <module>
        import subprocess, tempfile, os.path, re, pwd, grp, os, time, io   File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
        import _posixsubprocess ModuleNotFoundError: No module named '_posixsubprocess'

    Original exception was: Traceback (most recent call last):   File "/usr/lib/cnf-update-db", line 8, in <module>
        from CommandNotFound.db.creator import DbCreator   File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 7, in <module>
        import sqlite3   File "/usr/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
        from sqlite3.dbapi2 import *   File "/usr/lib/python3.6/sqlite3/dbapi2.py", line 23, in <module>
        import datetime   File "/usr/lib/python3.6/datetime.py", line 8, in <module>
        import math as _math ModuleNotFoundError: No module named 'math' Reading package lists... Done E: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/main/binary-amd64/Packages.gz File has unexpected size (1133 != 1128). Mirror sync in progress? [IP:
    * 80]    Hashes of expected file:
        - Filesize:1128 [weak]
        - SHA256:*
        - SHA1:*
        - MD5Sum:*
Release file created at: Wed, 06 May 2020 19:27:45 +0000 E: Some index files failed to download. They have been ignored, or old ones used instead. E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi' E: Sub-process returned an error code

and below result showed when i tried to run django-admin:

Traceback (most recent call last):
  File "/usr/bin/django-admin", line 5, in <module>
    from django.core.management import execute_from_command_line
  File "/home/pytm/.local/lib/python3.6/site-packages/django/__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "/home/pytm/.local/lib/python3.6/site-packages/django/utils/version.py", line 1, in <module>
    import datetime
  File "/usr/lib/python3.6/datetime.py", line 8, in <module>
    import math as _math
ModuleNotFoundError: No module named 'math'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 12, in <module>
    import subprocess, tempfile, os.path, re, pwd, grp, os, time, io
  File "/usr/lib/python3.6/subprocess.py", line 136, in <module>
    import _posixsubprocess
ModuleNotFoundError: No module named '_posixsubprocess'

Original exception was:
Traceback (most recent call last):
  File "/usr/bin/django-admin", line 5, in <module>
    from django.core.management import execute_from_command_line
  File "/home/pytm/.local/lib/python3.6/site-packages/django/__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "/home/pytm/.local/lib/python3.6/site-packages/django/utils/version.py", line 1, in <module>
    import datetime
  File "/usr/lib/python3.6/datetime.py", line 8, in <module>
    import math as _math
ModuleNotFoundError: No module named 'math'
profiling:/home/user/Downloads/Python-3.6.10/Programs/python.gcda:Cannot open
profiling:/home/user/Downloads/Python-3.6.10/Modules/xxsubtype.gcda:Cannot open

Upvotes: 2

Views: 7620

Answers (1)

user11542207
user11542207

Reputation:

after a few hours, i found a way to fix the problems.

First, I made a backup of all my data(I would recommend to everyone trying this). Although it worked for me, it may fail for some reason on your machine and you don't want to lose your data.

I ran the following commands to remove the old version of python3.6 without removing all the dependencies and to directly install the default version.

sudo dpkg --remove --force-depends python3.6 python3.6-minimal libpython3.6-minimal libpython3.6-stdlib
sudo apt-get install python3.6 python3.6-minimal libpython3.6-minimal libpython3.6-stdlib

I ran sudo apt-get update and sudo apt-get upgrade before rebooting my machine.

everything became ok..

Upvotes: 1

Related Questions