Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 681822 - dev-python/matplotlib-2.2.2-r1 fails to build with AttributeError: module 'numpy' has no attribute 'core'
Summary: dev-python/matplotlib-2.2.2-r1 fails to build with AttributeError: module 'nu...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-26 20:56 UTC by Robert G. Siebeck
Modified: 2019-03-26 22:05 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
matplotlib-2.2.2-r1 buildlog (build.matplotlib.log,88.03 KB, text/x-log)
2019-03-26 21:12 UTC, Robert G. Siebeck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert G. Siebeck 2019-03-26 20:56:46 UTC
Build error while merging dev-python/matplotlib-2.2.2-r1:


UPDATING /var/tmp/portage/dev-python/matplotlib-2.2.2-r1/work/matplotlib-2.2.2-python3_6/build/lib/matplotlib/_version.py
set /var/tmp/portage/dev-python/matplotlib-2.2.2-r1/work/matplotlib-2.2.2-python3_6/build/lib/matplotlib/_version.py to '2.2.2'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 277, in <module>
    **extra_args
  File "/usr/lib64/python3.6/site-packages/setuptools/__init__.py", line 143, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 128, in run
    return BuildExtCommand.run(self)
  File "/usr/lib64/python3.6/site-packages/setuptools/command/build_ext.py", line 78, in run
    _build_ext.run(self)
  File "/usr/lib64/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 185, in run
    _build_ext.build_ext.run(self)
  File "/usr/lib64/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/usr/lib64/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 192, in build_extensions
    ext.sources = self.cython_sources(ext.sources, ext)
  File "/usr/lib64/python3.6/site-packages/Cython/Distutils/old_build_ext.py", line 263, in cython_sources
    extension.include_dirs = list(extension.include_dirs)
  File "/var/tmp/portage/dev-python/matplotlib-2.2.2-r1/work/matplotlib-2.2.2-python3_6/setupext.py", line 921, in __get__
    result = obj._hooks[self._name]() + result
  File "/var/tmp/portage/dev-python/matplotlib-2.2.2-r1/work/matplotlib-2.2.2-python3_6/setupext.py", line 941, in include_dirs_hook
    import numpy
  File "/usr/lib64/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/usr/lib64/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib64/python3.6/site-packages/numpy/lib/__init__.py", line 19, in <module>
    from .polynomial import *
  File "/usr/lib64/python3.6/site-packages/numpy/lib/polynomial.py", line 13, in <module>
    import numpy.core.numeric as NX
AttributeError: module 'numpy' has no attribute 'core'

This is reproducible both with dev-python/numpy-1.14.5 or dev-python/numpy-1.15.4 installed.

Reproducible: Always




~ $ emerge --info
Portage 2.3.62 (python 2.7.15-final-0, default/linux/amd64/17.0/desktop/plasma, gcc-8.2.0, glibc-2.28-r5, 4.19.27-gentoo-r1 x86_64)
=================================================================
System uname: Linux-4.19.27-gentoo-r1-x86_64-Intel-R-_Core-TM-_i5-6440HQ_CPU_@_2.60GHz-with-gentoo-2.6
KiB Mem:    16229028 total,   5061976 free
KiB Swap:   33555452 total,  27223124 free
Timestamp of repository gentoo: Tue, 26 Mar 2019 18:00:01 +0000
Head commit of repository gentoo: 1bc187d80fea3a2c2910bb38f16f8bed96874200
sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.30 p5) 2.30.0
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.5.5::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.9.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.38.3-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.30-r4::gentoo
sys-devel/gcc:            8.2.0-r6::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.28-r5::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24

robert7k
    location: /usr/local/portage
    masters: gentoo
    priority: 0

steam-overlay
    location: /var/lib/layman/steam-overlay
    masters: gentoo
    priority: 50

