安装MACS2报错install_requires must be a string和etuptools.installer and fetch_build_eggs are deprecated

安装 MACS2 报错“install_requires must be a string or list of strings containing valid project/version requirement specifiers" 和“setuptools.installer and fetch_build_eggs are deprecated”

软件官网:https://hbctraining.github.io/Intro-to-ChIPseq/lessons/05_peak_calling_macs.html

  1. 怎么说呢,软件不大,但安的时候报错不少!最开始是用 pip install 安装,报错如下

pip install --upgrade macs2
# 命令运行日志
Collecting macs2
  Using cached MACS2-2.2.7.1.tar.gz (2.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [4 lines of output]
      Requirement already satisfied: numpy>=1.17 in /tmp/pip-build-env-jv0u2l_s/overlay/lib/python3.8/site-packages (1.24.2)
      error in MACS2 setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after name and no valid version specifier)
          numpy>=>=1.17
               ^
      [end of output]

之后也试了 conda install macs2,同样报错,

  1. 最后不得不选择源码安装的方式,但该方式需要手动安装依赖包

源码下载地址 PyPi https://pypi.org/project/MACS2/,解压然后进入文件夹

虚拟环境创建方法

# 先创建虚拟环境,在虚拟环境里边安装
# 记得下载最新版
wget https://files.pythonhosted.org/packages/e2/61/85d30ecdd34525113e28cb0c5a9f393f93578165f8d848be5925c0208dfb/MACS2-2.2.7.1.tar.gz
tar zxvf MACS2-2.2.7.1.tar.gz
cd MACS2-2.2.7.1
  1. INSTALL.md 是软件安装信息,README.md 是软件使用信息

安装MACS2报错install_requires must be a string和etuptools.installer and fetch_build_eggs are deprecated_第1张图片
  1. 查看安装环境以及依赖包是否正常,发现需要手动安装umap-learn,scanpy,anndata,这些包通过 pip install 方式安装即可,比较顺利

python setup.py --help
# 运行日志
Collecting numpy>=1.17
  Using cached numpy-1.24.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)
Installing collected packages: numpy
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
umap-learn 0.5.2 requires numba>=0.49, which is not installed.
umap-learn 0.5.2 requires scikit-learn>=0.22, which is not installed.
umap-learn 0.5.2 requires scipy>=1.0, which is not installed.
umap-learn 0.5.2 requires tqdm, which is not installed.
scanpy 1.8.2 requires h5py>=2.10.0, which is not installed.
scanpy 1.8.2 requires joblib, which is not installed.
scanpy 1.8.2 requires matplotlib>=3.1.2, which is not installed.
scanpy 1.8.2 requires networkx>=2.3, which is not installed.
scanpy 1.8.2 requires numba>=0.41.0, which is not installed.
scanpy 1.8.2 requires packaging, which is not installed.
scanpy 1.8.2 requires pandas>=0.21, which is not installed.
scanpy 1.8.2 requires patsy, which is not installed.
scanpy 1.8.2 requires scikit-learn>=0.22, which is not installed.
scanpy 1.8.2 requires scipy>=1.4, which is not installed.
scanpy 1.8.2 requires seaborn, which is not installed.
scanpy 1.8.2 requires statsmodels>=0.10.0rc2, which is not installed.
scanpy 1.8.2 requires tables, which is not installed.
scanpy 1.8.2 requires tqdm, which is not installed.
anndata 0.7.8 requires h5py, which is not installed.
anndata 0.7.8 requires packaging>=20, which is not installed.
anndata 0.7.8 requires pandas>=1.1.1, which is not installed.
anndata 0.7.8 requires scipy>1.4, which is not installed.
anndata 0.7.8 requires xlrd<2.0, which is not installed.

# 安装 umap-learn,scanpy,anndata
pip install umap-learn
pip install scanpy
pip install anndata
  1. 再次检查安装环境和依赖包,仍然报错,报错信息显示:setuptools.installer and fetch_build_eggs are deprecated. Requirements should be satisfied by a PEP 517 installer. 表明很可能是 setuptools 包出现问题,之后尝试了卸载并重新安装 setuptools,但仍然不能解决问题

python setup.py --help
Requirement already satisfied: numpy>=1.17 in /home/hanjiangang/anaconda3/envs/scenic/lib/python3.8/site-packages (1.23.5)
/home/hanjiangang/anaconda3/envs/scenic/lib/python3.8/site-packages/setuptools/__init__.py:85: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. Requirements should be satisfied by a PEP 517 installer. If you are using pip, you can try `pip install --use-pep517`.
  dist.fetch_build_eggs(dist.setup_requires)
  1. 后来发现别人也遇到过类似的报错,可能是因为 setuptools 版本不匹配的问题(我用的是最新版本),于是安装低版本的 setuptools,同时查看 setuptools 官网 发现建议安装build 模块,该模块可提供一种更加简单轻便的安装方式。

pip install --upgrade 'setuptools<44'
pip install --upgrade build
  1. 不知道这两个模块哪个帮助解决了问题,重新检查安装环境和依赖包,正常

python setup.py --help
# 命令日志
Requirement already satisfied: numpy>=1.17 in /home/hanjiangang/anaconda3/envs/scenic/lib/python3.8/site-packages (1.23.5)
Common commands: (see '--help-commands' for more)

  setup.py build      will build the package underneath 'build/'
  setup.py install    will install the package

Global options:
  --verbose (-v)      run verbosely (default)
  --quiet (-q)        run quietly (turns verbosity off)
  --dry-run (-n)      don't actually do anything
  --help (-h)         show detailed help message
  --no-user-cfg       ignore pydistutils.cfg in your home directory
  --command-packages  list of packages that provide distutils commands
  1. 通过 python install 方式安装,如果是 pip install . 方式安装,仍然会报错

最后成功安装

python setup.py install
# 命令日志
Requirement already satisfied: numpy>=1.17 in /home/hanjiangang/anaconda3/envs/scenic/lib/python3.8/site-packages (1.23.5)
running install
running bdist_egg

pip show macs2
# 命令日志
Name: MACS2
Version: 2.2.7.1
Summary: Model Based Analysis for ChIP-Seq data
Home-page: http://github.com/taoliu/MACS/
Author: Tao Liu
Author-email: [email protected]
License: UNKNOWN
Location: /home/hanjiangang/anaconda3/envs/scenic/lib/python3.8/site-packages/MACS2-2.2.7.1-py3.8-linux-x86_64.egg
Requires: numpy

python
import MACS2

你可能感兴趣的:(Bug,处理,Python,python)