" import telegram.ext ModuleNotFoundError: No module named 'telegram.ext'; 'telegram' is not a package" after installing python-telegram-bot - python-telegram-bot

Hey I was trying to edit a telegram bot, but this error keeps coming:
import telegram.ext ModuleNotFoundError: No module named 'telegram.ext'; 'telegram' is not a package.
My code is like this:-
import telegram.ext
with open('token.txt', 'r') as f:
TOKEN = f.read()
def start(update, context):
update.message.reply_text("Helllo")
updater = telegram.ext.Updater(TOKEN, use_context=True)
disp = updater.dispatcher
any help will be appreciated
I've tried reinstalling python-telegram-bot.

Probably you've installed a wrong telegram package, too. Some IDEs install packages automatically and they install telegram instead of python-telegram-bot.
You should find the wrong installed package and uninstall it.
Figure out what package is imported on import telegram.ext, you can find it in the error description. Then you should uninstall it, using a command like this:
pip uninstall telegam
Then install python-telegram-bot if it is not installed:
pip install python-telegram-bot

Related

ModuleNotFoundError: No module named 'pydea'

I have installed pydea in google colab using pip method.
Now when I am importing pydea as dea, it gives an error.
it says- 'No module named pydea'
The module to import is pyDEA, not pydea.
Try this:
first, do: !pip install pydea
and then: import pyDEA

How to use this?

from discord import Client, Intents, Embed
from discord_slash import SlashCommand, SlashContext
bot = Client(intents=Intents.default())
slash = SlashCommand(bot)
#slash.slash(name="test")
async def test(ctx: SlashContext):
embed = Embed(title="Embed Test")
await ctx.send(embed=embed)
bot.run("discord_token")
i'm using discord_slash.
but it error everytime
line 2, in <module>
from discord_slash import SlashCommand, SlashContext
ModuleNotFoundError: No module named 'discord_slash'
i installed discord-py-interactions
how to fix this ;(
Discord.py has been deprecated due to the new update of v13
Discord developers are still working on the libraries, so hold on!
Install discord-py-slash-command:
pip install discord-py-slash-command
Try
pip3 install discord_slash

ModuleNotFoundError for 'modin' even though it is installed by poetry

On import modin.pandas as modin_pd line I get ModuleNotFoundError: No module named 'modin'. I am using poetry & JupyterLab. If in the cell I type !poetry add modin, I get ValueError saying Package modin is already present.
So it cannot install modin because it is already installed but it cannot import it either. Any obvious solution that I am missing?
pip freeze command also shows modin to be installed. I also tried to install it via pip install but absolutely nothing let me to import this module in the end.
The problem may be this one KeyError: CPU
It can be solved by using pip install psutil

Can't install PyQT5 on Mac with pip3

I tried to install PyQt5 on Mac (10.12.4 sierra) with pip3 but so far, no success. I saw several answers here on SO, but non helped me. After some different attempts I deleted python3 completely and did a fresh install (downloaded the installer from https://www.python.org/downloads/mac-osx/).
After python3 was working again, I ran pip3 install PyQt5, which finished successfully, but it is still not working.
I'm testing with this script:
import sys
from PyQt5.QTWidgets import QApplication, QWidget
def window():
app = QApplication(sys.argv)
w = QWidget()
w.show()
sys.exit(app.exec_())
window()
and the error message is always
Traceback (most recent call last):
File "MyTestGui.py", line 2, in <module>
from PyQt5.QTWidgets import QApplication, QWidget
ModuleNotFoundError: No module named 'PyQt5.QTWidgets'
I assume, that I either forgot something, or that my old python installation is not fully removed and still in the way...
Edit:
1) Before, I tried the installation via Homebrew, but I had the same problem.
2) Here my pip3 list:
pip (9.0.1)
PyQt5 (5.8.2)
setuptools (28.8.0)
sip (4.19.2)
3) Is there any way to test intermediate steps to understand better, at which step the installation is failing?
You will find that the correct package is PyQt5.QtWidgets and not PyQt5.QTWidgets.
This can be seen by doing a help(PyQt5) after importing it.

ImportError: cannot import name PyFontify

I am installing django-easy-pdf, xhtml2pdf and reportlab using pip I installed the following in a virtual environment.:
$ pip install django-easy-pdf
$ pip install "xhtml2pdf>=0.0.6" "reportlab>=2.7,<3"
But after the testing, there is an import error that has following message:
from reportlab.lib import PyFontify
ImportError: cannot import name PyFontify
Oh, I nearly forgot, when I'm installing the reportlab, this came up in the middle of the setup:
running build_ext
building '_rl_accel' extension
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
Get it from http://aka.ms/vcpython27
----------------------------------------
Rolling back uninstall of reportlab
I solved this by removing the packages and their dependencies and installing it again.

Resources