3

I have to install python package "matplotlib" in Python 2.7; Ubuntu 16.04 After inserting:

pip install matplotlib

I get the following error messagge: open here error picture I tried this solution:

sudo apt-get install libfreetype6-dev libxft-dev

but I got this error:

"Lettura elenco dei pacchetti... Fatto Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto E: Impossibile trovare il pacchetto libfreetype6-dev E: Impossibile trovare il pacchetto libxft-dev"

Alice
  • 131
  • Please copy and paste output and error messages from the terminal to your question above. Do not post screenshots of the text. – user68186 Apr 23 '18 at 15:01
  • No reason to install/build matplotlib with pip. This will do : sudo apt update && sudo apt install python-matplotlib – Knud Larsen Apr 23 '18 at 15:15
  • It returns error : Impossible to find python-matplotlib package, maybe I choose a wrong directory? – Alice Apr 24 '18 at 10:29

2 Answers2

2
  1. Check in Software & Updates -> Ubuntu Software tab that the 2nd software source universe is enabled.

  2. The currently supported releases of Ubuntu are 14.04, 16.04 and 17.10. If you are not running a currently supported release, see the answers to this question: How to install software or upgrade from an old unsupported release?.

Matplotlib is available in the default Ubuntu repositories in all currently supported versions of Ubuntu. To install Matplotlib open the terminal and type:

sudo apt update  
sudo apt upgrade  
sudo apt install python-matplotlib # for Python 2.x in 18.04 and earlier

or

sudo apt update  
sudo apt upgrade  
sudo apt install python3-matplotlib # for Python 3.x 

Other related packages are python-matplotlib-data python-matplotlib-dbg python-matplotlib-doc and python-matplotlib-venn for Python 2.x and python3-matplotlib-dbg python3-matplotlib-venn for Python 3.x.

karel
  • 114,770
  • It returns error : Impossible to find python-matplotlib package – Alice Apr 24 '18 at 10:29
  • thanks for your answer, unfortunately universe is already enabled. Could it be that I'm working on a wrong directory? – Alice Apr 24 '18 at 11:41
0

Install python dev file by typing:

sudo apt install python-dev

Then proceed

  • They should probably use the matplotlib from the repositories before trying to install from pip. The only reason they'd have to build from pip is if they absolutely must have the newer libraries. – Thomas Ward Apr 23 '18 at 15:20