r/JupyterLab • • Dec 17 '25

NumPy import not working

[RESOLVED]

Using MacBook, Python version is 3.12 according to the console, Numpy version is 2.2.4. Ive tried conda install and pip install but neither solve the issue. I restart the kernel each time but nothing changes. I've noticed that when I check the PYTHONPATH it returns None which is odd.

I have tried fixing this for an hour and this shit aint changing. Please help! import math works for some reason but not import numpy.

full error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File ~/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/_core/__init__.py:23
     22
 
try
:
---> 23     
from
 
.
 
import
 multiarray
     24
 
except
 
ImportError
 
as
 exc:

File ~/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/_core/multiarray.py:10
      9
 
import
 
functools
---> 10 
from
 
.
 
import
 overrides
     11
 
from
 
.
 
import
 _multiarray_umath

File ~/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/_core/overrides.py:7
      6
 
from
 
.._utils._inspect
 
import
 getargspec
----> 7 
from
 
numpy._core._multiarray_umath
 
import
 (
      8
     add_docstring,  _get_implementing_args, _ArrayFunctionDispatcher)
     11
 ARRAY_FUNCTIONS = set()

ImportError: dlopen(/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/_core/_multiarray_umath.cpython-312-darwin.so, 0x0002): Library not loaded: /libgfortran.5.dylib
  Referenced from: <0B9C315B-A1DD-3527-88DB-4B90531D343F> /Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/libopenblas.0.dylib
  Reason: tried: '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/_core/../../../../libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/_core/../../../../libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/bin/../lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/bin/../lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dyld cache)

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
File ~/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/__init__.py:114
    113
 
try
:
--> 114     
from
 
numpy.__config__
 
import
 show_config
    115
 
except
 
ImportError
 
as
 e:

File ~/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/__config__.py:4
      3
 
from
 
enum
 
import
 Enum
----> 4 
from
 
numpy._core._multiarray_umath
 
import
 (
      5
     __cpu_features__,
      6
     __cpu_baseline__,
      7
     __cpu_dispatch__,
      8
 )
     10
 __all__ = ["show_config"]

File ~/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/_core/__init__.py:49
     26
     msg = """
     27
 
     28
 IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
   (...)
     47
 """ % (sys.version_info[0], sys.version_info[1], sys.executable,
     48
         __version__, exc)
---> 49     
raise
 
ImportError
(msg)
     50
 
finally
:

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.12 from "/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/bin/python"
  * The NumPy version is: "2.2.4"

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

Original error was: dlopen(/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/_core/_multiarray_umath.cpython-312-darwin.so, 0x0002): Library not loaded: u/rpath/libgfortran.5.dylib
  Referenced from: <0B9C315B-A1DD-3527-88DB-4B90531D343F> /Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/libopenblas.0.dylib
  Reason: tried: '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/_core/../../../../libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/_core/../../../../libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/bin/../lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/Users/eulerboiler/Library/jupyterlab-desktop/jlab_server/bin/../lib/libgfortran.5.dylib' (duplicate LC_RPATH '@loader_path'), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dyld cache)


The above exception was the direct cause of the following exception:

ImportError                               Traceback (most recent call last)
Cell In[3], line 1
----> 1 
import
 
numpy
 
as
 
np

File ~/Library/jupyterlab-desktop/jlab_server/lib/python3.12/site-packages/numpy/__init__.py:119
    115
 
except
 
ImportError
 
as
 e:
    116
     msg = """Error importing numpy: you should not try to import numpy from
    117
     its source directory; please exit the numpy source tree, and relaunch
    118
     your python interpreter from there."""
--> 119     
raise
 
ImportError
(msg) 
from
 
e
    121
 
from
 
.
 
import
 _core
    122
 
from
 
._core
 
import
 (
    123
     False_, ScalarType, True_,
    124
     abs, absolute, acos, acosh, add, all, allclose,
   (...)
    169
     vecmat, void, vstack, where, zeros, zeros_like
    170
 )

ImportError: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.
2 Upvotes

2 comments sorted by

1

u/[deleted] Dec 18 '25

it seems there is something off with the PATH. how did you install conda / jupyter?

1

u/Aggressive_Fan_2063 Dec 25 '25

I used an install I found on GitHub. But I deleted that.

The solution was to Install Python, then use 'pip3 import numpy', 'pip3 install jupyter' and 'jupyter lab' commands on the zsh console. Then I can open Jupyter Notebooks on safari and import numpy.