tlp
    location: /var/lib/layman/tlp
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -mtune=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="${CONFIG_PROTECT} /etc /etc/idea/conf /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native -mtune=native"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="rsync://mirror.netcologne.de/gentoo/ http://mirror.netcologne.de/gentoo/ rsync://ftp-stud.hs-esslingen.de/gentoo/ http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de en"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi activities alsa amd64 bash-completion berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit crypt cups cxx dbus declarative dlna dri dts dvd dvdr emboss encode epub exif fam flac fortran gdbm gif glamor gpm gstreamer gtk iconv ipv6 java jpeg kde kipi kwallet lcms ldap libnotify libtirpc mad mmx mmxext mng mp3 mp4 mpeg mpt multilib ncurses nls nptl ogg opengl openmp opus pam pango pcre pdf phonon plasma png policykit ppds pulseaudio qml qt5 raw readline samba sdl seccomp semantic-desktop spell sse sse2 sse3 sse4 sse4_1 ssl ssse3 startup-notification svg tcpd tiff truetype udev udisks unicode upnp upower usb vaapi vorbis widgets wifi wxwidgets x264 xattr xcb xcomposite xinerama xml xv xvid zeroconf zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext sse sse2 sse3 sse4 sse4a sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="synaptics keyboard mouse evdev" KERNEL="linux" L10N="de en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 François Bissey 2019-03-26 21:04:57 UTC
Could you attach the build log please. That would help sort a few things out. Like you have three python installed, were the other two builds successful?
Comment 2 Robert G. Siebeck 2019-03-26 21:12:22 UTC
Created attachment 570896 [details]
matplotlib-2.2.2-r1 buildlog

Please find the buildlog attached.
Comment 3 François Bissey 2019-03-26 21:20:07 UTC
Thanks for that. First off I notice you only install for python 3.6 which means we don't know what happens for 2.7 and 3.5 (which you have according to emerge --info).

The first sign of trouble is here
REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [not found. pip may install it below.]

The version of numpy should have been reported in brackets. This means your numpy installation is broken in some ways. 
Can you post the output of 
ls -la /usr/lib64/python3.6/site-packages/numpy/
please.
Comment 4 Robert G. Siebeck 2019-03-26 21:22:02 UTC
Here you go:

