alfem/telegram-download-daemon

Getting ModuleNotFoundError: No module named 'telethon'

Closed this issue · 10 comments

Hi
Good day.

I got the following results from 3 tries. Each try I changed the channel number thinking that it was the problem.

ERROR / _RESULT - 3 tries

C:\Users\username\Desktop\telegram-download-daemon-master>python telegram-download-daemon.py --api-id 11093017 --api-hash 82a19f59c9ea8615d277803190e1da9b --channel 1571240857
Traceback (most recent call last):
File "C:\Users\username\Desktop\telegram-download-daemon-master\telegram-download-daemon.py", line 16, in
from sessionManager import getSession, saveSession
File "C:\Users\username\Desktop\telegram-download-daemon-master\sessionManager.py", line 2, in
from telethon.sessions import StringSession
ModuleNotFoundError: No module named 'telethon'

C:\Users\username\Desktop\telegram-download-daemon-master>python telegram-download-daemon.py --api-id 11093017 --api-hash 82a19f59c9ea8615d277803190e1da9b --channel 1001571240857
Traceback (most recent call last):
File "C:\Users\username\Desktop\telegram-download-daemon-master\telegram-download-daemon.py", line 16, in
from sessionManager import getSession, saveSession
File "C:\Users\username\Desktop\telegram-download-daemon-master\sessionManager.py", line 2, in
from telethon.sessions import StringSession
ModuleNotFoundError: No module named 'telethon'

C:\Users\username\Desktop\telegram-download-daemon-master>python telegram-download-daemon.py --api-id 11093017 --api-hash 82a19f59c9ea8615d277803190e1da9b --channel -1001571240857
Traceback (most recent call last):
File "C:\Users\username\Desktop\telegram-download-daemon-master\telegram-download-daemon.py", line 16, in
from sessionManager import getSession, saveSession
File "C:\Users\username\Desktop\telegram-download-daemon-master\sessionManager.py", line 2, in
from telethon.sessions import StringSession
ModuleNotFoundError: No module named 'telethon'

Please advise on what I can do to make it work. Thank you so much.

alfem commented

Have you installed the daemon? If you just download and run it probably you are missing some required libraries.

Please, read the paragraph "Installation" in the included Readme.

Hi alfem, Hi all.

Thank you so much. Appreciate your advisement.
I did perform the installation before and did it again. After installing the MS Visual C++ 14.0 and run it again. Below is what I got from the installation.

