I have installed the python-telegram-bot from cmd using this:
pip install python-telegram-bot
and also I tried this pip install telegram
but after I run a code using Visual studio I receive this error message:
Message=No module named 'telegram'
and Visual studio highlight this line of code :
import telegram.ext
I have tried installing python-telegram-bot several times
So I entered cmd and I used pip install python-telegram-bot and also pip install python-telegram-bot --upgrade and also pip install telegram but it does not work I think I have to install it for Visual Studio somehow
telegram and python-telegram-bot are not the same packages. In fact, the telegram package is just namesquatting and it doesn't contain any functionality - see https://github.com/pypa/pypi-support/issues/1252 for details.
So be sure to uninstall telegram via pip uninstall telegram -y and then install ptb via pip install python-telegram-bot.
Now to your actual problem: The editor highlighting import telegram.ext is rather surely a false positive. This is due to the pypi project being named python-telegram-bot while the library provides a package called telegram. Your editor probably just can't make that connection and thinks that the telegram package is not available.
If you get actual exceptions at runtime - i.e. python my_script.py raises exceptions about the telegram package missing - you'll need to double check that you installed PTB to same same python version/environment that you use to run the script.
Related
I tried:
pip install python-telegram-bot
pip3 install python-telegram-bot
pip install telegram
pip3 install telegram
But the error keeps showing up telling me there is no such package of 'telegram.ext' offered by python-telegram-bot.
However, my text editor with python plugin is able to find the package telegram.ext in my environment. I also tried using command prompt dirtectly on that virtual environment I created, still doesn't work.
Seems that this same issue is faced by other posts on internet without any resolve.
my text editor plugin can find the package
I just realized the error was because there was another file named 'telegram.py' in the same directory causing the package import problem.
Sorry for this silly mistake. Thank you and I will close the case.
It seems both packages python-telegram-bot and telegram uses the same namespace "telegram". This can cause conflicts, so you should remove one of them.
This uninstalls the telegram package
pip uninstall telegram
Note: use pip3 if on Linux or Mac
Do 1-2 via terminal and 4 on your IDE:
Install pip install telegram
Install pip install python-telegram-bot
If you are using a virtual environment, make sure it is activated
Lastly, import from telegram.ext import
I am starting with building a chatbot using rasa. I have followed the installation guide of rasa documentation
I have installed rasa using
pip install rasa
I can import rasa using import rasa and rasa.__version__ gives me a output 1.10.0 but when I try to import rasa-nlu I get ModuleNotFoundError: No module named 'rasa_nlu' error. I am working on windows and seen few suggestions that Visual Studio Installer is also required for windows set up. Why is Visual Studio Installer required, or am I missing anything?
Well, you are facing the legit error - I would suggest you move to Linux for easy work with rasa.
I have faced the same issue just like you and when worked with Ubuntu to be more specific the work goes way to smooth.
You should install rasa-nlu
pip install rasa-nlu
https://pypi.org/project/rasa-nlu/
If you want to solve visual c++ error, follow the steps in
https://learn.microsoft.com/en-us/answers/questions/136595/error-microsoft-visual-c-140-or-greater-is-require.html
To remove module not found rasa-nlu error, do pip install rasa-nlu and install all other dependencies which you will encounter during installation of rasa-nlu.
I have pip installed many packages using the windows powershell from my python 37 window, but havent for a few months and now I am getting an error instead of an install.
I have tried installing two packages (pandas and numpy) and get the same results for both.
I tried switching pip and pandas, as well as pip and the file name (including extension) and received no favorable results. When I type in the name of the module it returns that there is no module with that name, when I type in the full file name for the module it tells me that numpy-1 does not exist.
As you will see in the next section the problem seems to be that the pypi.org format for pip installing seems to have changed when I wasn't paying attention.
my code (which has worked in the past) looks like this
py -3.7 -m pip install numpy-1.16.2-cp37-cp37m-win_amd64.whl
the error looks like this
PS C:\Users\Hezekiah\AppData\Local\Programs\Python\Python37> py -3.7 -m pip install numpy-1.16.2-cp37-cp37m-win_amd64.whl
C:\Users\Hezekiah\AppData\Local\Programs\Python\Python37\python.exe: No module named pip
I expect my pip install code to install numpy, instead it tells me that pip is not a module.
follow steps
1.open cmd
2.give full path to the script folder
e.g.
C:\Python37-32\Scripts
3.then try pip commands
pip install pandas
C:\Python37-32\Scripts>pip install pandas
While using pip install I am getting the following error:
Error while finding spec for 'pip__main__' <: No module named 'urllib.request'; 'urllib' is not a package>; 'pip' is a package and cannot be directly executed
Any advice on this one?
I thought maybe it was related to the requests module itself but I tried to download other modules and had the same problem.
I've just upgraded from Python 3.3 to v3.5.1 on Windows and hit the same error message. I understand it's not the same as your problem.
It seems that the instructions from the docs to use:
python -m pip install SomePackage
are wrong, at least for Windows because I get the error message quoted by the OP.
I forgot to add the Scripts directory to my path, the same as previous releases. When I add it the problem is fixed. My path now has (for a default install of Python 3.5):
PATH=<blah>;%USERPROFILE%\AppData\Local\Programs\Python\Python35;%USERPROFILE%\AppData\Local\Programs\Python\Python35\Scripts
The pip executable is located in Scripts, so pip commands can now be executed directly, the same as always:
pip install urllib
all I want is install pandas comfortably the package pandas via pip.
Inside python I get the following error message:
>>> pip install pandas
c:\python34\python.exe: No module named pip.__main__; 'pip' is a package and cannot be directly executed
Allright then I use the windows powershell
PS C:\Windows\system32> C:\Python34\python.exe -m pip install pandas
C:\Python34\python.exe: No module named pip
I had uninstalled and reinstalled python because I used at first the 32-Bit version but wanted 64-Bit, but had some issues so switched back to the 32-Bit version.
Before the reinstallation process I remember, that I could get pip to work but due to proxy issues didn't get very far. I am not a hundred percent positive but I might have gotten around the proxy issue at least.
Don't know what to do. Can somebody help.
thanks
Gerrit