为 numpy 安装 lapack

发布于 2024-12-27 15:38:16 字数 382 浏览 5 评论 0原文

运行 Ubuntu 11.10 + python2.7...从源代码构建了 numpy 并安装了它,但是当我去安装它时,

ImportError: /usr/lib/liblapack.so.3gf: undefined symbol: ATL_chemv

当它尝试从 numpy.linalg 导入 lapack_lite 时,我得到了。我尝试从头开始重建 lapack,但它似乎只是 make

/usr/local/lib/libblas.a
/usr/local/lib/liblapack.a
/usr/local/lib/libtmglib.a

和 .so 文件。 .so.3gf 从哪里来,如何修复它?

Running Ubuntu 11.10 + python2.7...built numpy from source and installed it, but when I go to install it, I get

ImportError: /usr/lib/liblapack.so.3gf: undefined symbol: ATL_chemv

when it tries to import lapack_lite from numpy.linalg. I tried to rebuild lapack from scratch, but it seems to just make

/usr/local/lib/libblas.a
/usr/local/lib/liblapack.a
/usr/local/lib/libtmglib.a

and the .so file. Where does the .so.3gf come from, and how do I fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

清君侧 2025-01-03 15:38:17

当您安装了 libopenblas-baselibatlas3-base,但未安装 liblapack3 时,就会出现此问题。这种软件包组合会安装 libblas.so(来自 OpenBLAS)和 liblapack.so(来自 ATLAS)的冲突版本。

解决方案 1(我最喜欢):如果您还安装了 liblapack3,则可以在计算机上同时保留 OpenBLAS 和 ATLAS。

sudo apt-get install liblapack3

