missing import for tweepy on vscode - python

im having problem to use tweepy on vscode, it keep reporting a missing import of tweepy and i dont know why.
on power shell shows that requirement already satisfied, and i can see the tweepy on vscode if i search it, so what is going on ?
PS C:\Windows\System32> pip install tweepy
Requirement already satisfied: tweepy in c:\users\arthu\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (4.5.0)
Requirement already satisfied: requests-oauthlib<2,>=1.0.0 in c:\users\arthu\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from tweepy) (1.3.0)
Requirement already satisfied: requests<3,>=2.27.0 in c:\users\arthu\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from tweepy) (2.27.1)
Requirement already satisfied: idna<4,>=2.5 in c:\users\arthu\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests<3,>=2.27.0->tweepy) (2.5)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\arthu\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests<3,>=2.27.0->tweepy) (1.26.8)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\arthu\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests<3,>=2.27.0->tweepy) (2.0.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\arthu\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests<3,>=2.27.0->tweepy) (2021.10.8)
Requirement already satisfied: oauthlib>=3.0.0 in c:\users\arthu\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests-oauthlib<2,>=1.0.0->tweepy) (3.1.1)
PS C:\Windows\System32>

i had the same problem in using tweepy in vs code
so just to be sure i installed tweepy by using pip install tweepy in shell terminal and
the terminal in vs code(just to be sure) and ubuntu as well after that i closed the vs code and then opened it again and it worked, hopefully it works with you

Related

YouTube video viewer program

I am trying to use the Youtube viewer program on someone's YouTube videos. The source code of this program can be found on the GitHub page.
There is a problem in the import statements, though.
In the YouTube viewer -> youtubeviewer -> download_driver.py file, so this page, there is an import statement.
import undetected_chromedriver._compat as uc
At first when I tried to run this program, the following error pops up:
ModuleNotFoundError: No module named 'undetected_chromedriver'
I eventually installed it using the python3 -m pip install undetected_chromedriver command. Everything ran smoothly until the statement above. The command prompt popped up the following error message.
Traceback (most recent call last):
File "C:\Users\14725\YouTube-Viewer\youtube_viewer.py", line 42, in <module>
from youtubeviewer.download_driver import *
File "C:\Users\14725\YouTube-Viewer\youtubeviewer\download_driver.py", line 29, in <module>
import undetected_chromedriver._compat as uc
ModuleNotFoundError: No module named 'undetected_chromedriver._compat'
I checked again if I had installed the module by using the python3 -m pip install undetected_chromedriver command. The following messages popped up:
Requirement already satisfied: undetected_chromedriver in c:\users\14725\appdata\roaming\python\python39\site-packages (3.4)
Requirement already satisfied: requests in c:\users\14725\appdata\roaming\python\python39\site-packages (from undetected_chromedriver) (2.28.0)
Requirement already satisfied: selenium>=4.0.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from undetected_chromedriver) (4.8.0)
Requirement already satisfied: websockets in c:\users\14725\appdata\roaming\python\python39\site-packages (from undetected_chromedriver) (10.4)
Requirement already satisfied: certifi>=2021.10.8 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (2022.5.18.1)
Requirement already satisfied: trio~=0.17 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (0.22.0)
Requirement already satisfied: urllib3[socks]~=1.26 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (1.26.9)
Requirement already satisfied: trio-websocket~=0.9 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (0.9.2)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from requests->undetected_chromedriver) (2.0.12)
Requirement already satisfied: idna<4,>=2.5 in c:\users\14725\appdata\roaming\python\python39\site-packages (from requests->undetected_chromedriver) (3.3)
Requirement already satisfied: cffi>=1.14 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.15.0)
Requirement already satisfied: sniffio in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.3.0)
Requirement already satisfied: sortedcontainers in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (2.4.0)
Requirement already satisfied: async-generator>=1.9 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.10)
Requirement already satisfied: outcome in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.2.0)
Requirement already satisfied: attrs>=19.2.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (21.4.0)
Requirement already satisfied: exceptiongroup>=1.0.0rc9 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.1.0)
Requirement already satisfied: wsproto>=0.14 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio-websocket~=0.9->selenium>=4.0.0->undetected_chromedriver) (1.2.0)
Requirement already satisfied: PySocks!=1.5.7,<2.0,>=1.5.6 in c:\users\14725\appdata\roaming\python\python39\site-packages (from urllib3[socks]~=1.26->selenium>=4.0.0->undetected_chromedriver) (1.7.1)
Requirement already satisfied: pycparser in c:\users\14725\appdata\roaming\python\python39\site-packages (from cffi>=1.14->trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (2.21)
Requirement already satisfied: h11<1,>=0.9.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from wsproto>=0.14->trio-websocket~=0.9->selenium>=4.0.0->undetected_chromedriver) (0.14.0)
Which I think these have indicated that I have the module installed. What should I do to run this program? Have I missed something?
There was an important update of undetected_chromedriver recently. I recommend you to install the latest known stable version with:
pip install undetected-chromedriver==3.2.1

'No module named 'webdriver_manager'' after reinstalling, checking library correctness

