How do I install matplotlib on pyCharm [duplicate] - python

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.

Related

What can I do to install Pygame? [duplicate]

This question already has answers here:
How to install pygame?
(4 answers)
Unable to install Pygame using pip
(27 answers)
Closed 22 days ago.
I can't use pygame package in Pycharm. I have installed it with pip but I can not use it. When I tried to install it from the error that appeared in the IDE or from 'Python Packages', it gave me an error. I also tried pip install pygame --pre and it's not working. It says that 'Requirement already satisfied:' but I still can not use it. What should I do?
You should be able to left click on the module. It will display a download packages button. You need internet but should be able to download it. You don't to use the command prompt to install packages. That is only for the python IDLE.
Go here and click install. Pycharm using his own registry of packages.
https://imgur.com/a/AZvsBxJ
So, you're using PyCharm, it likely means it has created a new virtual environment when you created your project, to install packages in that environment it's easiest to either use PyCharm's Package Manager or Terminal. In the case of using Python 3.11 you'd need to supply the --pre flag when installing pygame because the full release of 2.1.3 has not yet been released and 2.1.3.dev8 which is a pre release is the latest one that has 3.11 wheels for installation. More information about that particular thing can be found here: https://stackoverflow.com/a/74188087/14531062
So, on PyCharm you'd want to use the Terminal:
When you switch to it, you'll likely find that it basically is PowerShell (unless you have changed it to use CMD which I doubt) (you'll see PS at the start of each line) so the easiest steps to install pygame would be to type in these commands in this order (press the enter key after each line):
cmd
venv\scripts\activate
pip install pygame --pre
After running these commands pygame should be installed in the correct environment and you should be able to import it without any issues.
Screenshot of how it might look when you follow the steps:

Error trying to install matplotlib in Windows [duplicate]

This question already has answers here:
Cannot install Matplotlib on Python 3.10
(2 answers)
Closed 1 year ago.
I'm trying to install matplotlib for Python 3.10 in Windows. Im using pip: pip install matplotlib I've already installed NumPy, Cython, Pillow and other libraries needed. But it shows this error:
error: Failed to download any of the following: ['http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz']. Please download one of these urls and extract it into 'build/' at the top-level of the source repository.
I've downloaded the said library and copied it in .cache/matplotlib/build but it doesnt work.
Any idea?
So as #FlyingTeller commented, there are no stable realeses of matplotlib so using --pre fixed the problem.

Unable to install pyodbc and win32API [duplicate]

This question already has answers here:
PyCharm doesn't recognize installed module
(23 answers)
Closed 1 year ago.
I am using Python 3.9.6 with Pycharm. I need to install the packages pyodbc and win32api. Though I have installed it, reinstalled it multiple times, it still says module not found. I have installed the MS build tools, tried with multiple versions of python such as 3.9.5 and 3.8, restarted pycharm invalidating caches. Changed the interpretes to virtual environment and the system interpreter. When i run the command pip install pyodbc, it says requirement already satisfied which means it is already installed.
See if pycharm is using another virtual environment

pip install pyodbc is not working on python [duplicate]

This question already has answers here:
Why does "pip install" inside Python raise a SyntaxError?
(7 answers)
Closed 2 years ago.
I installed Python on my Windows 10 computer
when I try to run my python code
I get error
ModuleNotFoundError: No module named 'pyodbc'
I checked multiple questions here and the solution is to pip pyodbc
I tried that
pip install pyodbc
but i get error
SyntaxError: invalid syntax
I checked similar propblems here and it seems that pip is not installed.
I unistalled and reinstalled python from python.org and still same issue!
any solution?
Edit
I did as suggested to try from command prompt
but still same error
I installed Python with ticking the option to include environment variables option.
Edit 2 :
I think the problem was that I was trying to install from witthin python.
I misunderstood the answers, I have to run pip as an application outside of python. to allocate pop.exe and then do pip install.
You are trying to install the package from python interpreter (IDLE) which is wrong. You should only import package from IDLE terminal (python session) which IDLE has access to.
Try this link to install the package --> https://pip.pypa.io/en/latest/installing/
You would run pip from a shell, not from the IDLE. However, pyodbc requires the Microsoft ODBC Driver. More information about installing the pyodbc module can be seen in this guide. This Stack Overflow answer can also help.
Normally, you run pip from a shell, not from a Python interactive session.
C:\PATHTOPYTHON\python.exe pip install <<SOMEPACKAGE>>
See the following thread, if you want to install from within a Python interactive session.

problem arising while installing pandas library in python [duplicate]

This question already has answers here:
'pip' is not recognized as an internal or external command
(40 answers)
Closed 3 years ago.
i am installing pandas for python on windows 10.
this is the code i am typing in cmd:
pip install pandas
normally this should have led to the installation of pandas. however, i am getting the following error in cmd:
C:>pip install pandas
'pip' is not recognized as an internal or external command,
operable program or batch file.
i have installed anaconda before.
I would first guess that pip is not installed. Which version of Python are you using? Is python set in your path correctly?
If python 3, pip should be installed, not always the case with python 2. You can use this
https://bootstrap.pypa.io/get-pip.py. This should set you straight.
OS : Widwos
Follow the link "https://www.liquidweb.com/kb/install-pip-windows/" to install pip

Categories

Resources