ModuleNotFoundError: No module named 'libtorrent'
Asked Answered
C

3

17

I tried to run this below code in google colabratory:

!apt install python3-libtorrent

import libtorrent as lt

I was able to install python3-libtorrent. But am unable to import libtorrent. But the import attempt above gave a

ModuleNotFoundError: No module named 'libtorrent'
Centaury answered 25/2, 2021 at 3:53 Comment(0)
E
31

Paste these two lines before the first line in the code.

!python -m pip install --upgrade pip setuptools wheel
!python -m pip install lbry-libtorrent
Endogenous answered 25/2, 2021 at 10:17 Comment(2)
Thank you so much. It really works. I am in your debt. Again thank you so much. This will help a lot of people.Centaury
Could you provide an explanation for why adding those extra lines?Safire
S
3
!python -m pip install lbry-libtorrent
!apt install python3-libtorrent
 
import libtorrent as lt
 
ses = lt.session()
ses.listen_on(6881, 6891)
downloads = []

No need ;) !python -m pip install --upgrade pip setuptools wheel

Stovall answered 2/3, 2021 at 2:24 Comment(1)
Excluding the line!apt install python3-libtorrent, the rest would get the job done.Safire
I
0

try

!python -m pip install lbry-libtorrent
Impractical answered 1/10, 2022 at 9:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.