Bug 1610996

Summary: Importing error of multiarray numpy extension module on s390x
Product: [Fedora] Fedora Reporter: Antonio T. (sagitter) <anto.trande>
Component: numpyAssignee: Gwyn Ciesla <gwync>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: anto.trande, cstratak, gwync, igor.raits, josdekloe, jspaleta, lupinix.fedora, mhroncok, orion, quantum.analyst, rdieter, tomspur
Target Milestone: ---   
Target Release: ---   
Hardware: s390x   
OS: Linux   
Whiteboard:
Fixed In Version: numpy-1.15.0-2.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-08-13 23:40:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1604882, 1605718, 1612139, 1612539, 1615064    

Description Antonio T. (sagitter) 2018-08-01 20:36:22 UTC
Description of problem:

-- [4/5] Numpy Module
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/usr/lib64/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib64/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/lib64/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/lib64/python2.7/site-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
ImportError: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.
Original error was: /usr/lib64/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: LogBase2_128
-- Numpy NOT found - Python support disabled.

Version-Release number of selected component (if applicable):
numpy-1.15.0-1.fc29

How reproducible:
Rebuilding 'avogadro' on rawhide

Actual results:
https://kojipkgs.fedoraproject.org//work/tasks/118/28770118/build.log

Comment 1 Jos de Kloe 2018-08-02 17:58:26 UTC
I am getting exactly the same error when I try to rebuild pygrib on s390x.
The same code builds fine on f28 and for all architecture except s390x on rawhide.

I used this build command:
   fedpkg scratch-build --arches s390x --target rawhide
and get this output in build.log:
(see https://koji.fedoraproject.org/koji/taskinfo?taskID=28793934)

+ /usr/bin/python2 setup.py build
Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    import os, glob, numpy, sys
  File "/usr/lib64/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/usr/lib64/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib64/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/lib64/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/lib64/python2.7/site-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
ImportError: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.
Original error was: /usr/lib64/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: LogBase2_128
error: Bad exit status from /var/tmp/rpm-tmp.5XhzdD (%build)
RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.5XhzdD (%build)
Child return code was: 1

Comment 2 Christian Dersch 2018-08-03 13:33:55 UTC
I see the same with python3-numpy when trying to build astropy (therefore I also modify title as it is not Python 2 specific):


Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/numpy/core/__init__.py", line 16, in <module>
    from . import multiarray
ImportError: /usr/lib64/python3.7/site-packages/numpy/core/multiarray.cpython-37m-s390x-linux-gnu.so: undefined symbol: LogBase2_128
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "setup.py", line 128, in <module>
    **package_info
  File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib64/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib64/python3.7/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/lib64/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/builddir/build/BUILD/astropy-3.0.3/astropy_helpers/astropy_helpers/setup_helpers.py", line 242, in run
    orig_run(self)
  File "/builddir/build/BUILD/astropy-3.0.3/astropy_helpers/astropy_helpers/commands/build_ext.py", line 292, in run
    np_include = get_numpy_include_path()
  File "/builddir/build/BUILD/astropy-3.0.3/astropy_helpers/astropy_helpers/utils.py", line 72, in get_numpy_include_path
    import numpy
  File "/usr/lib64/python3.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/usr/lib64/python3.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib64/python3.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/lib64/python3.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/lib64/python3.7/site-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
ImportError: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.

Comment 3 Gwyn Ciesla 2018-08-03 20:38:55 UTC
This may be caused by an incorrect fix I applied to get this to build:

%ifnarch s390x
%{python2_sitearch}/numpy/__pycache__/*
%endif


On s390x, it wasn't being created.

If not, it might be a large Python s390x issue.

Comment 4 Christian Dersch 2018-08-04 10:45:10 UTC
I don't think this is the reason, as this does not affect the also broken python3-numpy.

Comment 5 Christian Dersch 2018-08-04 10:46:15 UTC
BTW: I see that you also skip tests on s390x, is numpy so broken on that architecture?

Comment 6 Miro Hrončok 2018-08-07 12:30:54 UTC
Can be reporduced in mock:

$ sudo dnf install qemu-user-static
$ mock -r fedora-rawhide-s390x --forcearch s390x --install python3-numpy
$ mock -r fedora-rawhide-s390x --forcearch s390x shell
<mock-chroot> sh-4.4# python3
Python 3.7.0 (default, Jul 23 2018, 08:49:45) 
[GCC 8.1.1 20180712 (Red Hat 8.1.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import multiarray
Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/numpy/core/__init__.py", line 16, in <module>
    from . import multiarray
ImportError: /usr/lib64/python3.7/site-packages/numpy/core/multiarray.cpython-37m-s390x-linux-gnu.so: undefined symbol: LogBase2_128

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/usr/lib64/python3.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib64/python3.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/lib64/python3.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/lib64/python3.7/site-packages/numpy/core/__init__.py", line 26, in <module>
    raise ImportError(msg)
ImportError: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: /usr/lib64/python3.7/site-packages/numpy/core/multiarray.cpython-37m-s390x-linux-gnu.so: undefined symbol: LogBase2_128

<mock-chroot> sh-4.4# rpm -q python3-numpy
python3-numpy-1.15.0-1.fc29.s390x

Comment 7 Elliott Sales de Andrade 2018-08-11 05:39:54 UTC
See this upstream comment [1], as I believe that is the cause of the issue.

[1] https://github.com/numpy/numpy/pull/11568#issuecomment-412252038

Comment 8 Elliott Sales de Andrade 2018-08-11 06:49:52 UTC
(In reply to Gwyn Ciesla from comment #3)
> This may be caused by an incorrect fix I applied to get this to build:
> 
> %ifnarch s390x
> %{python2_sitearch}/numpy/__pycache__/*
> %endif

Why does this directory exist at all? Python 2 does not create a __pycache__ directory; that's something from Python 3. It looks like a pytest artifact; they should not actually be packaged.

Comment 9 Elliott Sales de Andrade 2018-08-11 07:22:34 UTC
PR: https://src.fedoraproject.org/rpms/numpy/pull-request/6

May or may not work yet; will have to see how the build goes.

Comment 10 Miro Hrončok 2018-08-13 17:46:03 UTC
*** Bug 1615407 has been marked as a duplicate of this bug. ***