安装RSeQC时pyBigWig的setup.py运行报错(Win10 Python3.8)
安装RSeQC时pyBigWig依赖报错解决
问题背景
- 安装场景:在conda创建的Python 3.8虚拟环境中安装RSeQC,操作系统为Windows 10 Pro
- 报错触发阶段:pip安装到依赖pyBigWig,执行setup.py生成元数据阶段失败
- 核心报错信息:
AttributeError: 'NoneType' object has no attribute 'split'
报错位置为pyBigWig安装包的setup.py第24行,代码尝试读取sysconfig.get_config_vars('BLDLIBRARY')的返回值并做分割操作,但该接口在当前环境返回了空值None,导致流程中断。
完整终端执行日志如下:
(python3.8) C:\Users\me>pip --version pip 22.1.2 from C:\Users\me\Anaconda3\envs\python3.8\lib\site-packages\pip (python 3.8) (python3.8) C:\Users\me>pip install RSeQC Collecting RSeQC Downloading RSeQC-4.0.0-py3-none-any.whl (133 kB) ---------------------------------------- 133.6/133.6 kB 438.8 kB/s eta 0:00:00 Collecting bx-python Downloading bx-python-0.8.13.tar.gz (1.4 MB) ---------------------------------------- 1.4/1.4 MB 1.0 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting cython>=0.17 Using cached Cython-0.29.30-py2.py3-none-any.whl (985 kB) Collecting pyBigWig Downloading pyBigWig-0.3.18.tar.gz (64 kB) ---------------------------------------- 64.8/64.8 kB 699.9 kB/s eta 0:00:00 Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "C:\Users\me\AppData\Local\Temp\pip-install-j0xpd3pz\pybigwig_d3408484097f434884b2c8954968140e\setup.py", line 24, in <module> for e in sysconfig.get_config_vars('BLDLIBRARY')[0].split(): AttributeError: 'NoneType' object has no attribute 'split' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.
解决方法
- 优先使用conda安装pyBigWig预编译包,避开pip源码编译的适配问题:
- 激活当前Python 3.8的conda虚拟环境
- 执行命令
conda install -c bioconda pybigwig,等待安装完成,该渠道提供的包已经提前完成Windows平台编译,不会出现配置变量缺失的问题 - pyBigWig安装完成后,再执行
pip install RSeQC即可完成全部安装
- 若必须使用pip安装,先补全编译依赖:
在虚拟环境中执行conda install libpython m2w64-toolchain cython,安装Windows平台下C扩展编译所需的工具链和配置文件,修复sysconfig中BLDLIBRARY变量为空的问题,之后再执行pip安装命令即可。
注意:Windows平台下安装带C扩展的生物信息学类Python包时,尽量优先使用bioconda源的预编译版本,直接用pip从源码编译大概率会遇到各类环境配置、依赖缺失的问题。
内容的提问来源于stack exchange,提问作者Giamma Fer
相关产品推荐
相关产品推荐

