whaledotpy
whaledotpy

Reputation: 91

Can't install matplotlib to pycharm

I have recently started to learn python programming using Python Crash Course. I am stuck as I can't get matplotlib to work in pycharm.

I have pip installed. I have installed matplotlib using pip via command prompt.

Now, when I open pycharm and go file->settings->project interpreter->download packages and find and press install for matplotlib, I get an error: Command "python setup.py egg_info" failed with error code 1 in C:\Users\Tony\AppData\Local\Temp\pip-install-f2h0rvbb\matplotlib\ . When installing on pycharm it says its using cached file from website I didn't download my matplotlib from.

I have tried "pip install matplotlib" from pycharm terminal and get the same error.

I have tried typing "pip install matplotlib" from cmd and it does so and says its already satisfied.

Any help or guidance would be appreciated, thanks.

Upvotes: 4

Views: 18980

Answers (5)

Ratnesh Tripathi
Ratnesh Tripathi

Reputation: 1

if you installed matplotlib frm cmd, run it using the terminal in pycharm. type in: python -u "path_to_your_file" (you can copy the path from output console after you run the script).

e.g.,

python -u "c:\Users\yourname\PycharmProjects\project_folder_name\your_script.py" note: it's important you have the library installed in your project folder

Upvotes: -1

Janvi Sinha
Janvi Sinha

Reputation: 11

I was facing a similar issue, and despite trying everything it seemed to be not working.

Changing my Python OS from 32-bit to 64-bit resolved the issue for me.

Upvotes: 1

Lokesh Grandhe
Lokesh Grandhe

Reputation: 1

Other way this worked for me.

Check for pip version if it's latest the downgrade it and then install matplotlib

Upvotes: 0

Aditya Sahu
Aditya Sahu

Reputation: 63

Although little late to answer but changing version for python from 3.8 to 3.7 worked for me.

Upvotes: 1

whaledotpy
whaledotpy

Reputation: 91

Managed to get it to work by typing into pycharm terminal:

pip install updates

Then I went to file->settings->project interpreter-> then found pip via search and updated it again to be more sure. Once pip version on left hand side of column in file->settings->project interpreter showed the version to be the newest 20.0.2 which was == to the right hand side(latest version) column it was 100% updated. This can be done also by pressing the upgrade button just above the 'show early releases' button which looks like an eye just to the right of the right hand side column when you have already clicked on the package.

To finish I went file->settings->project interpreter-> found matplotlib and installed package successfully.

Overall I think that not having an up to date version of pip being used for pycharm and having to update the one specifically for use in pycharm is responsible not being able to install matplotlib. Although it could have also been due to having downloaded pip separately elsewhere on my system trying to solve this problem and when I have updated pip before from cmd.exe it didn't update the correct version of pip which I am using for Pycharm.

Upvotes: 5

Related Questions