matplotlib error in notebook :No module named 'matplotlib' [duplicate] - python

This question already has answers here:
jupyter notebook import error: no module named 'matplotlib'
(8 answers)
Closed 1 year ago.
when I import matplotlib in my jupyter notebook it dose not work and this is its error:
enter image description here
can anyone help me what is wrong in my code?

enter image description hereTry these things on your Anaconda Prompt terminal:
pip -V <- The version of pip will be displayed, if it is successfully installed on your system. Then we will try to upgrade it.
pip install --upgrade pip <- do this to upgrade your pip, if it is already upgraded then it will show it.
pip install matplotlib <- then write this command if still doesn't work let me know in the comments

have you even installed the lib?
you can install it with
python -m pip install -U matplotlib

Related

I am trying to install pygame using pycharm terminal but I get this error [duplicate]

This question already has answers here:
Unable to install Pygame using pip
(27 answers)
Closed last month.
I was trying to install pygame module using pycharm's terminal by typing "pip install pygame" but I am getting this errorinstallation error and yes I have tried running pycharm with admin perms and stuff but it did not work, if you can help then ty!
I just tried to use pygame by typing in my .py file "import pygame" but it say "no module called pygame" and I was simply trying to get a blank window
just upgraded Python to latest version updated pip by using,
pip install --upgrade pip
after that simply run
pip install pygame
Make sure you are using the correct version of python and pygame that both are compatible with each other.
Seems like you don't have admin privilege. Try to open the command prompt with Run as administrator mode or pip install numpy --user

Problem installing PyQtChart module in python 3.7 [duplicate]

This question already has answers here:
Cannot import PyQtChart in Python 3.7
(2 answers)
Closed 2 years ago.
I am trying to install the PyQtChart module for embedded graphics in PyQt5, for this I do the traditional procedure:
windows + R
pip install PyQtChart
The problem is that when doing so, I get the following errors, and the module is not installed, attached image:
For my works I use the editor 'Spyder', which comes when I install anaconda.
If someone has had a similar problem or knows how to solve this type of problem, I would greatly appreciate it, kind regards.
You have to have the same version of PyQt5 and PyQtChart installed:
python -m pip install PyQt5==5.15 PyQtChart==5.15
Also, try to install from windows power shell(admin) mode
Verify that the version of PyQtChart is the same that PyQt5:
python -m pip install PyQt5==5.13 PyQtChart==5.13

How do I install matplotlib on pyCharm [duplicate]

This question already has answers here:
Can't install matplotlib to pycharm
(3 answers)
Closed 2 years ago.
I'm new to python and I'm using PyCharm as my IDE. I've been able to successfully install other packages like numpy, pandas etc. However, when I'm installing matplotlib, I keep getting the error:
src/checkdep_freetype2.c(5): fatal error C1189: #error: "FreeType version 2.3 or higher is required. You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib download it."
I installed it through the command prompt and it installed correctly but (I believe) PyCharm creates it's own environment and does not recognize packages installed through command prompt even though I tried to install them in the same path as other packages in PyCharm. Can you please help?
I had to run the command "pip install updates" and after that I could install the matplotlib package. It turns out that my pip wasn't of the latest version.

Installing matplotlib on windows 10 python 3.6

HI I am following an install from a book "Python Crash Course" chapter 15 which directed me to install matplotlib via downloading from pypi and using the format
python -m pip install --user matplotlib-2.2.2-cp36-cp36m-win32.whl
This seems to go ok but reports at the end.
File "C:\Program Files (x86)\Python Community\Python 3.6.1\lib\decimal.py", line 3 in , from decimal import *
AttributeError: module 'numbers' has no attribute 'Number'
and when I enter an interactive shell:
import matplotlib
I get a ModuleNotFoundError
I have tried a matplotlib-2.2.2-cp36-cp36m-win32.whl and matplotlib-2.2.2-cp36-cp36m-win_amd64.whl both give the same error.
Could someone please let me know how to fix this?
I am answering my own question.
The issue was to do with a file called numbers.py residing in a folder that I have all my python files, wheel files etc.
I found the answer in stack overflow. I will link to this matplotlib - AttributeError: module 'numbers' has no attribute 'Integral'.
The file was stopping the install so I renamed it and reinstalled matplotlib and it now works.
Sorry but this was not obvious to me !
Try running cmd as administrator inside the python directory. Then execute:
pip3 install matplotlib-2.2.2-cp36-cp36m-win32.whl
Also make sure that you have all dependencies installed.
The code seems very specific and something may not be supported any more.
You could first uninstall the current version using:
pip uninstall matplotlib
and then try installing matplotlib as follows:
pip install matplotlib
providing that you have admin rights to do so.
Then you can import as: import matplotlib.pyplot as plt
It seems like you are installing the package on Python 2.
Try installing the library using:
py -3 -m pip install --user matplotlib
Assuming you are using Windows.
Try doing as below:
python -m pip install --user matplotlib

Trying to install psycopg2 in PyCharm [duplicate]

This question already has answers here:
Why isn't PyCharm's autocomplete working for libraries I install?
(2 answers)
Closed 7 years ago.
I have been trying to install psycopg2 in PyCharm, but I keep running into this error:
>>> pip install psycopg2
File "<input>", line 1
pip install psycopg2
^
SyntaxError: invalid syntax
I've already managed to install psycopg2 in a virtualenv outside of PyCharm. However, PyCharm doesn't recognize that installation, and it seems that I have to install it separately from inside PyCharm. As a result when I run the project in PyCharm I get this error: ImportError: No module named 'psycopg2'. I'm a beginner to PyCharm--and, frankly, to Python development--so any help would be greatly appreciated.
Given your use of '>>>', it appears that you are trying to install psycopg2 from within Python. Exit the Python shell and run the command.
If you are in IPython, you can prepend your command with an exclamation to run it as a command instead of as Python code:
In[1]: !pip install psycopg2
Try
$ pip install psycopg2==2.4.5
or
$ pip install http://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.4.tar.gz

Categories

Resources