When I want to
from webdriver_manager.chrome import ChromeDriverManager
I get ModuleNotFoundError. I have uninstalled and installed again using pip3, and chekced the previous related questions here about the same matter, but still can't figure it out. Below are the installation details.
C:\Users\eywy0>pip3 install webdriver_manager
Requirement already satisfied: webdriver_manager in c:\users\eywy0\anaconda3\lib\site-packages (3.7.1)
Requirement already satisfied: requests in c:\users\eywy0\anaconda3\lib\site-packages (from webdriver_manager) (2.27.1)
Requirement already satisfied: python-dotenv in c:\users\eywy0\anaconda3\lib\site-packages (from webdriver_manager) (0.20.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\eywy0\anaconda3\lib\site-packages (from requests->webdriver_manager) (1.26.9)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\eywy0\anaconda3\lib\site-packages (from requests->webdriver_manager) (2.0.4)
Requirement already satisfied: idna<4,>=2.5 in c:\users\eywy0\anaconda3\lib\site-packages (from requests->webdriver_manager) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\eywy0\anaconda3\lib\site-packages (from requests->webdriver_manager) (2021.10.8)
Any clue on what might have gone wrong? Thanks for any help!!

Import - Module not found

I am very new, all help much appreciated.
In trying to learn Python, I am repeatedly coming up with an issue I don't know how to solve.
Each time I try to call a module via the "import" function I am getting the following error message -
ModuleNotFoundError: No module named 'requests'
However, when I run the command line install prompt, I am told that the request is already satisfied (i.e. it should already be installed). I haven't saved anything in a bespoke location (or at least, I am not aware I have!).
C:\Users\chris>pip install requests
Requirement already satisfied: requests in c:\users\chris\appdata\local\programs\python\python39\lib\site-packages (2.25.1)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\chris\appdata\local\programs\python\python39\lib\site-packages (from requests) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\chris\appdata\local\programs\python\python39\lib\site-packages (from requests) (1.26.4)
Requirement already satisfied: idna<3,>=2.5 in c:\users\chris\appdata\local\programs\python\python39\lib\site-packages (from requests) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\chris\appdata\local\programs\python\python39\lib\site-packages (from requests) (2020.12.5)
try this command
py -3.9 -m pip install requests
You can refer the official documentation https://docs.python.org/3/installing/

ModuleNotFoundError: No module named 'wikipedia'

I am trying to make a line of code, that searches Wikipedia for information. Here's my code:
import wikipedia
print(wikipedia.summary("Wikipedia"))
I have used the same module in the past, with no problem. Now here comes the error. When I run this SIMPLE 2 lines of code, I get: Modulenotfounderror: No module named: "wikipedia"
Yes, I have tried pip install wikipedia, and pip3 install wikipedia and it says:
Requirement already satisfied: wikipedia in c:\users\dinoh\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (1.4.0)
Requirement already satisfied: beautifulsoup4 in c:\users\dinoh\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from wikipedia) (4.10.0)
Requirement already satisfied: requests<3.0.0,>=2.0.0 in c:\users\dinoh\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from wikipedia) (2.27.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\dinoh\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (1.26.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\dinoh\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (2021.10.8)
Requirement already satisfied: idna<4,>=2.5 in c:\users\dinoh\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (3.3)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\dinoh\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from requests<3.0.0,>=2.0.0->wikipedia) (2.0.10)
Requirement already satisfied: soupsieve>1.2 in c:\users\dinoh\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from beautifulsoup4->wikipedia) (2.3.1)
I don't know what to do.
Alrighty, so the fix for my own question was that I needed to use the correct version of python. So I just installed a slightly older version of python (3.9) as I was using 3.10 currently, and then swapped the version of python I was using in vscode. Worked like a charm. If you're feeling lazy, you can also download the version you need off of the Microsoft store like I did. :)
Click here for image cause I don't have embed perms yet lol

Issues importing pandas and matplotlib in anaconda spyder

I tried installing pandas and matplotlib using the pip-command in Anaconda prompt
pip install matplotlib and it gave me the following:
Requirement already satisfied: matplotlib in c:\programdata\anaconda3\lib\site-p
ackages (3.1.3)
Requirement already satisfied: python-dateutil>=2.1 in c:\programdata\anaconda3\
lib\site-packages (from matplotlib) (2.8.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\pr
ogramdata\anaconda3\lib\site-packages (from matplotlib) (2.4.6)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\programdata\anaconda3\lib
\site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: cycler>=0.10 in c:\programdata\anaconda3\lib\site
-packages (from matplotlib) (0.10.0)
Requirement already satisfied: numpy>=1.11 in c:\programdata\anaconda3\lib\site-
packages (from matplotlib) (1.18.1)
Requirement already satisfied: six>=1.5 in c:\programdata\anaconda3\lib\site-pac
kages (from python-dateutil>=2.1->matplotlib) (1.14.0)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\lib\site-p
ackages (from kiwisolver>=1.0.1->matplotlib) (45.2.0.post20200210)
And when trying to import in Spyder, it says no module found.
What should I do? Thanks in advance.
Make sure your spyder points to your anaconda environment. Currently it is not pointing to your anaconda env that is the reason you are getting this error.

Categories