【问题标题】:pytables installation failedpytables 安装失败
【发布时间】:2014-03-03 16:44:35
【问题描述】:

我愿意:

sudo pip install --upgrade tables

我明白了:

    /usr/bin/ld: cannot find -lhdf5
collect2: ld returned 1 exit status
.. ERROR:: Could not find a local HDF5 installation.
   You may need to explicitly state where your local HDF5 headers and
   library can be found by setting the ``HDF5_DIR`` environment
   variable or by using the ``--hdf5`` command-line option.
Complete output from command python setup.py egg_info:
/usr/bin/ld: cannot find -lhdf5

然而:

$ echo $HDF5_DIR 
/opt/hdf5/
$ ls /opt/hdf5/
bin  include  lib  share
$ ls /opt/hdf5/lib/
libhdf5.a     libhdf5_hl.la  libhdf5_hl.so.8      libhdf5.la        libhdf5.so libhdf5.so.8.0.1
libhdf5_hl.a  libhdf5_hl.so  libhdf5_hl.so.8.0.1  libhdf5.settings  libhdf5.so.8

怎么了?如何调试?我已经尝试将 HDF5_DIR 设置为 /opt/ 或 /opt/hdf5/lib。

【问题讨论】:

    标签: installation pip hdf5


    【解决方案1】:

    我在尝试在本地 virtualenv 中工作的 Debian sid 上也遇到了同样的错误。为了解决这个问题,我做了:

    apt-get build-dep python-tables
    HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/ && pip install tables
    

    ...现在它正在工作。

    【讨论】:

    • sudo apt-get build-dep python-tables 对我来说已经足够了! (Ubuntu 14.04)
    • 我所要做的就是sudo apt-get install hdf5-serial-dev,然后是pip install tables
    • 自 2014 年以来发生了很多变化,很高兴知道 -dev 包现在适用于开箱即用的 pytables :)
    • sudo apt-get install libhdf5-serial-dev 对我来说,在 2019 年基于 debian 的 docker 映像上
    • Ubuntu 16.04 上的 Python 3.6.9 需要安装 libhdf5-dev 后跟:HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/ pip install tables
    【解决方案2】:

    我可以在 OSX 中使用以下代码在虚拟环境中轻松解决此问题:

        $ brew install hdf5
        $ pyvenv test
        $ workon myvenv # to get pytables working within the virtual environment myvenv
        $ pip install numpy numexpr cython
        $ pip install tables
    

    (取自 https://github.com/PyTables/PyTables/issues/385 的 andreabedini 帖子)

    【讨论】:

      【解决方案3】:

      我遇到了类似的问题,但我使用的是前沿而不是 pip 版本(请参阅旁注)。 我也尝试指向图书馆本身

      export HDF5_DIR=/usr/lib/libhdf5.so.6
      

      但它不起作用。

      另外:如果您认为您的错误最近可能已得到解决,您可以尝试 PyTables 的前沿:

      sudo pip install git+https://github.com/PyTables/PyTables
      

      .

      在我安装了 hdf5 库的开发版本 (libhdf5-openmpi-dev) 后,构建(由 pip install... 引起)似乎更进一步。由于其他原因,构建仍然失败,但这是您可以尝试的另一个方向。

      【讨论】:

      • HDF5_DIR 需要目录而不是文件,export HDF5_DIR=/local/johndoe/hdf5
      【解决方案4】:

      也许你可以从这里为你的 pytables 操作系统安装 stable wheel 文件: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pytables

      使用此命令检查要下载的文件 path/to/pythonX.Y -m pip debug --verbose

      这个命令安装wheel文件 pip install C:/some-dir/some-file.whl

      【讨论】:

        【解决方案5】:

        我尝试了一切,但没有成功。我能实现的唯一方法是使用我在这里得到的 nehalecky 的答案:

        https://github.com/PyTables/PyTables/issues/219

        简而言之,你应该执行这两条命令,当然要更正路径:

        sudo python3 setup.py build_ext --inplace --hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial/
        sudo python3 setup.py install --hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial/
        

        希望对你有帮助!

        【讨论】:

          猜你喜欢
          • 2012-06-16
          • 2012-03-18
          • 2019-03-14
          • 1970-01-01
          • 2019-10-09
          • 2014-12-17
          • 1970-01-01
          • 2013-02-24
          • 1970-01-01
          相关资源
          最近更新 更多