=======
C:\Users\username\Desktop\telegram-download-daemon-master>pip install -r requirements.txt
Collecting cffi==1.14.0
Using cached cffi-1.14.0.tar.gz (463 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Users\Public\Documents\iSkysoft\CreatorTemp\pip-install-z3yiava5\cffi_09e4282fb4b441df83654d6bdd49741e\setup.py", line 127, in
if sys.platform == 'win32' and uses_msvc():
File "C:\Users\Public\Documents\iSkysoft\CreatorTemp\pip-install-z3yiava5\cffi_09e4282fb4b441df83654d6bdd49741e\setup.py", line 105, in uses_msvc
return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif')
File "c:\users\username\appdata\local\programs\python\python39\lib\distutils\command\config.py", line 225, in try_compile
self._compile(body, headers, include_dirs, lang)
File "c:\users\username\appdata\local\programs\python\python39\lib\distutils\command\config.py", line 132, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "c:\users\username\appdata\local\programs\python\python39\lib\distutils_msvccompiler.py", line 323, in compile
self.initialize()
File "c:\users\username\appdata\local\programs\python\python39\lib\distutils_msvccompiler.py", line 220, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools\msvc.py", line 314, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools\msvc.py", line 268, in _msvc14_get_vc_env
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

=======

My apologies and thank you. Please advise how to resolve observed issues on the intallation requirements.

alfem commented

Looking at your installation log It seems that you need to install MS Visual C++ 14.

Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio":

Are you sure you have installed it?

Yes, I got a similar error and saw that I needed to install MS Visial C++ 14 as stated. I did and run or execute it the install again and that (the log on the previous post) was what I got. Please advise. Thank you.

alfem commented

Perhaps Visual C 14 is not in your path, or pip command needs an update.

Try this command:

pip install --upgrade setuptools
And then, execute the install for the telegram-download-daemon again.

Thank you for working with me @alfem

  1. executed the command
    pip install --upgrade setuptools

Microsoft Windows [Version 10.0.19044.1889]
(c) Microsoft Corporation. All rights reserved.

C:\Users\username>pip install --upgrade setuptools
Requirement already satisfied: setuptools in c:\users\username\appdata\local\programs\python\python39\lib\site-packages (49.2.1)
Collecting setuptools
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000028D3ECD59D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /packages/d9/5f/2daccd14278b6b780ae6799f85998377c06019354982391245f4b58a927d/setuptools-65.3.0-py3-none-any.whl
Downloading setuptools-65.3.0-py3-none-any.whl (1.2 MB)
---------------------------------------- 1.2/1.2 MB 2.3 MB/s eta 0:00:00
Installing collected packages: setuptools
Attempting uninstall: setuptools
Found existing installation: setuptools 49.2.1
Uninstalling setuptools-49.2.1:
Successfully uninstalled setuptools-49.2.1
Successfully installed setuptools-65.3.0

C:\Users\username>

  1. execute the install for the telegram-download-daemon again.

C:\Users\username\Desktop\telegram-download-daemon-master>pip install -r requirements.txt
Collecting cffi==1.14.0
Using cached cffi-1.14.0.tar.gz (463 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Users\Public\Documents\iSkysoft\CreatorTemp\pip-install-8dhap507\cffi_18012077ac034d2f85e901f257411338\setup.py", line 127, in
if sys.platform == 'win32' and uses_msvc():
File "C:\Users\Public\Documents\iSkysoft\CreatorTemp\pip-install-8dhap507\cffi_18012077ac034d2f85e901f257411338\setup.py", line 105, in uses_msvc
return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif')
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools_distutils\command\config.py", line 224, in try_compile
self._compile(body, headers, include_dirs, lang)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools_distutils\command\config.py", line 129, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools_distutils_msvccompiler.py", line 344, in compile
self.initialize()
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools_distutils_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools\msvc.py", line 214, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools\msvc.py", line 168, in _msvc14_get_vc_env
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

C:\Users\username\Desktop\telegram-download-daemon-master>


may be getting the same errors ... also tried the telegram-download-daemon.py with the same error

C:\Users\username\Desktop\telegram-download-daemon-master>python telegram-download-daemon.py --api-id 11093017 --api-hash 82a19f59c9ea8615d277803190e1da9b --channel -1001571240857
Traceback (most recent call last):
File "C:\Users\username\Desktop\telegram-download-daemon-master\telegram-download-daemon.py", line 16, in
from sessionManager import getSession, saveSession
File "C:\Users\username\Desktop\telegram-download-daemon-master\sessionManager.py", line 2, in
from telethon.sessions import StringSession
ModuleNotFoundError: No module named 'telethon'

C:\Users\username\Desktop\telegram-download-daemon-master>

thank you for the continued support.
-don

alfem commented

Your python installatin is defective. As you can see it can not download and/or install many required modules.

I suggest you to remove that python and reinstall it again.

Hi @alfem
Good day.

Here's what I did.

  1. download the win 64-bit installer again
  2. uninstall phython
  3. install phython
  4. execute
    pip install --upgrade setuptools

C:\Users\username\Desktop\telegram-download-daemon-master>pip install --upgrade setuptools
Requirement already satisfied: setuptools in c:\users\username\appdata\local\programs\python\python39\lib\site-packages (65.3.0)

C:\Users\username\Desktop\telegram-download-daemon-master>

  1. execute (on where the requirements.txt is located)
    pip install -r requirements.txt

C:\Users\username\Desktop\telegram-download-daemon-master>pip install -r requirements.txt
Collecting cffi==1.14.0
Using cached cffi-1.14.0.tar.gz (463 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Users\Public\Documents\iSkysoft\CreatorTemp\pip-install-0yvxbv1g\cffi_97c3c815ed86445386b30cc8cae45e9f\setup.py", line 127, in
if sys.platform == 'win32' and uses_msvc():
File "C:\Users\Public\Documents\iSkysoft\CreatorTemp\pip-install-0yvxbv1g\cffi_97c3c815ed86445386b30cc8cae45e9f\setup.py", line 105, in uses_msvc
return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif')
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools_distutils\command\config.py", line 224, in try_compile
self._compile(body, headers, include_dirs, lang)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools_distutils\command\config.py", line 129, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools_distutils_msvccompiler.py", line 344, in compile
self.initialize()
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools_distutils_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools\msvc.py", line 214, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File "c:\users\username\appdata\local\programs\python\python39\lib\site-packages\setuptools\msvc.py", line 168, in _msvc14_get_vc_env
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

C:\Users\username\Desktop\telegram-download-daemon-master>

**** same error info as previous ****

I have the same error in termux. Please anybody help

alfem commented

I can read in @donpascual output:
"Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools":

So, have you tried to install it?