[PYTHON] After installing basemap, I got a numpy import error

When I was making the materials for the TA experiment, I needed to draw a map with python, so I was planning to practice it while I was planning to use cartopy, but I thought, "Would you like to use basemap as well?" , When I installed it, I got an import error of numpy and was impatient (I thought Anaconda3 was dead ...)

Well, the reason why I thought about it is that when plotting the epicenter and observation points with obspy (seismic wave analysis module), it seems necessary to import the baseline. .. ..

Then, when I run the code after installing it, I get the following error. ..

numpy_error.py


Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.7/site-packages/numpy/core/__init__.py", line 22, in <module>
    from . import multiarray
  File "/opt/anaconda3/lib/python3.7/site-packages/numpy/core/multiarray.py", line 12, in <module>
    from . import overrides
  File "/opt/anaconda3/lib/python3.7/site-packages/numpy/core/overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: dlopen(/opt/anaconda3/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libopenblas.dylib
  Referenced from: /opt/anaconda3/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-darwin.so
  Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/anaconda3/lib/python3.7/site-packages/numpy/__init__.py", line 140, in <module>
    from . import core
  File "/opt/anaconda3/lib/python3.7/site-packages/numpy/core/__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.7 from "/opt/anaconda3/bin/python"
  * The NumPy version is: "1.19.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: dlopen(/opt/anaconda3/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libopenblas.dylib
  Referenced from: /opt/anaconda3/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-darwin.so
  Reason: image not found

I thought this was something, so I tried quite a lot.

・ Upgrade conda ・ Reinsert numpy

etc. .. I didn't want to reinstall anaconda3 if possible. I've customized it a lot, and I don't even know what to put in again. .. .. Well, the solution was solved by reading the beginning of the error properly.

initial_error.py


Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.7/site-packages/numpy/core/__init__.py", line 22, in <module>
    from . import multiarray
  File "/opt/anaconda3/lib/python3.7/site-packages/numpy/core/multiarray.py", line 12, in <module>
    from . import overrides
  File "/opt/anaconda3/lib/python3.7/site-packages/numpy/core/overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: dlopen(/opt/anaconda3/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libopenblas.dylib
  Referenced from: /opt/anaconda3/lib/python3.7/site-packages/numpy/core/_multiarray_umath.cpython-37m-darwin.so
  Reason: image not found

Well, all I had to do was put in "openblas". It seems like it was originally included? I thought, but this solved it for the time being.

Recommended Posts

After installing basemap, I got a numpy import error
I got a sqlite3.OperationalError
I got a Value Error when using JUMAN ++ with PyKNP
I get an error with import pandas.
I made a life game with Numpy
After studying Python3, I made a Slackbot
Linux Ubuntu16.04 I got a little scary error when I ran a command using sudo
Error when installing a module with Python pip
I got an error when saving with OpenCV
When I get a chromedriver error in Selenium
I got stuck installing Anaconda 4.3.0 which became Python 3.6
I made a random number graph with Numpy
Every time I try to read a csv file using pandas, I get a numpy error.
After doing 100 language processing knock 2015, I got a lot of basic Python skills Chapter 1