9

When I'm trying to install matplotlib using pip it throw me exception:

In file included from /usr/include/numpy/ndarrayobject.h:26:0,
                 from src/file_compat.h:7,
                 from src/ft2font_wrapper.cpp:3:
/usr/include/numpy/__multiarray_api.h: In function ‘int _import_array()’:
/usr/include/numpy/__multiarray_api.h:1686:13: error: ‘NPY_CPU_UNKNOWN_ENDIAN’ was not declared in this scope
   if (st == NPY_CPU_UNKNOWN_ENDIAN) {
             ^
/usr/include/numpy/__multiarray_api.h:1697:13: error: ‘NPY_CPU_LITTLE’ was not declared in this scope
   if (st != NPY_CPU_LITTLE) {
             ^
error: command 'cc' failed with exit status 1

----------------------------------------
Command "/usr/bin/pypy -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-vGxrsz/matplotlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-oB9gVW-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-vGxrsz/matplotlib

If i understand it correctly the problem in numpy. I install it using this command:

pypy -m pip install git+https://bitbucket.org/pypy/numpy.git@pypy-4.0.1

My numpy version is 1.9.0. My version of pypy:

'2.7.10 (4.0.1+dfsg-1~ppa1~ubuntu15.04, Nov 20 2015, 19:34:27)\n[PyPy 4.0.1 with GCC 4.9.2]'
Dima Kudosh
  • 7,126
  • 4
  • 36
  • 46
  • 2
    Numpy is not compatible with PyPy (and neither is matplotlib). See [here](http://packages.pypy.org/) for the list of currently supported packages. – ali_m Feb 21 '16 at 14:32
  • See e.g. http://morepypy.blogspot.ch/search?q=matplotlib&max-results=20&by-date=true – Armin Rigo Feb 21 '16 at 21:36
  • 3
    @ali_m incorrect. Numpy is compatible. – Qix - MONICA WAS MISTREATED Sep 07 '16 at 10:08
  • 2
    @Qix Well, that comment was correct when I wrote it back in February. The situation seems to have improved a bit since then, in that it's now possible to install a full version of numpy using cpyext ([numpypy is far from complete](http://buildbot.pypy.org/numpy-status/latest.html)). [matplotlib still isn't officially supported](http://packages.pypy.org/##matplotlib) (although see [here](https://morepypy.blogspot.co.uk/2016/06/pypy2-v53-released-major-c-extension.html)). – ali_m Sep 20 '16 at 18:41

2 Answers2

3

I succeed in install it. (But not perfect)

pypy7.3.3x64 ubuntu WSL

pypy3 -m pip install matplotlib==2.2

You may need to install some other packages.

Why 2.2

enter image description here

enter image description here


Why ipynb? Since GUI on WSL is not so easy. I managed to deal with CPython && matplotlib (By Xming), but not pypy3.


Now the newest is mpl==3.3.1, it could work, but with a lot of warning.

/lib/pypy3/lib_pypy/_functools.py:80: MatplotlibDeprecationWarning: print_svg() got unexpected keyword argument "orientation" which is no longer supported as of 3.3 and will become an error two minor releases later
  return self._func(*(self._args + fargs), **fkeywords)
/lib/pypy3/lib_pypy/_functools.py:80: MatplotlibDeprecationWarning: savefig() got unexpected keyword argument "orientation" which is no longer supported as of 3.3 and will become an error two minor releases later
  return self._func(*(self._args + fargs), **fkeywords)
/lib/pypy3/lib_pypy/_functools.py:80: MatplotlibDeprecationWarning: savefig() got unexpected keyword argument "dpi" which is no longer supported as of 3.3 and will become an error two minor releases later
  return self._func(*(self._args + fargs), **fkeywords)
AsukaMinato
  • 1,017
  • 12
  • 21
-1

The fix that worked for me:

sudo apt-get install pypy3-dev
Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
Justin Furuness
  • 685
  • 8
  • 21