Установите h5py без sudo

Я пытаюсь установить пакет h5py через pip для python 2.7, я не могу использовать sudo, и у меня тоже установлен python 3.2.

Вот моя попытка:

Я установил пип:

curl -O https://bootstrap.pypa.io/get-pip.py
python2.7 get-pip.py --user

затем я установил wheel

~/.local/bin/pip2.7 install --user wheel

Collecting wheel
/home/myuser/.local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/home/myuser/.local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached wheel-0.29.0-py2.py3-none-any.whl
Installing collected packages: wheel
Successfully installed wheel-0.29.0

Потом установил h5py, вроде не получилось.

~/.local/bin/pip2.7 install --user h5py

Collecting h5py
  Using cached h5py-2.5.0.tar.gz
/usr/lib/python2.7/dist-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pip was already imported from /home/myuser/.local/lib/python2.7/site-packages/pip/__init__.pyc, but /usr/lib/python2.7/dist-packages is being added to sys.path
  from pkg_resources import Distribution, PathMetadata, ensure_directory
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.1 in /usr/lib/python2.7/dist-packages (from h5py)
Requirement already satisfied (use --upgrade to upgrade): Cython>=0.17 in /home/myuser/.local/lib/python2.7/site-packages (from h5py)
Requirement already satisfied (use --upgrade to upgrade): six in /home/myuser/.local/lib/python2.7/site-packages (from h5py)
Building wheels for collected packages: h5py
  Running setup.py bdist_wheel for h5py ... error
  Complete output from command /usr/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-7KTR1Y/h5py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpE1KVSupip-wheel- --python-tag cp27:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for h5py
  Running setup.py clean for h5py
Failed to build h5py
Installing collected packages: h5py
  Running setup.py install for h5py ... done
Successfully installed h5py-2.5.0

запустить питон через python2.7

Python 2.7.3 (default, Feb 27 2014, 19:58:35) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import h5py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/myuser/.local/lib/python2.7/site-packages/h5py/__init__.py", line 23, in <module>
    from . import _conv
  File "h5py/h5r.pxd", line 21, in init h5py._conv (/tmp/pip-build-7KTR1Y/h5py/h5py/_conv.c:7356)
  File "h5py/_objects.pxd", line 12, in init h5py.h5r (/tmp/pip-build-7KTR1Y/h5py/h5py/h5r.c:2941)
  File "h5py/_objects.pyx", line 1, in init h5py._objects (/tmp/pip-build-7KTR1Y/h5py/h5py/_objects.c:7226)
ImportError: /home/myuser/.local/lib/python2.7/site-packages/h5py/defs.so: undefined symbol: H5Oexists_by_name 

Что я делаю неправильно?

Обновление:

~/.local/bin/pip2.7 show h5py

---
Metadata-Version: 1.1
Name: h5py
Version: 2.5.0
Summary: Read and write HDF5 files from Python
Home-page: http://www.h5py.org
Author: Andrew Collette
Author-email: andrew dot collette at gmail dot com
License: UNKNOWN
Location: /home/myuser/.local/lib/python2.7/site-packages
Requires: numpy, Cython, six

Моя ОС — Ubuntu 12.04.1 LTS.


person mrgloom    schedule 19.02.2016    source источник
comment
Какая ОС? Какая версия HDF5 у вас установлена?   -  person James Tocknell    schedule 20.02.2016
comment
@aragilar смотрите обновление.   -  person mrgloom    schedule 20.02.2016
comment
Это h5py, а не HDF5. Исключение импорта жалуется на соединение между h5py и HDF5, что может быть связано с некоторой проблемой версии. См. bugs.launchpad.net/ubuntu/+source/hdf5/+bug /1418220, что на самом деле может быть вашей проблемой.   -  person James Tocknell    schedule 21.02.2016


Ответы (1)


Итак, здесь происходит несколько вещей:

  1. Проблемы с отсутствием SSL-сертификата (см. ссылку urllib3)
  2. setuptools не находит wheel, то есть колесо не построено, поэтому pip вызывает python setup.py install напрямую
  3. h5py пытается использовать функцию HDF5, которой нет в версии HDF5 в вашей системе.

1 и 2 стоит исправить (поскольку они могут быть симптомами других проблем с системой), но 3 является причиной того, что h5py у вас не работает.

h5py пытается получить доступ к H5Oexists_by_name. Согласно https://www.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-ExistsByName впервые появилось в версии 1.8.5 HDF5. Согласно http://packages.ubuntu.com/source/precise/hdf5, версия HDF5 в вашей системе 1.8.4 (но это нужно проверить!). Почему-то h5py считает, что в вашей системе используется библиотека HDF5 версии 1.8.5 или выше (см. ">https://github.com/h5py/h5py/blob/4ee8f89b6dc658fdea5dc62d0f29058121928cfe/h5py/h5o.pyx#L172)

Похоже, кто-то еще столкнулся с похожей проблемой и отправил https://bugs.launchpad.net/ubuntu/+source/hdf5/+bug/1418220. Вы, вероятно, хотите сообщить им о своей проблеме, чтобы они могли исправить ошибку.

person James Tocknell    schedule 21.02.2016