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
Related
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/
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
I need help understanding whats wrong here.
I will try to explain this as best I can, but Im a bit new to PythonAnywhere. I get this error:
Traceback (most recent call last):
File "/home/HelliottChip/mysite/app/__init__.py", line 6, in <module>
from flask_migrate import Migrate
ModuleNotFoundError: No module named 'flask_migrate'
When trying to run my main.py file. But i have them all installed as shown in this code:
17:14 ~/.local/bin $ pip install Flask-SQLAlchemy email_validator flask-mail pyjwt flask-bootstrap flask-moment
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2
.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in links: /usr/share/pip-wheels
Requirement already satisfied: Flask-SQLAlchemy in /usr/local/lib/python2.7/dist-packages (2.4.1)
Requirement already satisfied: email_validator in /home/HelliottChip/.local/lib/python2.7/site-packages (1.1.2)
Requirement already satisfied: flask-mail in /usr/local/lib/python2.7/dist-packages (0.9.1)
Requirement already satisfied: pyjwt in /usr/local/lib/python2.7/dist-packages (1.7.1)
Requirement already satisfied: flask-bootstrap in /usr/local/lib/python2.7/dist-packages (3.3.7.1)
Requirement already satisfied: flask-moment in /home/HelliottChip/.local/lib/python2.7/site-packages (0.11.0)
Requirement already satisfied: Flask>=0.10 in /usr/local/lib/python2.7/dist-packages (from Flask-SQLAlchemy) (1.1.1)
Requirement already satisfied: SQLAlchemy>=0.8.0 in /usr/local/lib/python2.7/dist-packages (from Flask-SQLAlchemy) (1.3.10)
Requirement already satisfied: idna>=2.0.0 in /usr/local/lib/python2.7/dist-packages (from email_validator) (2.8)
Requirement already satisfied: dnspython>=1.15.0 in /home/HelliottChip/.local/lib/python2.7/site-packages (from email_validator) (1.16.0)
Requirement already satisfied: blinker in /usr/local/lib/python2.7/dist-packages (from flask-mail) (1.4)
Requirement already satisfied: dominate in /usr/local/lib/python2.7/dist-packages (from flask-bootstrap) (2.4.0)
Requirement already satisfied: visitor in /usr/local/lib/python2.7/dist-packages (from flask-bootstrap) (0.1.3)
Requirement already satisfied: itsdangerous>=0.24 in /usr/local/lib/python2.7/dist-packages (from Flask>=0.10->Flask-SQLAlchemy) (1.1.0)
Requirement already satisfied: Jinja2>=2.10.1 in /usr/local/lib/python2.7/dist-packages (from Flask>=0.10->Flask-SQLAlchemy) (2.10.3)
Requirement already satisfied: click>=5.1 in /usr/local/lib/python2.7/dist-packages (from Flask>=0.10->Flask-SQLAlchemy) (7.0)
Requirement already satisfied: Werkzeug>=0.15 in /usr/local/lib/python2.7/dist-packages (from Flask>=0.10->Flask-SQLAlchemy) (0.16.0)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib/python2.7/dist-packages (from Jinja2>=2.10.1->Flask>=0.10->Flask-SQLAlchemy) (0.23)
I have gone down about every website I can find on how to fix this, but I'm lost. This is for a Flask app I have worked on for a while on Replit.com and it worked fine until the transfer to PythonAnywhere. I have been trying to get this out for around two weeks now ^~^ but yet still no luck to my avail. I used a lot of this guide to help me with it, as I am also practicing my web deployment skills. (Don't need judgment on the fact I'm using flask -3-) But could anyone take thier time to help me with this? If you can, thanks a lot.
Check if your web app on PythonAnywhere is set up to be run by Python 2.7 -- I see you're using pip install outside of a virtual environment which by default will use pip for Python 2.7 as you can see in the output (btw. it won't work on PythonAnywhere, you need to provide --user option). If you want to install packages outside of virtual environment for different version of Python, use pipX.X install --user ... (where X.X should be replaced by required Python version). Also, remember to reload the web app every time the setup is changed. And if you're really stuck, maybe try contacting PythonAnywhere support (support#pythonanywhere.com) or use their forums?
Hello #TutorialWarrior9776 my suggestion is:
Step 1:
Install virtualenv,
pip install virtualenv
Step 2:
Create env
virtualenv -p python3.8 NAME_ENV
Step 3:
Activate env and Install requirements.txt (file generated local machine contains module flask_migrate)
source NAME_ENV/bin/active
pip install -r requirements.txt
Step 4:
Set your env path in the section (web) of pythonanywhere, that's all;
https://help.pythonanywhere.com/pages/Virtualenvs/
(Section: Step 3: Configure your app to use this virtualenv)
Hope this helps ;)
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.
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