无法pip安装python模块表

时间:2016-07-20 07:38:46

标签: python pytables

我正在尝试安装表,以便现有的python脚本在尝试“导入表格”时不会抱怨

pip install tables

这是输出:

Collecting tables
  Using cached tables-3.2.3.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.8.0 in ./miniconda/envs/optimus/lib/python2.7/site-packages (from tables)
Requirement already satisfied (use --upgrade to upgrade): numexpr>=2.5.2 in ./miniconda/envs/optimus/lib/python2.7/site-packages (from tables)
Installing collected packages: tables
  Running setup.py install for tables: started
    Running setup.py install for tables: finished with status 'error'
    Complete output from command /home/jonathonhill/miniconda/envs/optimus/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-jcuNfM/tables/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ofzTc6-record/install-record.txt --single-version-externally-managed --compile:
    * Using Python 2.7.8 |Continuum Analytics, Inc.| (default, Aug 21 2014, 18:22:21)
    * USE_PKGCONFIG: True
    * pkg-config header dirs for HDF5: /usr/include/hdf5/serial
    * pkg-config library dirs for HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial
    * Found HDF5 headers at ``/usr/include/hdf5/serial``, library at ``/usr/lib/x86_64-linux-gnu/hdf5/serial``.
    .. WARNING:: Could not find the HDF5 runtime.
       The HDF5 shared library was *not* found in the default library
       paths. In case of runtime problems, please remember to install it.
    /tmp/lzo_version_dateanObdP.c:1:1: warning: return type defaults to âintâ [-Wimplicit-int]
     main (int argc, char **argv) {
     ^
    /tmp/lzo_version_dateanObdP.c: In function âmainâ:
    /tmp/lzo_version_dateanObdP.c:2:5: warning: implicit declaration of function âlzo_version_dateâ [-Wimplicit-function-declaration]
         lzo_version_date();
         ^
    * Could not find LZO 2 headers and library; disabling support for it.
    /tmp/lzo_version_datedINlTK.c:1:1: warning: return type defaults to âintâ [-Wimplicit-int]
     main (int argc, char **argv) {
     ^
    /tmp/lzo_version_datedINlTK.c: In function âmainâ:
    /tmp/lzo_version_datedINlTK.c:2:5: warning: implicit declaration of function âlzo_version_dateâ [-Wimplicit-function-declaration]
         lzo_version_date();
         ^
    * Could not find LZO 1 headers and library; disabling support for it.
    /tmp/BZ2_bzlibVersionL7B4pC.c:1:1: warning: return type defaults to âintâ [-Wimplicit-int]
     main (int argc, char **argv) {
     ^
    /tmp/BZ2_bzlibVersionL7B4pC.c: In function âmainâ:
    /tmp/BZ2_bzlibVersionL7B4pC.c:2:5: warning: implicit declaration of function âBZ2_bzlibVersionâ [-Wimplicit-function-declaration]
         BZ2_bzlibVersion();
         ^
    * Found bzip2 headers at ``/usr/include``, the library is located in the standard system search dirs.
    /tmp/blosc_list_compressorsQc0Mok.c:1:1: warning: return type defaults to âintâ [-Wimplicit-int]
     main (int argc, char **argv) {
     ^
    /tmp/blosc_list_compressorsQc0Mok.c: In function âmainâ:
    /tmp/blosc_list_compressorsQc0Mok.c:2:5: warning: implicit declaration of function âblosc_list_compressorsâ [-Wimplicit-function-declaration]
         blosc_list_compressors();
         ^
    * Could not find blosc headers and library; using internal sources.

我从中收集到我错过了一个HDF5共享库。如何修复此错误/安装任何必要的依赖项。

4 个答案:

答案 0 :(得分:1)

您的日志明确说明了错误:

  

警告::找不到HDF5运行时。

试试这个:

sudo python setup.py build_ext --inplace --hdf5=/opt/local --lzo=/opt/local --bzip2==opt/local

sudo python setup.py install --hdf5=/opt/local --lzo=/opt/local --bzip2==opt/local

答案 1 :(得分:0)

Take a look at the project site page。你可以手动下载dependeces(blosc),也许问题是由网络问题给出的,或者不能自动满足。如果你已经有了库,请尝试在安装过程中以这种方式指定:

python setup.py --blosc=/stuff/blosc-1.8.1

答案 2 :(得分:0)

您可以在安装过程中读到错误消息:

    找不到
  • HDF5: WARNING:: Could not find the HDF5 runtime.

  • 找不到
  • LZO(2或1): * Could not find LZO 2 headers and library; disabling support for it. * Could not find LZO 1 headers and library; disabling support for it.

  • 未找到Blosc,但似乎它可以使用PyTables附带的内部源。* Could not find blosc headers and library; using internal sources.就我而言,我还必须安装它才能使其正常工作。

您有两个选择:

a)您可以通过以下操作使用apt和pip安装这三个库:

sudo apt install python-blosc python-lzo
pip install h5py

b)或者,如果您使用的是Conda,请执行以下操作:

conda install h5py python-blosc python-lzo 

如果python-lzo安装失败,请尝试安装基础库:

sudo apt install liblzo2-dev

答案 3 :(得分:0)

我尝试了所有提供的解决方案,但没有一个奏效。我使用的是 python 3.9.2

我最终切换到 python 3.8.0 并且运行没有问题:pip install tables,它正确安装了表并且一切都按预期工作。

只是想我会添加这个作为任何碰巧与我处于相同情况的人的答案。