配置 MLTP:win10+PyCharm+conda

回顾:

2022-05-20,CNGB-shenzhen,本地个人电脑,win10专业版,RTX2060

昨天配置了一下 MLBP:https://github.com/xialab-ahu/MLBP,跑了测试数据成功,其实也遇到一些小BUG,主要有几点:

  • bio==0.1.0 问题,提示没有0.1.0版本,使用 pip install Bio 命令安装1.3.8版本也能用,
  • conda 安装版本问题严重,注意使用 pip 安装
  • CUDA 版本问题,之前系统中有 CUDA10.2,MLBP项目使用 CUDA9.0

今天做一个记录,配置并运行 MLTP:https://github.com/xialab-ahu/MLTP


过程:

首先下载 MLTP 项目,双击 predictor.py 用 PyCharm 以 project 打开,并查看 requirements.txt。
requirements.txt


然后创建 conda 虚拟环境:

在这里插入图片描述
报错:
在这里插入图片描述
pycharm 改回默认源:https://pypi.python.org/simple,依然不行。

You will need to adjust your conda configuration to proceed.
Use 'conda config —show channels’ to view your configuration's current state,and use 'conda config --show-sources'to view config file locations.

哈哈,其实应该使用以下语句恢复(conda)到默认源:

conda config --remove-key channels
创建成功:

在这里插入图片描述


requirements.txt 中 tensorflow-gpu==1.12.0,我已经安装了 CUDA9.0 :
cuda_9.0.176_win10 + cudnn-9.0-windows10-x64-v7.6.5.32

安装依赖项:

先智能安装:
在这里插入图片描述
下方显示进度:(比较慢,得等)
在这里插入图片描述
网速太慢了,尝试换自己的网:
在这里插入图片描述
因为依赖项(包)太多(102项),所以比昨天时间更长 ☹ 一直是0~几k/s。

吃饭ing

激活虚拟环境

conda activate MLTP

安装 bio

pip install Bio

将 bio==0.1.0 注释掉,然后 pip install -r requirements.txt 安装剩余依赖项(包)

其实这里走了弯路,可以先安装 bio,将 bio==0.1.0 注释掉,然后 pip install -r requirements.txt 安装剩余依赖项(包),因为智能安装不是很智能

报错:

ERROR: Could not find a version that satisfies the requirement TBB==0.1 (from versions: 2018.0.4, 2019.0, 2020.3.254,
 2021.1.1, 2021.2.0, 2021.3.0, 2021.4.0, 2021.5.0, 2021.5.1, 2021.5.2, 2021.6.0)
ERROR: No matching distribution found for TBB==0.1

先试一试:pip install TBB , 将TBB==0.1注释掉

(MLTP) D:\BGI\05.ARG\MLTP-main>pip install TBB
Collecting TBB
  Downloading tbb-2021.6.0-py3-none-win_amd64.whl (278 kB)
     |████████████████████████████████| 278 kB 656 kB/s
Installing collected packages: TBB
Successfully installed TBB-2021.6.0

继续 pip install -r requirements.txt 安装剩余依赖项(包)
有意思的是:

INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter 
constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. 
To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking

没事更新一下 pip

python -m pip install --upgrade pip

继续安装,报错:

ERROR: Cannot install -r requirements.txt (line 41) and Keras==2.2.4 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested Keras==2.2.4
    keras-bert 0.86.0 depends on Keras>=2.4.3

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

(MLTP) D:\BGI\05.ARG\MLTP-main>

难搞吽,因为 TensorFlow 1.12.0 + Keras 2.2.4 on Python 3.6 ,不好改。keras-bert 不乐意了。
选择 2. pip install keras-bert,删除包版本以允许pip尝试解决依赖关系冲突

Collecting keras-bert
  Downloading keras-bert-0.89.0.tar.gz (25 kB)

继续安装:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behav
iour is the source of the following dependency conflicts.
keras-bert 0.89.0 requires keras-transformer==0.40.0, but you have keras-transformer 0.38.0 which is incompatible.   

keras-bert 0.89.0需要keras-transformer==0.40.0,但是您的keras-transformer 0.38.0不兼容。
重装试试:

 1. pip uninstall keras-transformer 
 2. pip install keras-transformer

结果爆炸:keras- 一系列版本不兼容
网上搜索,发现 keras_bert == 0.83.0,Keras == 2.2.4
卸载重装:

pip uninstall keras_bert
pip uninstall keras-transformer

pip install keras_bert==0.83.0

保持 keras-transformer==0.38.0
结果:

Successfully installed keras-embed-sim-0.8.0 keras-layer-normalization-0.14.0 keras-multi-head-0.27.0 
keras-pos-embd-0.11.0 keras-position-wise-feed-forward-0.6.0 keras-self-attention-0.46.0 keras-transformer-0.38.0

测试:

报错:

(MLTP) D:\BGI\05.ARG\MLTP-main>python predictor.py --file test.fasta --out_path result
Traceback (most recent call last):
  File "predictor.py", line 9, in <module>
    from model import MultiHeadAttention
ModuleNotFoundError: No module named 'model'

ModuleNotFoundError 在 MLTP文件夹下 model.py 中

import sys
sys.path.append("./MLTP")

测试tensorflow:

(MLTP) D:\BGI\05.ARG\MLTP-main>python Python 3.6.13 |Anaconda, Inc.| (default, Mar 16 2021, 11:37:27) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow D:\RJcst\Anaconda3\envs\MLTP\lib\site-packages\scipy\__init__.py:147: UserWarning: NumPy 1.14.5 or above is required  for this version of SciPy (detected version 1.14.3)   UserWarning)
>>>

NumPy版本问题
参考:https://blog.csdn.net/mao_hui_fei/article/details/89318038
解决方案:先卸载numpy,再卸载numpy,直到卸载到提示信息显示,此时完全已经没有numpy了为止
然后下载numpy

pip install numpy==1.18.3

继续:

(MLTP) D:\BGI\05.ARG\MLTP-main>python predictor.py --file test.fasta --out_path result
Using TensorFlow backend.
D:\RJcst\Anaconda3\envs\MLTP\lib\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (typ
2022-05-20 15:59:16.437896: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties: 
name: NVIDIA GeForce RTX 2060 major: 7 minor: 5 memoryClockRate(GHz): 1.755
pciBusID: 0000:01:00.0
totalMemory: 6.00GiB freeMemory: 5.02GiB
2022-05-20 15:59:16.438121: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0   
2022-05-20 15:59:17.199671: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecuto
r with strength 1 edge matrix:
2022-05-20 15:59:17.199840: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988]      0
2022-05-20 15:59:17.199929: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0:   N
2022-05-20 15:59:17.200305: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:
localhost/replica:0/task:0/device:GPU:0 with 4757 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce RTX 206
0, pci bus id: 0000:01:00.0, compute capability: 7.5)

(MLTP) D:\BGI\05.ARG\MLTP-main>

运行成功,生成结果:result/result.txt

>sequence1
functions:ACP
>sequence2
functions:ACP
>sequence3
functions:ACP,AVP
>sequence4
functions:ABP,ACP
>sequence5
functions:ACP

完美!


总结:

  • 安装时还是使用 pip install -r requirements.txt 比较靠谱
  • NumPy版本问题需要注意,别装多了
  • 这里没有反映CUDA版本问题,因为之前已经解决了,实际上CUDA版本兼容问题需要十分注意
    tensorflow_gpu-1.12.0
    Python3.6
    CUDA9.0
    cuDNN7+
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值