问题描述
在安装sentry包时,系统出现如下报错信息:
Building wheels for collected packages: xmlsec
Building wheel for xmlsec (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /root/.virtualenvs/sentryenv/bin/python /root/.virtualenvs/sentryenv/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpMPk1Y6
cwd: /tmp/pip-install-vXibQv/xmlsec
Complete output (14 lines):
running bdist_wheel
running build
running build_py
package init file 'src/xmlsec/__init__.py' not found (or not a regular file)
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/xmlsec
copying src/xmlsec/py.typed -> build/lib.linux-x86_64-2.7/xmlsec
copying src/xmlsec/constants.pyi -> build/lib.linux-x86_64-2.7/xmlsec
copying src/xmlsec/template.pyi -> build/lib.linux-x86_64-2.7/xmlsec
copying src/xmlsec/__init__.pyi -> build/lib.linux-x86_64-2.7/xmlsec
copying src/xmlsec/tree.pyi -> build/lib.linux-x86_64-2.7/xmlsec
running build_ext
error: xmlsec1 is not installed or not in path.
----------------------------------------
ERROR: Failed building wheel for xmlsec
Failed to build xmlsec
ERROR: Could not build wheels for xmlsec which use PEP 517 and cannot be installed directly
问题分析
错误指出不能通过轮子的方式直接安装xmlsec模块。查找相关错误,没有具体的,但是借鉴’ERROR: Could not build wheels for bottleneck which use PEP 517 and cannot be installed directly’ #281
这一类似问题可以明确是在安装xmlsec模块上除了问题。所以尝试重新安装xmlsec模块
解决办法
直接通过pip进行xmlsec模块的安装,报错。所以查询了pypi-xmlsec库,可以看到在pip安装前,该模块针对不同的操作系统还会有相关的依赖。
先安装相关依赖文件:
Linux (Debian)
apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl
Note: There is no required version of LibXML2 for Ubuntu Precise, so you need to download and install it manually.
wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz
tar -xvf libxml2-2.9.1.tar.gz
cd libxml2-2.9.1
./configure && make && make install
Linux (CentOS)
yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
Linux (Fedora)
dnf install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
Mac
brew install libxml2 libxmlsec1 pkg-config
Alpine
apk add build-base libressl libffi-dev libressl-dev libxslt-dev libxml2-dev xmlsec-dev xmlsec
再使用pip install 命令安装
Install
xmlsec is available on PyPI:
pip install xmlsec