No module named pandas? - python

I have been working on a program for a while now and never had this issue. I installed Kivy for a seperate program and then all of a sudden I get an error saying ModuleNotFoundError: No module named 'pandas' for my first program. I tried reinstalling it through CMD but it's already there.
C:\Users\xxxxx>python -m pip install pandas
Requirement already satisfied: pandas in c:\users\xxxxx\appdata\roaming\python\python37\site-packages (0.25.3)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\xxxxx\appdata\roaming\python\python37\site-packages (from pandas) (2.8.0)
Requirement already satisfied: numpy>=1.13.3 in c:\users\xxxxx\appdata\roaming\python\python37\site-packages (from pandas) (1.16.4)
Requirement already satisfied: pytz>=2017.2 in c:\users\xxxxx\appdata\roaming\python\python37\site-packages (from pandas) (2019.1)
Requirement already satisfied: six>=1.5 in c:\users\xxxxx\appdata\roaming\python\python37\site-packages (from python-dateutil>=2.6.1->pandas) (1.12.0)
I also tried uninstalling it and reinstalling it but nothing worked, I have no idea what's going on.

Check if kivy is installed properly and if it runs in virtual environment (ve), if so you should install required packages in your ve directly.
See also kivy's installation guide:
https://kivy.org/doc/stable/installation/installation-windows.html#installing-the-kivy-stable-release

Related

Pandas module not found, although

For some reason I cannot get Pandas to work. A few year back I used Atom as IDE, back then everything was working fine. Now I wanted to refresh my Python skills by using PyCharm, however my first script results in:
ModuleNotFoundError: No module named 'pandas'
According to cmd pandas is installed:
Requirement already satisfied: pandas in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (1.5.1)
Requirement already satisfied: numpy>=1.21.0 in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (from pandas) (1.23.4)
Requirement already satisfied: python-dateutil>=2.8.1 in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (from pandas) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (from pandas) (2022.5)
Requirement already satisfied: six>=1.5 in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)
Uninstalling and re-installing does not make a difference. I have tried this a couple of times.
Most likely you're using a different (virtual) environment at the command line and in PyCharm. See JetBrains docs on configuring the Python interpreter for PyCharm.
If Python's configured the way you expect, check the installed packages as well by following these docs

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

why Visual studio code can not find pandas when it is already installed

I followed this instruction https://code.visualstudio.com/docs/python/python-tutorial to install pandas. and when I check it is installed:
python -m pip install pandas
Requirement already satisfied: pandas in c:\users\mansour\appdata\local\programs\python\python37\lib\site-packages (1.1.4)
Requirement already satisfied: pytz>=2017.2 in c:\users\mansour\appdata\local\programs\python\python37\lib\site-packages (from pandas) (2020.4)
Requirement already satisfied: numpy>=1.15.4 in c:\users\mansour\appdata\local\programs\python\python37\lib\site-packages (from pandas) (1.19.1)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\mansour\appdata\local\programs\python\python37\lib\site-packages (from pandas) (2.8.1)
Requirement already satisfied: six>=1.5 in c:\users\mansour\appdata\roaming\python\python37\site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)
I am running this command in Visual Studio Code Python terminal.
but in my code, I have this error:
and when I run the application, I am getting this error:
Why I am getting this error?
it may be the reason for the environment. please check the correct environment is select or not while running the code.
I Think you have installed in different environments and running the code in different environments.

Started using Visual Studio Code v 1.42.1 instead of Anaconda Spyder. Openpyxl 'no module found' in VSC

Openpyxl works fine in Anaconda but in Visual Studio Code I am receiving the following error:
ModuleNotFoundError: No module named 'openpyxl'.
When I install it, it shows already installed.
C:\Users\XXXXXXX>pip install openpyxl
Requirement already satisfied: openpyxl in c:\programdata\anaconda3\lib\site-packages (3.0.0)
Requirement already satisfied: jdcal in c:\programdata\anaconda3\lib\site-packages (from openpyxl) (1.4.1)
Requirement already satisfied: et-xmlfile in c:\programdata\anaconda3\lib\site-packages (from openpyxl) (1.0.1)
Does anyone have any solutions to get this to work in VS Code?

cannot install and use module 'openpyxl' in Python 3.7

For the life of me, I cannot install and use module 'openpyxl' in Python 3.7 / Windows / and Anaconda.
When I try to run and or debug my program I am consistently error-ed out on:
import openpyxl
ModuleNotFoundError: No module named 'openpyxl'
Although within my Terminal or Anaconda Prompt: It says its installed and requirements already met. i.e. the below
Requirement already satisfied: openpyxl in c:\users\MYSELF\appdata\local\continuum\anaconda3\lib\site-packages (2.6.2)
Requirement already satisfied: jdcal in c:\users\MYSELF\appdata\local\continuum\anaconda3\lib\site-packages (from openpyxl) (1.4)
Requirement already satisfied: et-xmlfile in c:\users\MYSELF\appdata\local\continuum\anaconda3\lib\site-packages (from openpyxl) (1.0.1)
(base) C:\MYSELF\language\python\MLTSS-PDF-Split>pip install openpyxl
Requirement already satisfied: openpyxl in c:\users\MYSELF\appdata\local\continuum\anaconda3\lib\site-packages (2.6.2)
Requirement already satisfied: jdcal in c:\users\MYSELF\appdata\local\continuum\anaconda3\lib\site-packages (from openpyxl) (1.4)
Requirement already satisfied: et-xmlfile in c:\users\MYSELF\appdata\local\continuum\anaconda3\lib\site-packages (from openpyxl) (1.0.1)
(base) C:\gitViews\language\python\MLTSS-PDF-Split>pip3 install openpyxl
Requirement already satisfied: openpyxl in c:\users\MYSELF\appdata\local\continuum\anaconda3\lib\site-packages (2.6.2)
Requirement already satisfied: et-xmlfile in c:\users\MYSELF\appdata\local\continuum\anaconda3\lib\site-packages (from openpyxl) (1.0.1)
Requirement already satisfied: jdcal in c:\users\MYSELF\appdata\local\continuum\anaconda3\lib\site-packages (from openpyxl) (1.4)
I have tried uninstalling and reinstalling, I have tried using pip and pip3.
I have tried using trusted host.
I get no error on the import line within Visual Studio Code; i.e.
import openpyxl
Why cannot use this module ?
As discussed in comments it seems like this may be related to a pathing issue that you are experiencing within Visual Studio Code.
My suggestion would be using the documentation from them to ensure you are pointing to your local version of python and not a virtual environment which may not have openpyxl installed.
https://code.visualstudio.com/docs/python/environments

Categories