[Python] Importing numpy results in multiple errors

Discussão em 'Python' iniciado por Stack, Abril 11, 2025.

  1. Stack

    Stack Membro Participativo

    With the following packages installed in the conda environment

    (pt26-cuda126-py310) [m@gpu015 llama2-70b]$ conda list | grep blas
    blas 1.0 mkl
    libblas 3.9.0 26_linux64_mkl conda-forge
    libcblas 3.9.0 26_linux64_mkl conda-forge
    libopenblas 0.3.29 pthreads_h94d23a6_0 conda-forge
    nvidia-cublas-cu12 12.6.4.1 pypi_0 pypi
    (pt26-cuda126-py310) [m@gpu015 llama2-70b]$ conda list | grep numpy
    numpy 1.26.4 py310hb13e2d6_0 conda-forge
    (pt26-cuda126-py310) [m@gpu015 llama2-70b]$ conda list | grep torch
    pytorch 1.12.1 cpu_py310he8d8e81_0
    torch 2.6.0+cu126 pypi_0 pypi
    torchaudio 2.6.0+cu126 pypi_0 pypi
    torchvision 0.21.0+cu126 pypi_0 pypi


    When I want to import numpy, I get this error:

    (pt26-cuda126-py310) [m@gpu015 llama2-70b]$ python
    Python 3.10.16 (main, Dec 11 2024, 16:24:50) [GCC 11.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import numpy
    Traceback (most recent call last):
    File "/home/m/.conda/envs/pt26-cuda126-py310/lib/python3.10/site-packages/numpy/core/__init__.py", line 24, in <module>
    from . import multiarray
    File "/home/m/.conda/envs/pt26-cuda126-py310/lib/python3.10/site-packages/numpy/core/multiarray.py", line 10, in <module>
    from . import overrides
    File "/home/m/.conda/envs/pt26-cuda126-py310/lib/python3.10/site-packages/numpy/core/overrides.py", line 8, in <module>
    from numpy.core._multiarray_umath import (
    ImportError: libcblas.so.3: cannot open shared object file: No such file or directory

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/home/m/.conda/envs/pt26-cuda126-py310/lib/python3.10/site-packages/numpy/__init__.py", line 130, in <module>
    from numpy.__config__ import show as show_config
    File "/home/m/.conda/envs/pt26-cuda126-py310/lib/python3.10/site-packages/numpy/__config__.py", line 4, in <module>
    from numpy.core._multiarray_umath import (
    File "/home/m/.conda/envs/pt26-cuda126-py310/lib/python3.10/site-packages/numpy/core/__init__.py", line 50, 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.10 from "/home/m/.conda/envs/pt26-cuda126-py310/bin/python"
    * The NumPy version is: "1.26.4"

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

    Original error was: libcblas.so.3: cannot open shared object file: No such file or directory


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

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/m/.conda/envs/pt26-cuda126-py310/lib/python3.10/site-packages/numpy/__init__.py", line 135, in <module>
    raise ImportError(msg) from e
    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.
    >>>


    I haven't faced this kind of error before. Any idea about the solution?

    Continue reading...

Compartilhe esta Página