~$ ls -la /usr/lib64/python3.6/site-packages/numpy/
total 392K
drwxr-xr-x  17 root root 4.0K Mar 26 22:07 .
drwxr-xr-x 160 root root  12K Mar 26 22:07 ..
-rw-r--r--   1 root root 2.3K Jun 12  2018 LICENSE.txt
-rw-r--r--   1 root root 1.6K Mar 26 22:07 __config__.py
-rw-r--r--   1 root root 7.1K Jun 12  2018 __init__.py
drwxr-xr-x   2 root root 4.0K Mar 26 22:07 __pycache__
-rw-r--r--   1 root root  331 Jun 12  2018 _distributor_init.py
-rw-r--r--   1 root root 1.9K Jun 12  2018 _globals.py
-rw-r--r--   1 root root  13K Jun 12  2018 _import_tools.py
-rw-r--r--   1 root root 230K Jun 12  2018 add_newdocs.py
drwxr-xr-x   3 root root 4.0K Mar 26 22:07 compat
-rw-r--r--   1 root root 1.6K Jun 12  2018 conftest.py
drwxr-xr-x   6 root root 4.0K Mar 26 22:07 core
-rw-r--r--   1 root root  15K Jun 12  2018 ctypeslib.py
drwxr-xr-x   7 root root 4.0K Mar 26 22:07 distutils
drwxr-xr-x   3 root root 4.0K Mar 26 22:07 doc
-rw-r--r--   1 root root 1.9K Jun 12  2018 dual.py
drwxr-xr-x   5 root root 4.0K Mar 26 22:07 f2py
drwxr-xr-x   4 root root 4.0K Mar 26 22:07 fft
drwxr-xr-x   4 root root 4.0K Mar 26 22:07 lib
drwxr-xr-x   4 root root 4.0K Mar 26 22:07 linalg
drwxr-xr-x   4 root root 4.0K Mar 26 22:07 ma
-rw-r--r--   1 root root 9.6K Jun 12  2018 matlib.py
drwxr-xr-x   4 root root 4.0K Mar 26 22:07 matrixlib
drwxr-xr-x   4 root root 4.0K Mar 26 22:07 polynomial
drwxr-xr-x   4 root root 4.0K Mar 26 22:07 random
-rw-r--r--   1 root root  920 Jun 12  2018 setup.py
drwxr-xr-x   5 root root 4.0K Mar 26 22:07 testing
drwxr-xr-x   2 root root 4.0K Mar 26 22:07 tests
-rw-r--r--   1 root root  294 Mar 26 22:07 version.py
Comment 5 François Bissey 2019-03-26 21:25:11 UTC
Looks Ok.
ls -la /usr/lib64/python3.6/site-packages/numpy/core/
?
Comment 6 Robert G. Siebeck 2019-03-26 21:27:29 UTC
~ $ ls -la /usr/lib64/python3.6/site-packages/numpy/core/
total 3.9M
drwxr-xr-x  6 root root 4.0K Mar 26 22:07 .
drwxr-xr-x 17 root root 4.0K Mar 26 22:07 ..
-rw-r--r--  1 root root 3.0K Jun 12  2018 __init__.py
drwxr-xr-x  2 root root 4.0K Mar 26 22:07 __pycache__
-rwxr-xr-x  1 root root 5.9K Mar 26 22:07 _dummy.cpython-36m-x86_64-linux-gnu.so
-rw-r--r--  1 root root  22K Jun 12  2018 _internal.py
-rw-r--r--  1 root root 4.6K Jun 12  2018 _methods.py
-rw-r--r--  1 root root  57K Jun 12  2018 arrayprint.py
-rw-r--r--  1 root root  413 Jun 12  2018 cversions.py
-rw-r--r--  1 root root  66K Jun 12  2018 defchararray.py
-rw-r--r--  1 root root  40K Jun 12  2018 einsumfunc.py
-rw-r--r--  1 root root  99K Jun 12  2018 fromnumeric.py
-rw-r--r--  1 root root  13K Jun 12  2018 function_base.py
-rw-r--r--  1 root root 7.4K Jun 12  2018 generate_numpy_api.py
-rw-r--r--  1 root root  18K Jun 12  2018 getlimits.py
drwxr-xr-x  3 root root 4.0K Jul 25  2018 include
-rw-r--r--  1 root root 4.6K Jun 12  2018 info.py
drwxr-xr-x  3 root root 4.0K Mar 26 22:07 lib
-rw-r--r--  1 root root  11K Jun 12  2018 machar.py
-rw-r--r--  1 root root  12K Jun 12  2018 memmap.py
-rwxr-xr-x  1 root root 1.7M Mar 26 22:07 multiarray.cpython-36m-x86_64-linux-gnu.so
-rwxr-xr-x  1 root root  94K Mar 26 22:07 multiarray_tests.cpython-36m-x86_64-linux-gnu.so
-rw-r--r--  1 root root  84K Jun 12  2018 numeric.py
-rw-r--r--  1 root root  29K Jun 12  2018 numerictypes.py
-rwxr-xr-x  1 root root  10K Mar 26 22:07 operand_flag_tests.cpython-36m-x86_64-linux-gnu.so
-rw-r--r--  1 root root  30K Jun 12  2018 records.py
-rw-r--r--  1 root root  41K Jun 12  2018 setup.py
-rw-r--r--  1 root root  16K Jun 12  2018 setup_common.py
-rw-r--r--  1 root root  19K Jun 12  2018 shape_base.py
-rwxr-xr-x  1 root root  10K Mar 26 22:07 struct_ufunc_test.cpython-36m-x86_64-linux-gnu.so
-rwxr-xr-x  1 root root  40K Mar 26 22:07 test_rational.cpython-36m-x86_64-linux-gnu.so
drwxr-xr-x  3 root root 4.0K Mar 26 22:07 tests
-rwxr-xr-x  1 root root 1.4M Mar 26 22:07 umath.cpython-36m-x86_64-linux-gnu.so
-rwxr-xr-x  1 root root  19K Mar 26 22:07 umath_tests.cpython-36m-x86_64-linux-gnu.so
Comment 7 François Bissey 2019-03-26 21:36:08 UTC
Pretty normal so far. Start python3.6 and try to import numpy. Like
$ python3.6
Python 3.6.8 (default, Mar  4 2019, 19:48:44) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy

