1

I am Debian user.

I run the code in the shell as a root:

I want to install telegram with below command :

sudo add-apt-repository ppa:atareao/telegram

sudo apt-get update

sudo apt-get install telegram

I get the following error:

    Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 11, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
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 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 11, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

how can I resolve it?

Thanks

GAD3R
  • 4,317
  • 1
  • 23
  • 34
Mostafa Norzade
  • 1,578
  • 5
  • 24
  • 40
  • https://stackoverflow.com/questions/13708180/python-dev-installation-error-importerror-no-module-named-apt-pkg – aicastell May 24 '18 at 07:23
  • are you sure this link is my answer ?? – Mostafa Norzade May 24 '18 at 07:26
  • Fix this error message: ModuleNotFoundError: No module named 'apt_pkg', and you will probably fix your issue. – aicastell May 24 '18 at 07:28
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww May 25 '18 at 00:50
  • @jww But why you vote down my answer. – GAD3R May 26 '18 at 09:05

2 Answers2

2

Tow way to install telegram on debian:

1) The telegram package can be installed through snap.

# apt install snapd

To find a package:

snap find telegram

Sample output:

Name                 Version     Developer       Notes  Summary
telegram-sergiusens  1.2.6       sergiusens      -      Telegram desktop client
telegram-cli         1.4.5       marius-quabeck  -      Command-line interface for Telegram. Uses the readline interface.
telegram-desktop     1.2.17      3v1n0           -      Official desktop client for the Telegram messenger
ubuntu-social-kit    3           keshavnrj       -      Bring social media apps to Ubuntu Desktop
squirrelbot          1.1.2       xordspar0       -      A Telegram bot that stashes away links that you send it
mup-plugins          2017.04.19  niemeyer        -      mup IRC and Telegram bot - plugins side
mup-accounts         2016.09.24  niemeyer        -      mup IRC and Telegram bot - account connection side
shell2telegram       1.7         msoap           -      Telegram bot constructor from command-line

To install telegram:

# snap install telegram-desktop

2) The package telegram-desktop is available on stretch-backports. Edit your /etc/apt/sources.list by adding the following line:

deb http://deb.debian.org/debian/ stretch-backports main

Save then run:

# apt update
# apt install telegram-desktop

The package is available also for debian Buster and Sid.

Remove the ppa:atareao/telegram (Under /etc/apt/sources.list.d/) and see the answer linked by @aicastell to fix the error.

GAD3R
  • 4,317
  • 1
  • 23
  • 34
1

why you want to download and install telegram from PPA ?!
follow me :
1) Download Telegram Desktop from Telegram.Org
2) Extract archive to /opt
3) execute /opt/Telegram/Telegram

Note : Telegram app automatically install telegramdesktop.desktop file on your application menu (~/.local/share/applications/telegramdesktop.desktop) . next time only click on icon .

FINE .

mah454
  • 1,571
  • 15
  • 38