ERROR: Could not find a version that satisfies the requirement torch==1.5.1

引言

为了在集群上跑1000个模拟样本的SigprofilerExtractor工具,在集群上自己新建的环境里安装,解决安装bug,并成功使用。

解决bug思路

  • 发现依赖torch1.5.1版本

  • 通过pip install安装失败

  • 使用whl安装发现没有对应python3.9的版本

  • 根据版本推测1.5.1不能在python3.9安装

  • 重建新环境,安装python3.8,进而安装1.5.1

  • 成功

具体实施

使用sigprofilerextractor发现报错如下:

ERROR: Could not find a version that satisfies the requirement torch==1.5.1 (from sigprofilerextractor) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 1.7.1, 1.8.0, 1.8.1)
ERROR: No matching distribution found for torch==1.5.1

需要安装torch1.5.1版本,直接conda安装和pip安装都失败了 另外提示中表明可以通过source使用whl安装,网址如下:

Cannot install torch just with pip, try again with source from https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html

选择匹配版本,发现报错,其中网址中36指的是python3.6版本

ERROR: Could not install requirement torch==1.5.1+cpu from https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp39-cp39-linux_x86_64.whl because of HTTP error 403 Client Error: Forbidden for url: https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp39-cp39-linux_x86_64.whl for URL https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp39-cp39-linux_x86_64.whl

torch1.5.1没有支持3.9的版本,但是我的python是3.9的

(R4) [taozy@hpc-login-gpu01 ~]$ python
Python 3.9.1 | packaged by conda-forge | (default, Dec 21 2020, 22:08:58) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

创建一个新环境去跑sigprofilerextractor:sigminer环境,这个python是3.8的 先在这个环境里安装sigminer,使用conda安的时候老是出现以下报错

Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.

有可能是镜像的问题,换源 还没换源莫名其妙好了

Collecting package metadata (repodata.json): done
Solving environment: done

proceed yes之后继续下载 载入sigminer时有问题

> library(sigminer)
Error: package or namespace load failed for sigminer in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/slst/home/taozy/miniconda3/envs/sigminer/lib/R/library/data.table/libs/datatable.so':
  /slst/home/taozy/miniconda3/envs/sigminer/lib/R/library/data.table/libs/datatable.so: symbol GOMP_loop_nonmonotonic_dynamic_next, version GOMP_4.5 not defined in file libgomp.so.1 with link time reference
In addition: Warning message:
package sigminer was built under R version 4.0.5 
> install.packages("data.table")

是库的问题,重新安装data.table,解决 在python3.8下安装发现问题解决,torch1.5.1成功安装 运行时发现自动调用python3.9,通过py_path强制设定3.8版本

sigprofiler_extract(simulate.tally_X,
                    output = "PCAWG_1000",
                    range = 2:30,
                    nrun = 100,
                    init_method = "random",
                    is_exome = FALSE,
                    use_conda = FALSE,
                    py_path = "~/miniconda3/envs/sigminer/bin/python"
)

运行报错python3.8没有sigprofilerExtractor

python:         /slst/home/taozy/miniconda3/envs/sigminer/bin/python
libpython:      /public/slst/home/taozy/miniconda3/envs/sigminer/lib/libpython3.8.so
pythonhome:     /slst/home/taozy/miniconda3/envs/sigminer:/slst/home/taozy/miniconda3/envs/sigminer
version:        3.8.2 | packaged by conda-forge | (default, Mar  5 2020, 17:11:00)  [GCC 7.3.0]
numpy:          /slst/home/taozy/miniconda3/envs/sigminer/lib/python3.8/site-packages/numpy
numpy_version:  1.20.3

NOTE: Python version was forced by use_python function
Python module SigProfilerExtractor not found, try installing it...
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x2b8645858070>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/sigprofilerextractor/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x2b8645858c40>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/sigprofilerextractor/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x2b86458584f0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/sigprofilerextractor/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x2b8645858ac0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/sigprofilerextractor/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x2b864586a550>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/sigprofilerextractor/
ERROR: Could not find a version that satisfies the requirement SigProfilerExtractor==1.1.0 (from versions: none)
ERROR: No matching distribution found for SigProfilerExtractor==1.1.0
Error: Error installing package(s): 'SigProfilerExtractor==1.1.0'
Execution halted

指定该版本的工具进行安装

pip install SigProfilerExtractor==1.1.0

安装成功

Installing collected packages: joblib, threadpoolctl, scipy, scikit-learn, pillow, pyparsing, six, cycler, kiwisolver, python-dateutil, matplotlib, nimfa, pytz, pandas, seaborn, sigProfilerPlotting, patsy, statsmodels, SigProfilerMatrixGenerator, reportlab, psutil, PyPDF2, xlrd, SigProfilerExtractor
Successfully installed PyPDF2-1.26.0 SigProfilerExtractor-1.1.0 SigProfilerMatrixGenerator-1.1.30 cycler-0.10.0 joblib-1.0.1 kiwisolver-1.3.1 matplotlib-3.4.2 nimfa-1.4.0 pandas-1.2.4 patsy-0.5.1 pillow-8.2.0 psutil-5.8.0 pyparsing-2.4.7 python-dateutil-2.8.1 pytz-2021.1 reportlab-3.5.67 scikit-learn-0.24.2 scipy-1.6.3 seaborn-0.11.1 sigProfilerPlotting-1.1.15 six-1.16.0 statsmodels-0.12.2 threadpoolctl-2.1.0 xlrd-1.2.0

终于跑上了

/opt/gridview//pbs/dispatcher/mom_priv/jobs/2439514.node1.SC: line 16: out_dir: command not found
sigminer version 2.0.1
- Star me at https://github.com/ShixiangWang/sigminer
- Run hello() to see usage and citation.
Warning message:
package sigminer was built under R version 4.0.5 
Loading required namespace: reticulate
Python environment configuration.
====================
python:         /slst/home/taozy/miniconda3/envs/sigminer/bin/python
libpython:      /public/slst/home/taozy/miniconda3/envs/sigminer/lib/libpython3.8.so
pythonhome:     /slst/home/taozy/miniconda3/envs/sigminer:/slst/home/taozy/miniconda3/envs/sigminer
version:        3.8.2 | packaged by conda-forge | (default, Mar  5 2020, 17:11:00)  [GCC 7.3.0]
numpy:          /slst/home/taozy/miniconda3/envs/sigminer/lib/python3.8/site-packages/numpy
numpy_version:  1.20.3

NOTE: Python version was forced by use_python function

************** Reported Current Memory Use: 0.41 GB *****************

Extracting signature 2 for mutation type 176
The matrix normalizig cutoff is 17600

参考: