New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: cannot import name 'TelegramClient' #530
Comments
@madrileanu yes, you're missing to provide more information. |
What additional information do you need me to provide? Thanks. |
If applicable, full traceback. Exact Python version, and library version. |
Having the same problem: ---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-e17947264a29> in <module>()
----> 1 from telethon import TelegramClient
2
3
4
5
~/miniconda3/lib/python3.6/site-packages/telethon/__init__.py in <module>()
1 import logging
----> 2 from .telegram_bare_client import TelegramBareClient
3 from .telegram_client import TelegramClient
4 from .network import ConnectionMode
5 from . import tl, version
~/miniconda3/lib/python3.6/site-packages/telethon/telegram_bare_client.py in <module>()
11
12 from . import helpers as utils, version
---> 13 from .crypto import rsa, CdnDecrypter
14 from .errors import (
15 RPCError, BrokenAuthKeyError, ServerError,
~/miniconda3/lib/python3.6/site-packages/telethon/crypto/__init__.py in <module>()
6 from .aes import AES
7 from .aes_ctr import AESModeCTR
----> 8 from .auth_key import AuthKey
9 from .factorization import Factorization
10 from .cdn_decrypter import CdnDecrypter
~/miniconda3/lib/python3.6/site-packages/telethon/crypto/auth_key.py in <module>()
6
7 from .. import helpers as utils
----> 8 from ..extensions import BinaryReader
9
10
~/miniconda3/lib/python3.6/site-packages/telethon/extensions/__init__.py in <module>()
4 to read arbitrary binary data in a more comfortable way, with int/strings/etc.
5 """
----> 6 from .binary_reader import BinaryReader
7 from .tcp_client import TcpClient
~/miniconda3/lib/python3.6/site-packages/telethon/extensions/binary_reader.py in <module>()
7 from struct import unpack
8
----> 9 from ..errors import TypeNotFoundError
10 from ..tl.all_tlobjects import tlobjects
11
~/miniconda3/lib/python3.6/site-packages/telethon/errors/__init__.py in <module>()
13
14 # This imports the base errors too, as they're imported there
---> 15 from .rpc_error_list import *
16
17
ModuleNotFoundError: No module named 'telethon.errors.rpc_error_list' Installed the v0.16 version (commit c23c0a5) using conda installed Python 3.6 on macOS. |
Same error |
|
Don't run. Same error |
version: Python 3.6.3 (default, Oct 3 2017, 21:45:48) Traceback (most recent call last): |
Run |
Now run but i have the next error:
|
Now that's an issue with your code. |
My code is very simple only have the next lines:
|
Now that's a problem with |
I see, documentation (and |
How? |
@Pantic14 yes. |
Ok, now run ok. |
I pushed 7730137 (now |
I just installed master @ 87a77e7 ---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-019cc35536c8> in <module>()
----> 1 import telethon
/opt/conda/lib/python3.6/site-packages/telethon/__init__.py in <module>()
1 import logging
----> 2 from .telegram_bare_client import TelegramBareClient
3 from .telegram_client import TelegramClient
4 from .network import ConnectionMode
5 from . import tl, version
/opt/conda/lib/python3.6/site-packages/telethon/telegram_bare_client.py in <module>()
10 from time import sleep
11
---> 12 from . import helpers as utils, version
13 from .crypto import rsa, CdnDecrypter
14 from .errors import (
/opt/conda/lib/python3.6/site-packages/telethon/helpers.py in <module>()
4 from hashlib import sha1, sha256
5
----> 6 from telethon.crypto import AES
7 from telethon.errors import SecurityError
8 from telethon.extensions import BinaryReader
/opt/conda/lib/python3.6/site-packages/telethon/crypto/__init__.py in <module>()
6 from .aes import AES
7 from .aes_ctr import AESModeCTR
----> 8 from .auth_key import AuthKey
9 from .factorization import Factorization
10 from .cdn_decrypter import CdnDecrypter
/opt/conda/lib/python3.6/site-packages/telethon/crypto/auth_key.py in <module>()
5 from hashlib import sha1
6
----> 7 from ..extensions import BinaryReader
8
9
/opt/conda/lib/python3.6/site-packages/telethon/extensions/__init__.py in <module>()
4 to read arbitrary binary data in a more comfortable way, with int/strings/etc.
5 """
----> 6 from .binary_reader import BinaryReader
7 from .tcp_client import TcpClient
/opt/conda/lib/python3.6/site-packages/telethon/extensions/binary_reader.py in <module>()
7 from struct import unpack
8
----> 9 from ..errors import TypeNotFoundError
10 from ..tl.all_tlobjects import tlobjects
11
/opt/conda/lib/python3.6/site-packages/telethon/errors/__init__.py in <module>()
13
14 # This imports the base errors too, as they're imported there
---> 15 from .rpc_error_list import *
16
17
ModuleNotFoundError: No module named 'telethon.errors.rpc_error_list' |
If you're installing from GitHub you must run
|
I've installed it with |
With |
Yes. |
Well, I thought of adding the line that calls the code generator in |
Ah, I just took a look at |
Thing is I don't ship the code generator to PyPi so if I tried running |
I understand your logic, but for the user it's confusing. Another solution might be improving the error message, like raising some Exception and with a message about running your |
Hello everyone, Requirement already up-to-date: pyaes in /usr/local/lib/python2.7/dist-packages (from telethon)
Successfully installed telethon
Code I use to start client is: `from telethon import TelegramClient These example values won't work. You must get your own api_id andapi_hash from https://my.telegram.org, under API Development.api_id = ***** client = TelegramClient('session_name', api_id, api_hash) If you already have a previous 'session_name.session' file, skip this.client.sign_in(phone=phone) Thank you. |
|
Tried also with python 3:
|
@madrileanu I have no idea. I don't have such issue: |
If it helps, this is my distro information: Distributor ID: Ubuntu |
Thanks @TiagoDanin, I've came accross that isue several times, and yet fail to spot it. |
I got:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-JEyxfa/telethon/ |
That's really strange… What if |
sudo -H pip install -U telethon --no-cache
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-bzkLJU/telethon/ Well I also just tried to git clone it and inside there I tried: markus@markus: |
@CesMak install pyaes? |
pip3 install pyaes
|
how exactly to install pyaes? |
Had to disable anaconda environment now it seems to work fine. Except I do not know what kind of username I have to write in my script: for message in client.get_message_history('username', limit=25): username=chat name of telegram desktop app of the chat I would like to download messages from?? |
I figured it somehow out and it works username = chatname however saved messages seems not to work: .... python3 multi_img.py |
@CesMak use |
aweasome thanks that works fine :) |
@Lonami 您好(hello),I tried a lot of things but it didn't work.
The group name contains empty spaces is not work:
|
@zhxiaohe why did you post this in a completely unrelated issue? Also, Read the F* Docs. I'm pretty sure the error has a link, and if it doesn't, you're using an old version. |
@Lonami I'm so so sorry,I'm going to read the F* Docs. |
ModuleNotFoundError: No module named 'telethon' |
To everyone still coming to this issue, please check your Python environment and that you correctly installed the library in the right environment. For more questions, you should search and then ask in StackOverflow or the @TelethonChat group. |
Hello,
I have just tried to setup a client but i'm receiving an import error:
ImportError: cannot import name 'TelegramClient'
I installed telethon module with pip3 and tried to run the script with python 3.
Is there something I'm missing here?
Thank you in advance!
The text was updated successfully, but these errors were encountered: