Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 645864 - dev-python/numpy with python 2.7 should depend on dev-python/scimath - ImportError: cannot import name scimath
Summary: dev-python/numpy with python 2.7 should depend on dev-python/scimath - Import...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Science Related Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-26 23:48 UTC by Maciej Piechotka
Modified: 2019-03-31 23:35 UTC (History)
5 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Piechotka 2018-01-26 23:48:04 UTC
Discovered when building matplotlib:

set /var/tmp/portage/dev-python/matplotlib-2.1.2-r1/work/matplotlib-2.1.2-python2_7/build/lib/matplotlib/_version.py to '2.1.2-python2_7'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 296, in <module>
    **extra_args
  File "/usr/lib64/python2.7/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib64/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "setup.py", line 146, in run
    return BuildExtCommand.run(self)
  File "/usr/lib64/python2.7/site-packages/setuptools/command/build_ext.py", line 75, in run
    _build_ext.run(self)
  File "/usr/lib64/python2.7/site-packages/Cython/Distutils/old_build_ext.py", line 185, in run
    _build_ext.build_ext.run(self)
  File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/usr/lib64/python2.7/site-packages/Cython/Distutils/old_build_ext.py", line 192, in build_extensions
    ext.sources = self.cython_sources(ext.sources, ext)
  File "/usr/lib64/python2.7/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.1.2-r1/work/matplotlib-2.1.2-python2_7/setupext.py", line 924, in __get__
    result = obj._hooks[self._name]() + result
  File "/var/tmp/portage/dev-python/matplotlib-2.1.2-r1/work/matplotlib-2.1.2-python2_7/setupext.py", line 950, in include_dirs_hook
    import numpy
  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 18, in <module>
    from . import scimath as emath
ImportError: cannot import name scimath
Comment 1 Robert G. Siebeck 2019-03-26 18:25:25 UTC
Same problem here with matplotlib-2.2.2-r1 and numpy-1.14.5
Comment 2 François Bissey 2019-03-26 19:44:10 UTC
Notice 
  File "/usr/lib64/python2.7/site-packages/numpy/lib/__init__.py", line 18, in <module>
    from . import scimath as emath

the "from ." means that it is a relative import from the same folder as the parent caller. Therefore it tries to import scimath.py (or an alias for it) in /usr/lib64/python2.7/site-packages/numpy/lib/ and sure enough I have a file of that name in that directory. Do you?
Comment 3 François Bissey 2019-03-26 20:35:08 UTC
Hum, do you have dev-python/future installed (and I mean future not futures)? This should be a dependency of numpy but isn't. Note that numpy upstream does a poor job of signalling that it is needed. But the first line of /usr/lib64/python2.7/site-packages/numpy/lib/__init__.py is
from __future__ import ....
which is a signal you need future installed.
Comment 4 Robert G. Siebeck 2019-03-26 20:49:40 UTC
(In reply to François Bissey from comment #3)
> Hum, do you have dev-python/future installed (and I mean future not
> futures)? This should be a dependency of numpy but isn't. Note that numpy
> upstream does a poor job of signalling that it is needed. But the first line
> of /usr/lib64/python2.7/site-packages/numpy/lib/__init__.py is
> from __future__ import ....
> which is a signal you need future installed.

Thanks for the hint, installing dev-python/future fixed this problem for me. So this definitely should be added as a dependency.

Unfortunately, matplotlib still fails to build, now with another error message:

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'
Comment 5 François Bissey 2019-03-26 20:51:40 UTC
I'd like you to rename this bug so what's missing is clear and can be acted upon. For the matplotlib build bug please open another bug and I will have a look at that too.
Comment 6 Robert G. Siebeck 2019-03-26 20:57:41 UTC
(In reply to François Bissey from comment #5)
> I'd like you to rename this bug so what's missing is clear and can be acted
> upon. For the matplotlib build bug please open another bug and I will have a
> look at that too.

I created #681822. Unfortunately, I cannot rename this bug as I'm not the reporter.