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
Related
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.
I have installed a package using anaconda and pip and then removed the package using pip. When i uninstalled using pip in cmd it says uninstalled. So now i have too remove this package from anaconda.
As you can see from the picture above yfinance shows it is installed. However when i try to run the command: conda remove yfinance it says package not found:
How can i remove this package? Because i need to install a fork of this package.
--Edit:--
I tried to install this package but i am getting an error:
Thus i cannot uninstall it.
You can try to install the package anaconda, and then to try uninstall again.
conda install yfinance
conda remove yfinance
I hope this helps.
EDIT
You can also delete the directory of the package, as you pointed out. But make sure you are in the correct one! This seems to be in your root directory of anaconda, as you use the base environment. In my case, this would be
/home/user/anaconda3
You may want to use a search tool to find the correct folder. This might be
/home/user/anaconda3/lib/python3.7/site-packages/yfinance
I use a jupyter notebook as part of an anaconda installation. I'd like to install a Python package hosted on Github (i.e., via a https://... or git://... URL), along with all requirements.txt dependencies. This is a custom package developed in-house, not a package published to PyPI.
I'm not clear on whether I would want to do it in a conda or a pip/virtualenv environment, or how I would do it. What is the best way to do this?
This may not be the best way but you can use Ipython console to install Github package (if supported by pip). Like for TwitterAPI you can use below command
!pip install TwitterAPI
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