So I have Python 3 and matplotlib installed globally. If I run python outside of a virtual environment and import matplotlib to check the version it shows 1.5.1 . But I am facing problems installing matplotlib within a virtual environment. I created a virtual environment using the command python3 -m venv ds and activated ds. These are the contents of my requirements.txt
matplotlib==1.4.2
numpy==1.9.1
When I do pip3 install -r requirements.txt I get this
Collecting matplotlib==1.4.2 (from -r requirements.txt (line 1))
Using cached matplotlib-1.4.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setup.py", line 155, in <module>
result = package.check()
File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setupext.py", line 962, in check
min_version='2.3', version=version)
File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setupext.py", line 446, in _check_for_pkg_config
if (not is_min_version(version, min_version)):
File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setupext.py", line 174, in is_min_version
return found_version >= expected_version
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/version.py", line 70, in __ge__
c = self._cmp(other)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/version.py", line 337, in _cmp
if self.version < other.version:
TypeError: unorderable types: str() < int()
IMPORTANT WARNING:
pkg-config is not installed.
matplotlib may not be able to find some of its dependencies
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.4.2]
python: yes [3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015,
21:12:44) [GCC 4.2.1 (Apple Inc. build 5666) (dot
3)]]
platform: yes [darwin]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.10.4]
six: yes [using six version 1.10.0]
dateutil: yes [dateutil was not found. It is required for date
axis support. pip/easy_install may attempt to
install it after matplotlib.]
pytz: yes [pytz was not found. pip will attempt to install
it after matplotlib.]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [pyparsing was not found. It is required for
mathtext support. pip/easy_install may attempt to
install it after matplotlib.]
pycxx: yes [Official versions of PyCXX are not compatible
with matplotlib on Python 3.x, since they lack
support for the buffer object. Using local copy]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib
You are using pip version 7.1.2, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
How should I install matplotlib version 1.4.2 in virtual environment ?
My question has been marked as duplicate but that link doesn't solve my question. The solution given is for Ubuntu
I was able to do it by solving the dependencies for matplotlib,
(if you have brew installed)
then first do brew install freetype followed by brew install ttfautohint --with-qt. After that try again to pip install.
You can use the system package in your virtualenv with this option.
Otherwise, this SO post may help you.
Related
I am able to generate *.dat file:
vikas#server:~/memory_profiler-0.36$ ./mprof run --python test_sl.py
vikas#server:~/memory_profiler-0.36$ ls *.dat
mprofile_20151001035123.dat
But when I am trying to plot graph then it is saying "matplotlib is needed for plotting"
vikas#server:~/memory_profiler-0.36$ ./mprof plot --output=plot.png
matplotlib is needed for plotting.
Did I miss anything?
Function I am profiling is run() which is inside: file_to_be_profiled.py
#!/usr/bin/python
import time
import os, sys, commands
from memory_profiler import profile
from guppy import hpy
#profile
def run():
d = {}
l = []
hp = hpy()
before = hp.heap()
d["k1"] = 'val1'
d["k2"] = 10
count = 0
while (count < 9):
l.append(count)
print 'The count is:', count
count = count + 1
print "Good bye!"
after = hp.heap()
leftover = after - before
print leftover
if __name__ == '__main__':
sys.exit(run())
And I am invoking run() from my test script: test_sl.py:
#!/usr/bin/python
import commands
# for the time being I am running my test to profile method: run() inside file_to_be_profiled.py
run_cmd = './file_to_be_profiled.py
commands.getstatusoutput(run_cmd)
I am running on ubuntu machine. But apt-get install did not worked for me. Then I did the install from source. But then also I am getting same error.
apt-get failed:
vikas#server:~/memory_profiler-0.36$ sudo apt-get install -y python-matplotlib
[sudo] password for vikaskuk:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-matplotlib is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-matplotlib' has no installation candidate
vikask#server:~/memory_profiler-0.36$ ./mprof plot --output=plot.png
matplotlib is needed for plotting.
Then I attempted pip install... which also did not go through:
vikas#server:~/memory_profiler-0.36$ pip install matplotlib
Downloading/unpacking matplotlib
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement matplotlib
Cleaning up...
No distributions at all found for matplotlib
Storing debug log for failure in /home/vikaskuk/.pip/pip.log
Finally I tried installing from source which seems to be succeeded:
vikas#server:~/memory_profiler-0.36$ cd ../matplotlib
vikas#server:~/matplotlib$ cd matplotlib-master/
(virtualenv)vikaskuk#beehive:~/matplotlib/matplotlib-master$ vi INSTALL
(virtualenv)vikaskuk#beehive:~/matplotlib/matplotlib-master$ python setup.py build
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.5.dev1]
python: yes [2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC
4.4.5]]
platform: yes [linux2]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [not found. pip may install it below.]
six: yes [using six version 1.5.2]
dateutil: yes [using dateutil version 2.1]
pytz: yes [pytz was not found. pip will attempt to install
it after matplotlib.]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [pyparsing was not found. It is required for
mathtext support. pip/easy_install may attempt to
install it after matplotlib.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype2 (ft2build.h)
could not be found. You may need to install the
development package.]
png: no [pkg-config information for 'libpng' could not
be found.]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [using nose version 1.3.0 / using mock 1.0.1]
toolkits_tests: yes [using nose version 1.3.0 / using mock 1.0.1]
OPTIONAL BACKEND EXTENSIONS
macosx: no [Mac OS-X only]
qt5agg: no [PyQt5 not found]
qt4agg: no [PySide not found; PyQt4 not found]
gtk3agg: no [Requires pygobject to be installed.]
gtk3cairo: no [Requires cairocffi or pycairo to be installed.]
gtkagg: no [Requires pygtk]
tkagg: no [The C/C++ header for Tk (tk.h) could not be
found. You may need to install the development
package.]
wxagg: no [requires wxPython]
gtk: no [Requires pygtk]
agg: yes [installing]
cairo: no [cairocffi or pycairo not found]
windowing: no [Microsoft Windows only]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: yes [version 8.71]
latex: yes [version 3.1415926]
pdftops: no
============================================================================
* The following required packages can not be built:
* freetype, png
(virtualenv)vikaskuk#beehive:~/matplotlib/matplotlib-master$ python setup.py install
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.5.dev1]
python: yes [2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC
4.4.5]]
platform: yes [linux2]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [not found. pip may install it below.]
six: yes [using six version 1.5.2]
dateutil: yes [using dateutil version 2.1]
pytz: yes [pytz was not found. pip will attempt to install
it after matplotlib.]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [pyparsing was not found. It is required for
mathtext support. pip/easy_install may attempt to
install it after matplotlib.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype2 (ft2build.h)
could not be found. You may need to install the
development package.]
png: no [pkg-config information for 'libpng' could not
be found.]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [using nose version 1.3.0 / using mock 1.0.1]
toolkits_tests: yes [using nose version 1.3.0 / using mock 1.0.1]
OPTIONAL BACKEND EXTENSIONS
macosx: no [Mac OS-X only]
qt5agg: no [PyQt5 not found]
qt4agg: no [PySide not found; PyQt4 not found]
gtk3agg: no [Requires pygobject to be installed.]
gtk3cairo: no [Requires cairocffi or pycairo to be installed.]
gtkagg: no [Requires pygtk]
tkagg: no [The C/C++ header for Tk (tk.h) could not be
found. You may need to install the development
package.]
wxagg: no [requires wxPython]
gtk: no [Requires pygtk]
agg: yes [installing]
cairo: no [cairocffi or pycairo not found]
windowing: no [Microsoft Windows only]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: yes [version 8.71]
latex: yes [version 3.1415926]
pdftops: no
============================================================================
* The following required packages can not be built:
* freetype, png
But when I try to plot the graph I hit the original issue:
vikas#server:~/matplotlib/matplotlib-master$ cd ../../memory_profiler-0.36
vikas#server:~/memory_profiler-0.36$ ./mprof plot --output=plot.png
matplotlib is needed for plotting.
I was able to successfully do apt-get update(there was some firewall issue and then I successfully did: sudo apt-get install -y python-matplotlib.
But still I am getting some issue while running mprof:
vikas#server:~/memory_profiler-0.36$ ./mprof plot --output=plot.png
Using last profile data.
Traceback (most recent call last):
File "./mprof", line 494, in <module>
actions[get_action()]()
File "./mprof", line 454, in plot_action
pl.figure(figsize=(14, 6), dpi=90)
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 423, in figure
**kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 79, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 87, in new_figure_manager_given_figure
window = Tk.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
Why do I need to set the display? I am working on ubuntu hosted machine.
You need to install matplotlib, as instructed (this error in thrown by mprof when it can't find matplotlib).
You can do so using pip pip install matplotlib (you might need to prefix this with sudo) or your package manager:
sudo apt-get install -y python-matplotlib on Debian, Ubuntu and derivatives.
sudo yum install -y python-matplotlib on RHEL, CentOS and derivatives.
It seems matplotlib: 3.0.1 does not go well with python 3.7 in conda environment.
df.plot() command could not be executed properly showing "ImportError: matplotlib is required for plotting" but actually matplotlib is installed.
I tried to downgrade matplotlib to 3.0.0 then everything is fine.
conda install -n [your_conda_envionment] matplotlib==3.0.0
I had same problem on freshely installed Ubuntu 16.04. To solve it, I have installed SciPy like this:
sudo pip install scipy
Also I had to install tkinter lib like this:
sudo apt-get install python-tk
I guess somewhere in the past, matplotlib had scipy as dependency, but now it only has numpy, while mprof plot requires scipy.
I had the same problem. I used memory_profiler lib typing this commands
(mprof run runner.py and mprof plot) and got a message "matplotlib is needed for plotting"
I tried to get rid of this problem following advice I found here but in the result I solved this problem completing these simple steps:
delete files in /usr/lib64/python2.7/site-packages/ connected with matplotlib (or you can uninstall matplotlib using the ordinary way)
use sudo yum-builddep python-matplotlib to install connected packages (222 packages were installed, if you need apt-get, you need this command: sudo apt-get build-dep python-matplotlib)
install matplotlib sudo yum reinstall python-matplotlib (or use install command, with apt-get: sudo apt-get install python-matplotlib)
I believe this will help.
I tried to use GTKAgg as back-end for matplotlib package.
matplotlib.use('GTKAgg')
Failed to enable GUI event loop integration for 'gtk'
Traceback (most recent call last):
File "/home/oshri/.pycharm_helpers/pydev/_pydev_bundle/pydev_console_utils.py", line 569, in do_enable_gui
enable_gui(guiname)
File "/home/oshri/.pycharm_helpers/pydev/pydev_ipython/inputhook.py", line 528, in enable_gui
return gui_hook(app)
File "/home/oshri/.pycharm_helpers/pydev/pydev_ipython/inputhook.py", line 244, in enable_gtk
from pydev_ipython.inputhookgtk import create_inputhook_gtk
File "/home/oshri/.pycharm_helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/oshri/.pycharm_helpers/pydev/pydev_ipython/inputhookgtk.py", line 19, in <module>
import gtk, gobject # #UnresolvedImport
File "/home/oshri/.pycharm_helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: No module named 'gtk'
I tried to install the gtk using conda, using this repo, the conda outputs that the package is installed.
import conda.cli
conda.cli.main('conda','install','-c','ska','pygtk=2.16.0')
Fetching package metadata .............
Solving package specifications: .
# All requested packages already installed.
# packages in environment at /data/anaconda:
#
pygtk 2.16.0 0 ska
When I tried to install the pygtk using pip I got this error.
[oshri#analytics ~]$ pip install pygtk
Collecting pygtk
Using cached pygtk-2.24.0.tar.bz2
Complete output from command python setup.py egg_info:
********************************************************************
* Building PyGTK using distutils is only supported on windows. *
* To build PyGTK in a supported way, read the INSTALL file. *
********************************************************************
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-x78h7u1k/pygtk/
When I tried to use python2.7 I success to import the model.
[oshri#analytics ~]$ /bin/python2.7
Python 2.7.5 (default, Nov 6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
>>> exit()
For this reason I think that the issue is related to the python version.
I tried to use this guide but I didn't succeed to use JHBuild.
[oshri#analytics ~]$ jhbuild build pygobject
Required packages:
System installed packages which are too old:
(none)
No matching system package installed:
itstool
libffi (libffi.pc, required=3.0.0)
python3-devel (python3.pc, required=3.2)
libxslt (libxslt.pc, required=1.1.26)
cairo (cairo.pc, required=1.14.0)
libxml2 (libxml-2.0.pc, required=2.7.8)
jhbuild build: Required system dependencies not installed. Install using the command 'jhbuild sysdeps --install' or to ignore system dependencies use command-line option --nodeps
[oshri#analytics ~]$ jhbuild build sysdeps --install pygobject
Usage: jhbuild build [ options ... ] [ modules ... ]
jhbuild: error: no such option: --install
[oshri#analytics ~]$ jhbuild sysdeps --install pygobject
System installed packages which are new enough:
zlib (zlib.pc, installed=1.2.7)
automake
docbook-xml
docbook-xsl
libtool
pkg-config
cc
make
git
xmlcatalog
bison (required=2.4)
intltool (required=0.50.2)
xmllint
xsltproc
libpcre (libpcre.pc, required=8.31, installed=8.32)
flex (required=2.0)
Required packages:
System installed packages which are too old:
(none)
No matching system package installed:
itstool
libxml2 (libxml-2.0.pc, required=2.7.8)
libxslt (libxslt.pc, required=1.1.26)
cairo (cairo.pc, required=1.14.0)
libffi (libffi.pc, required=3.0.0)
python3-devel (python3.pc, required=3.2)
Optional packages: (JHBuild will build the missing packages)
System installed packages which are too old:
(none)
No matching system package installed:
I: Installing dependencies on system: itstool libxml2 libxslt cairo libffi python3-devel
I: Computing packages to install. This might be slow. Please wait.
I: Installing:
itstool;1.2.0-4.el7;noarch;base
libffi-devel;3.0.13-18.el7;x86_64;base
python34-devel;3.4.5-4.el7;x86_64;epel
cairo-devel;1.14.2-1.el7;x86_64;base
libxml2-devel;2.9.1-6.0.1.el7_2.3;x86_64;ol7_latest
libxslt-devel;1.1.28-5.0.1.el7;x86_64;ol7_latest
I: This might take a very long time. Do not turn off your computer. You can run `pkmon' to monitor progress.
E: PackageKit: Failed to obtain authentication.
I: Complete!
[oshri#analytics ~]$ sudo jhbuild sysdeps --install pygobject
[sudo] password for oshri:
sudo: jhbuild: command not found
I'm right that issues related to python version?
Should I install JHBuild under root user?
Using Python 2.7 on Windows 7. Here is the command I am using to install and error message. Wondering if anyone have met with similar issues before? Thanks.
C:\Python27\Scripts>pip install matplotlib
Collecting matplotlib
Downloading matplotlib-1.5.2.tar.gz (51.6MB)
100% |################################| 51.6MB 19kB/s
Complete output from command python setup.py egg_info:
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.5.2]
python: yes [2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015,
20:40:30) [MSC v.1500 64 bit (AMD64)]]
platform: yes [win32]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.11.1]
dateutil: yes [dateutil was not found. It is required for date
axis support. pip/easy_install may attempt to
install it after matplotlib.]
pytz: yes [pytz was not found. pip will attempt to install
it after matplotlib.]
cycler: yes [cycler was not found. pip will attempt to
install it after matplotlib.]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [pyparsing was not found. It is required for
mathtext support. pip/easy_install may attempt to
install it after matplotlib.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype (ft2build.h)
could not be found. You may need to install the
development package.]
png: no [The C/C++ header for png (png.h) could not be
found. You may need to install the development
package.]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [nose 0.11.1 or later is required to run the
matplotlib test suite. Please install it with pip or
your preferred tool to run the test suite / mock is
required to run the matplotlib test suite. Please
install it with pip or your preferred tool to run
the test suite]
toolkits_tests: yes [nose 0.11.1 or later is required to run the
matplotlib test suite. Please install it with pip or
your preferred tool to run the test suite / mock is
required to run the matplotlib test suite. Please
install it with pip or your preferred tool to run
the test suite]
OPTIONAL BACKEND EXTENSIONS
macosx: no [Mac OS-X only]
qt5agg: no [PyQt5 not found]
qt4agg: no [PySide not found; PyQt4 not found]
gtk3agg: no [Requires pygobject to be installed.]
gtk3cairo: no [Requires cairocffi or pycairo to be installed.]
gtkagg: no [Requires pygtk]
tkagg: yes [installing; run-time loading from Python Tcl /
Tk]
wxagg: no [requires wxPython]
gtk: no [Requires pygtk]
agg: yes [installing]
cairo: no [cairocffi or pycairo not found]
windowing: yes [installing]
OPTIONAL LATEX DEPENDENCIES
dvipng: no
ghostscript: no
latex: no
pdftops: no
OPTIONAL PACKAGE DATA
dlls: no [skipping due to configuration]
============================================================================
* The following required packages can not be built:
* freetype, png
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\foo\a
ppdata\local\temp\pip-build-zxfsow\matplotlib\
As you can see it png and freetype modules are missing. You need to install them separately.
Try doing the following :
> pip install freetype-py
> pip install pypng
> pip install matplotlib
I solved it by taking version 1.5.1
pip install matplotlib==1.5.1
it seems that version 1.5.2 installer is broken.
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Get matplotlib from above location. Choose correct package based on python(2.x/3.x) and bit(32/64) version.
32-bit 2.7: matplotlib-1.5.2-cp27-cp27m-win32.whl
64-bit 2.7: matplotlib-1.5.2-cp27-cp27m-win_amd64.whl
If you face any issues in the middle, please refer to below link:
https://stackoverflow.com/a/38618044/5334188
I had the exact same issue.
Seems that my pip was v7 which is old.
upgraded to v9 with the 'upgrade' button.
then tried to install matplotlib again and was successful this time.
maybe this helps
I came across the same problem with you, and here is my solution
It has the problem with python 3.6 integrated with the newest pip.
so I installed python 3.5.2 with pip, but do not upgrade pip.
And you can get matplotlib installed in this way.
Hope I could provide a possible solution
I solved the same problem in WÄ°ndows 10 as folowing:
1- Download the following files for win32 or win64 python3.7:
matplotlib-2.2.2-cp27-cp37m-win32.whl
or
matplotlib-2.2.2-cp27-cp37m-win_amd64.whl
from the https://www.lfd.uci.edu/~gohlke/pythonlibs/
2- By cmd console run the downloaded file under python:
.\Downloads> python -m pip install matplotlib-2.2.2-cp37-cp37m-win_amd64.whl
you can try the matplolib
I had this problem today with Python 3.8.0 and the installation was successfully with matplotlib==3.2.0rc1 after I installed freetype-py.
Installing the specific matplotlib version 2.2.5 worked for me on Windows 10.
The commmand to install a specific version via pip:
pip install matplotlib==2.2.5
When I try to upgrade my matplotlib using pip, it outputs:
Downloading/unpacking matplotlib from https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.0.tar.gz#md5=1daf7f2123d94745feac1a30b210940c
Downloading matplotlib-1.4.0.tar.gz (51.2MB): 51.2MB downloaded
Running setup.py (path:/tmp/pip_build_root/matplotlib/setup.py) egg_info for package matplotlib
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.4.0]
python: yes [2.7.6 (default, Mar 22 2014, 22:59:38) [GCC
4.8.2]]
platform: yes [linux2]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.8.2]
six: yes [using six version 1.7.3]
dateutil: yes [using dateutil version 2.2]
tornado: yes [using tornado version 4.0.1]
pyparsing: yes [using pyparsing version 2.0.2]
pycxx: yes [Couldn't import. Using local copy.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/matplotlib/setup.py", line 154, in <module>
result = package.check()
File "setupext.py", line 940, in check
if 'No such file or directory\ngrep:' in version:
TypeError: argument of type 'NoneType' is not iterable
Complete output from command python setup.py egg_info:
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.4.0]
python: yes [2.7.6 (default, Mar 22 2014, 22:59:38) [GCC
4.8.2]]
platform: yes [linux2]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.8.2]
six: yes [using six version 1.7.3]
dateutil: yes [using dateutil version 2.2]
tornado: yes [using tornado version 4.0.1]
pyparsing: yes [using pyparsing version 2.0.2]
pycxx: yes [Couldn't import. Using local copy.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/matplotlib/setup.py", line 154, in <module>
result = package.check()
File "setupext.py", line 940, in check
if 'No such file or directory\ngrep:' in version:
TypeError: argument of type 'NoneType' is not iterable
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Storing debug log for failure in /home/username/.pip/pip.log
In the tail of the log it says:
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1229, in prepare_files
req_to_install.run_egg_info()
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 325, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 697, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Why did it fail?
Many thanks!
This is a known bug that has been fixed (https://github.com/matplotlib/matplotlib/pull/3414) on master.
The bug is in the handling of searching for a freetype installation. If you install the Linux package freetype-dev, you will avoid this bug and be able to compile matplotlib.
sudo apt-get install libfreetype6-dev
On Ubuntu 14 server, you also need to install libxft-dev
sudo apt-get install libfreetype6-dev libxft-dev
I had the same issues trying to install matplotlib on Python 3 using pip3, and it seems that this problem is related to a bare-bones installation of Python 3, and doing a:
sudo apt-get build-dep matplotlib
followed by
sudo pip3 install matplotlib
is probably a better solution than selectively installing only the libraries related to matplotlib.
Since mac doesn't have apt-get you, on OSX you may need to do:
brew install freetype
then you can run:
pip install matplotlib
Found this page while looking answer for fedora 24.
RPM solution is:
dnf install freetype-devel
If you re running Ubuntu server 14.04 u should add this font dependency
sudo apt-get install libxft-dev
Source
I was trying too update directly using sudo pip but changes are not saved in last. So i first use update cmd in terminal:
sudo apt-get update
then i used sudo install:
sudo apt-get install libffi-dev
Finally its installed by doing this method.
For those on Fedora 25 hitting this thread, I needed these two packages to make it work:
sudo dnf install freetype-devel gcc-c++
This worked for me:
python -m pip install -U pip setuptools
python -m pip install matplotlib
For more details, follow : https://matplotlib.org/2.0.0/users/installing.html
I get ValueError: semaphore or lock released too many times when I try to do pip install matplotlib in Cygwin. What do I do?
UPDATE:
$ pip install matplotlib
Downloading/unpacking matplotlib
You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.
You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
Downloading matplotlib-1.3.0.tar.gz (42.1MB): 42.1MB downloaded
Running setup.py egg_info for package matplotlib
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.3.0]
python: yes [2.7.5 (default, Jul 30 2013, 14:34:22) [GCC
4.8.1]]
platform: yes [cygwin]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.7.1]
dateutil: yes [using dateutil version 2.1]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [pyparsing was not found. It is required for
mathtext support. pip/easy_install may attempt to
install it after matplotlib.]
pycxx: yes [Couldn't import. Using local copy.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: yes [version 16.1.10]
png: yes [version 1.5.14]
OPTIONAL SUBPACKAGES
sample_data: yes [installing]
toolkits: yes [installing]
tests: yes [nose 0.11.1 or later is required to run the
matplotlib test suite]
OPTIONAL BACKEND EXTENSIONS
macosx: no [Mac OS-X only]
qt4agg: no [PyQt4 not found]
Process PoolWorker-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python2.7/multiprocessing/pool.py", line 102, in worker
task = get()
File "/usr/lib/python2.7/multiprocessing/queues.py", line 378, in get
rrelease()
ValueError: semaphore or lock released too many times
I am not sure if it is the issue with a newest (stable) build of matplotlib, but I ran into the same issue as well.
My solution was to install an older stable version (1.2.1).
Download the 1.2.1 tar file, unzip, and install. Do not use the cygwin compiler option when installing. i.e.
python setup.py build --compiler=cygwin
will fail (did for me), while the usual
python setup.py build
will work. Of course You'll want to follow up with
python setup.py install
Note:
I run a pretty recent cygwin64.
I already had all of the dependencies installed.
I've also tried installing 1.3.0 through pip as well as source. Both threw the same exact error you described here.
Try upgrading the "cygwin" package to version 1.7.26 (http://cygwin.1069669.n5.nabble.com/Problem-with-multiprocessing-module-from-Python-td103816.html).