and post all the output from the call to python3.6 as above.
Comment 8 Robert G. Siebeck 2019-03-26 21:43:17 UTC
~ $ python3.6
Python 3.6.5 (default, Jul 24 2018, 22:46:36) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/usr/lib64/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib64/python3.6/site-packages/numpy/lib/__init__.py", line 19, in <module>
    from .polynomial import *
  File "/usr/lib64/python3.6/site-packages/numpy/lib/polynomial.py", line 20, in <module>
    from numpy.linalg import eigvals, lstsq, inv
  File "/usr/lib64/python3.6/site-packages/numpy/linalg/__init__.py", line 51, in <module>
    from .linalg import *
  File "/usr/lib64/python3.6/site-packages/numpy/linalg/linalg.py", line 31, in <module>
    from numpy.linalg import lapack_lite, _umath_linalg
ImportError: libgfortran.so.3: cannot open shared object file: No such file or directory
Comment 9 François Bissey 2019-03-26 21:52:38 UTC
And it ended up being a gfortran upgrade problem. Read https://bugs.gentoo.org/664890#c1 as a first example. Since you are looking at libgfortran.so.3 you should do

revdep-rebuild --library 'libgfortran.so.3' -- --exclude gcc
and 
revdep-rebuild --library 'libgfortran.so.4' -- --exclude gcc
just in case you compiled anything with gfortran-7.
Once you have done that try again. But it looks like we are chasing stuff linked to old gfortran runtime that needs to be rebuilt.
Comment 10 Robert G. Siebeck 2019-03-26 21:57:07 UTC
(In reply to François Bissey from comment #9)
> And it ended up being a gfortran upgrade problem. Read
> https://bugs.gentoo.org/664890#c1 as a first example. Since you are looking
> at libgfortran.so.3 you should do
> 
> revdep-rebuild --library 'libgfortran.so.3' -- --exclude gcc
> and 
> revdep-rebuild --library 'libgfortran.so.4' -- --exclude gcc
> just in case you compiled anything with gfortran-7.
> Once you have done that try again. But it looks like we are chasing stuff
> linked to old gfortran runtime that needs to be rebuilt.

That didn't help, unfortunately:

~ # revdep-rebuild --library 'libgfortran.so.3' -- --exclude gcc
 * This is the new python coded version
 * Please report any bugs found using it.
 * The original revdep-rebuild script is installed as revdep-rebuild.sh
 * Please file bugs at: https://bugs.gentoo.org/
 * Collecting system binaries and libraries
 * Checking dynamic linking consistency

Your system is consistent
~ # revdep-rebuild --library 'libgfortran.so.4' -- --exclude gcc
 * This is the new python coded version
 * Please report any bugs found using it.
 * The original revdep-rebuild script is installed as revdep-rebuild.sh
 * Please file bugs at: https://bugs.gentoo.org/
 * Checking dynamic linking consistency

Your system is consistent

Importing numpy in Python still fails with the exact same error...
Comment 11 François Bissey 2019-03-26 22:03:44 UTC
Used to work but I think the it doesn't with the new revdep-rebuild. What a pain. Most likely the root source of linking to libgfortran is blas/lapack.
So you need to rebuild your blas and lapack packages and then rebuild anything
that depends on `virtual/blas` and `virtual/lapack`.
equery d virtual/blas virtual/lapack
should help you figure that out (equery is from gentoolkit).

Because your numpy issue is ultimately coming from lapack, that should fix it.
Comment 12 Robert G. Siebeck 2019-03-26 22:05:43 UTC
Rebuilding sci-libs/blas-reference and sci-libs/lapack-reference fixed the problem for me.

Thank you for your help! Much appreciated!