matplotlib module not found using jupyter notebook - matplotlib

I'm just trying to import matplotlib.pyplot using a jupyter notebook. I get the attached error. I have a hunch it has something to do with pip / matplotlib not being in the correct folder / environment but I don't know how to set up my environment so that it can access pip and all of the python modules that are pre-installed!
I moved the entire python folder into the folder I activated jupyter notebook out of, but then nothing else worked.
import matplotlib.pyplot as plt
I expected no response (successful) but got:
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
The notebook is trusted, when I run I get a terminal response that looks like:
Starting buffering for 25c7e3d9-8a1c-486d-848e-0fe7e0298dc7:02a1acc4bbb84ca88e1eb4ec9aa13576

Related

Why is import pandas giving me an error message?

Hi I have installed pandas into my virtual environment in VS Code. I can import other modules that came when pip installed pandas(numpy) but it gives me:
Traceback (most recent call last):
File "/Users/aidan/VS_Studios/Graphing Data/main.py", line 2, in <module>
import pandas as pd
ImportError: No module named pandas
When I try and import pandas into my main.py file. This is my virtual environment:
I have wheels installed and have python running on 3.11.8 and everything is local.
Please help thank you!
I have tried unistalling pandas and checking to see if both my interpreter pip and python are all on the same version, they are. IDK what else I need to do.

pandas and matplotlib not found on my tensorflow conda environment

I use a MacBook pro-2015, and I use the monetary.
I was able to pip install tensorflow to a new conda environment, but after it, pandas and matplotlib was no longer found.
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import pandas as pd
Below is the traceback of error:
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 2
1 import numpy as np
----> 2 import matplotlib.pyplot as plt
3 import tensorflow as tf
4 import pandas as pd
ModuleNotFoundError: No module named 'matplotlib'
I have been able to solve this problem
I created a conda environment "myenv" where I installed tensorflow
Then I activated the conda environment in my terminal using
conda activate myenv
Then I installed the packages/libraries that I need
conda install pandas
conda install matplotlib
Just use this method to install any package into any environment you are working on

ImportError Pandas in Jupiter notebook - Not looking at venv packages

I installed pandas via pip in my virtualenv venv.
When I run import pandas as pd, I get the following error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-588656c123e4> in <module>
3 import tarfile #2
4 from six.moves import urllib #3
----> 5 import pandas as pd #4
ModuleNotFoundError: No module named 'pandas'
I am running Jupiter notebook in the virtual environment. To make sure it installed properly, I opened the python in the virtualenv and ran the import, and it worked fine, what could be the issue? Could it be that though I ran Jupiter Notebook in my venv its not looking at the packages in the virtual environment?
Edit 1: I installed pandas on my machine, not in the virtual machine, and that resolved my issue. However, I want the notebook to look at the packages in my virtual environment, how do I do that?
Try running this in a Jupyter cell
!pip install pandas

ImportError: No module named pandas [pycharm] python 3.7

I write the code like this:
import pandas as pd
import quandl
df = quandl.get('WIKI/GOOGL')
print(df.head())
and I have the error as below
C:\Users\Administrator\PycharmProjects\untitled1\venv\Scripts\python.exe C:/Users/Administrator/PycharmProjects/untitled1/regression.py
Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/untitled1/regression.py", line 1, in
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
Process finished with exit code 1
I tried to test many recommendations from the internet, but I cannot fix this error. Please help me! Thank you so much.
If you are using bare python install pandas using pip "pip install pandas", If you are using anaconda, check your python interpreter from pycharm. Go to File->Settings->Project Settings->Project Interpreter->Python Interpreters Ensure to select correct version of python.exe e.g C:\Program Files\Python37\python.exe for bare python (For this you need to install pandas ) For anaconda you'll see C:\Users\xxx\AppData\Local\Continuum\anaconda3\python.exe. select the correct interpreter and you are good to go

AttributeError: module 'matplotlib' has no attribute 'pyplot'

I am running Anaconda 4.2.9 and Python 3.5.2 on MacOS 10.12. Whenever I try the simple command
import matplotlib.pyplot as plt
I get the following error message
[1]: import matplotlib.pyplot as plt
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt
/Users/ghoetker/anaconda/lib/python3.5/site-packages/matplotlib/pyplot.py in <module>()
8 import matplotlib
9
---> 10 import matplotlib.pyplot as plt
11 import matplotlib.animation as manimation
12
AttributeError: module 'matplotlib' has no attribute 'pyplot'
I get this error whether I use iPython, a Jupyter Notebook, PyCharm, Spyder or Rodeo. I've used conda to uninstall and reinstall matplotlib to no avail. The really odd thing is that it worked once this morning, but hasn't since. I'm not aware of anything I changed in the interim. I've found that if I downgrade to matplotlib 1.5.1, it works just fine. However, that requires some more meaningful downgrades, like going from Spyder 3 to Spyder 2. So, I'd really like to figure out how to use the current version of matplotlib.
I would really appreciate any recommendations or pointers anyone can provide. Obviously, I'm happy to provide any additional information that would help with debugging.
I tried the following sequence of commands and it worked for me:
conda uninstall pyzmq
conda install pyzmq
conda install jupyter