解决方案 2:卸载 ATLAS(由于某些 deb 包恶作剧,这实际上会自动为您安装 liblapack3

sudo apt-get uninstall libatlas3-base

解决方案 3:卸载 OpenBLAS

sudo apt-get uninstall libopenblas-base


配置错误

$ dpkg -l | grep 'openblas\|atlas\|lapack'
ii  libatlas3-base                                        3.10.1-4                                            amd64        Automatically Tuned Linear Algebra Software, generic shared
ii  libopenblas-base                                      0.2.8-6ubuntu1                                      amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2
$ update-alternatives --get-selections | grep 'blas\|lapack'
libblas.so.3                   auto     /usr/lib/openblas-base/libblas.so.3
liblapack.so.3                 auto     /usr/lib/atlas-base/atlas/liblapack.so.3
$ python -c 'import numpy'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 153, in <module>
    from . import add_newdocs
  File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 18, in <module>
    from .polynomial import *
  File "/usr/lib/python2.7/dist-packages/numpy/lib/polynomial.py", line 19, in <module>
    from numpy.linalg import eigvals, lstsq, inv
  File "/usr/lib/python2.7/dist-packages/numpy/linalg/__init__.py", line 50, in <module>
    from .linalg import *
  File "/usr/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 29, in <module>
    from numpy.linalg import lapack_lite, _umath_linalg
ImportError: /usr/lib/liblapack.so.3: undefined symbol: ATL_chemv

解决方案 1

$ dpkg -l | grep 'openblas\|atlas\|lapack'
ii  libatlas3-base                                        3.10.1-4                                            amd64        Automatically Tuned Linear Algebra Software, generic shared
ii  liblapack3                                            3.5.0-2ubuntu1                                      amd64        Library of linear algebra routines 3 - shared version
ii  libopenblas-base                                      0.2.8-6ubuntu1                                      amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2
$ update-alternatives --get-selections | grep 'blas\|lapack'
libblas.so.3                   auto     /usr/lib/openblas-base/libblas.so.3
liblapack.so.3                 auto     /usr/lib/lapack/liblapack.so.3
$ python -c 'import numpy'

解决方案 2

$ dpkg -l | grep 'openblas\|atlas\|lapack'
ii  liblapack3                                            3.5.0-2ubuntu1                                      amd64        Library of linear algebra routines 3 - shared version
ii  libopenblas-base                                      0.2.8-6ubuntu1                                      amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2
$ update-alternatives --get-selections | grep 'blas\|lapack'
libblas.so.3                   auto     /usr/lib/openblas-base/libblas.so.3
liblapack.so.3                 auto     /usr/lib/lapack/liblapack.so.3
$ python -c 'import numpy'

解决方案 3

$ dpkg -l | grep 'openblas\|atlas\|lapack'
ii  libatlas3-base                                        3.10.1-4                                            amd64        Automatically Tuned Linear Algebra Software, generic shared
$ update-alternatives --get-selections | grep 'blas\|lapack'
libblas.so.3                   auto     /usr/lib/atlas-base/atlas/libblas.so.3
liblapack.so.3                 auto     /usr/lib/atlas-base/atlas/liblapack.so.3
$ python -c 'import numpy'

This issue arises when you have libopenblas-base and libatlas3-base installed, but don't have liblapack3 installed. This combination of packages installs conflicting versions of libblas.so (from OpenBLAS) and liblapack.so (from ATLAS).

Solution 1 (my favorite): You can keep both OpenBLAS and ATLAS on your machine if you also install liblapack3.

sudo apt-get install liblapack3

Solution 2: Uninstall ATLAS (this will actually install liblapack3 for you automatically because of some deb package shenanigans)

sudo apt-get uninstall libatlas3-base

Solution 3: Uninstall OpenBLAS

sudo apt-get uninstall libopenblas-base


Bad configuration

$ dpkg -l | grep 'openblas\|atlas\|lapack'
ii  libatlas3-base                                        3.10.1-4                                            amd64        Automatically Tuned Linear Algebra Software, generic shared
ii  libopenblas-base                                      0.2.8-6ubuntu1                                      amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2
$ update-alternatives --get-selections | grep 'blas\|lapack'
libblas.so.3                   auto     /usr/lib/openblas-base/libblas.so.3
liblapack.so.3                 auto     /usr/lib/atlas-base/atlas/liblapack.so.3
$ python -c 'import numpy'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 153, in <module>
    from . import add_newdocs
  File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 18, in <module>
    from .polynomial import *
  File "/usr/lib/python2.7/dist-packages/numpy/lib/polynomial.py", line 19, in <module>
    from numpy.linalg import eigvals, lstsq, inv
  File "/usr/lib/python2.7/dist-packages/numpy/linalg/__init__.py", line 50, in <module>
    from .linalg import *
  File "/usr/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 29, in <module>
    from numpy.linalg import lapack_lite, _umath_linalg
ImportError: /usr/lib/liblapack.so.3: undefined symbol: ATL_chemv

Solution 1

$ dpkg -l | grep 'openblas\|atlas\|lapack'
ii  libatlas3-base                                        3.10.1-4                                            amd64        Automatically Tuned Linear Algebra Software, generic shared
ii  liblapack3                                            3.5.0-2ubuntu1                                      amd64        Library of linear algebra routines 3 - shared version
ii  libopenblas-base                                      0.2.8-6ubuntu1                                      amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2
$ update-alternatives --get-selections | grep 'blas\|lapack'
libblas.so.3                   auto     /usr/lib/openblas-base/libblas.so.3
liblapack.so.3                 auto     /usr/lib/lapack/liblapack.so.3
$ python -c 'import numpy'

Solution 2

$ dpkg -l | grep 'openblas\|atlas\|lapack'
ii  liblapack3                                            3.5.0-2ubuntu1                                      amd64        Library of linear algebra routines 3 - shared version
ii  libopenblas-base                                      0.2.8-6ubuntu1                                      amd64        Optimized BLAS (linear algebra) library based on GotoBLAS2
$ update-alternatives --get-selections | grep 'blas\|lapack'
libblas.so.3                   auto     /usr/lib/openblas-base/libblas.so.3
liblapack.so.3                 auto     /usr/lib/lapack/liblapack.so.3
$ python -c 'import numpy'

Solution 3

$ dpkg -l | grep 'openblas\|atlas\|lapack'
ii  libatlas3-base                                        3.10.1-4                                            amd64        Automatically Tuned Linear Algebra Software, generic shared
$ update-alternatives --get-selections | grep 'blas\|lapack'
libblas.so.3                   auto     /usr/lib/atlas-base/atlas/libblas.so.3
liblapack.so.3                 auto     /usr/lib/atlas-base/atlas/liblapack.so.3
$ python -c 'import numpy'
把梦留给海 2025-01-03 15:38:17

尝试检查 LD_LIBRARY_PATH。您可能会指出该库的另一个版本不支持 numpy 调用所需的符号。我的 Mac 上也有同样的情况。

但要小心,问题可能不会直接可见,因为一个库可以使用 LD_LIBRARY_PATH 链接到下一个库。

您可以检查以下命令在设置 LD_LIBRARY_PATH 和未设置 LD_LIBRARY_PATH 时是否存在差异(为活动 shell 临时删除:unset LD_LIBRARY_PATH):

ldd /usr/lib/liblapack.so.3gf

在我的情况下,由ISIS 软件系统与 numpy 所需的板载库发生冲突。

Try checking the LD_LIBRARY_PATH. You might point in there to another version of that library that does not support the symbol the numpy call needs. I had the same situation on my Mac.

But be careful, the problem might not be visible directly, because one library could link to the next using the LD_LIBRARY_PATH.

You can check if you see a difference in the following command with and without the LD_LIBRARY_PATH set (to remove temporarily for the active shell: unset LD_LIBRARY_PATH):

ldd /usr/lib/liblapack.so.3gf

In my case, libraries provided by the ISIS software system clashed with the onboard libraries that numpy requires.

小巷里的女流氓 2025-01-03 15:38:16

我遇到了同样的问题,删除包 libopenblas-base 就解决了问题:

sudo apt-get remove libopenblas-base

正如其他人已经解释的那样,几个包提供了不兼容版本的 liblapack.so.3gf。

I was having the same problem and removing the package libopenblas-base did the trick:

sudo apt-get remove libopenblas-base

As already explained by others, several packages provide incompatible versions of liblapack.so.3gf.

韵柒 2025-01-03 15:38:16

根据我看到的一些错误报告,您可能安装了多个 BLAS/ATLAS/LAPACK 提供程序,例如 ATLAS 和 OpenBLAS/GotoBLAS,它们彼此冲突。看一下:

$ ls -l /etc/alternatives/*.so.3gf

并检查它们是否都对应于同一个包(例如,它们都指向 /usr/lib/atlas-base/

According to some bugreports I see around, you may have more than one provider of BLAS/ATLAS/LAPACK installed, like ATLAS and OpenBLAS/GotoBLAS, that conflict with each other. Have a look on this:

$ ls -l /etc/alternatives/*.so.3gf

and check that all them correspond to the same package (eg. they all point into /usr/lib/atlas-base/)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文