Skip to content

numpy.core.multiarray failed to import #444

Closed

Description

@guicostas

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
Traceback (most recent call last):
File "brazil.py", line 3, in
from mpl_toolkits.basemap import Basemap
File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/basemap/init.py", line 37, in
import _geoslib
ImportError: numpy.core.multiarray failed to import

Activity

  1. molinav commented on Jan 22, 2022

    @molinav
    Member

    Could you provide some more information about your working environment? This would mean:

    • Operating system.
    • Python version (I guess 2.7).
    • Channel used to install things (e.g. PyPI, Anaconda, GNU/Linux repositories).

    If you are using either Windows or GNU/Linux, I would recommend you to install basemap using pip. Since version 1.3.0 we provide precompiled binary wheels and it is as simple as doing:

    python -m pip install basemap

    In case you need the high-resolution auxiliary datasets, you would have to install them manually:

    python -m pip install basemap-data-hires
  2. molinav commented on Aug 10, 2022

    @molinav
    Member

    I am closing this issue due to lack of feedback. From your traceback

    RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
    

    this is the typical problem that occurs when you build basemap using a newer numpy version (e.g. >= 1.20) but later run it with an elder numpy version (e.g. < 1.20). There has been effort in remediating this issue by creating GitHub Actions that generate precompiled binary wheels for different platforms (in your case it looks like GNU/Linux).

    I would just recommend you install the precompiled wheels from PyPI if you cannot (or do not want to) build from source. In addition, the basemap repository now contains a pyproject.toml file with the proper definition of the build dependencies, so this problem should not be appearing anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions