LmeSzinc / AzurLaneAutoScript

Azur Lane bot (CN/EN/JP/TW) 碧蓝航线脚本 | 无缝委托科研,全自动大世界
https://alas.azurlane.cloud
GNU General Public License v3.0
6.93k stars 832 forks source link

[Linux] Python依赖冲突 (Python dependency conflicts) #4163

Closed Naming-isDifficult closed 2 months ago

Naming-isDifficult commented 2 months ago

在提问之前...

描述你的问题

我个人由于没有sudo权限,无法使用docker安装alas,在尝试手动安装环境时出现了依赖冲突无法解决的问题

如何复现

运行的命令如下,假定cwd == "./AzurLaneAutoScript"

conda clean -a
conda create -n alas python==3.7.6
conda activate alas
pip cache purge
pip install -r requirements.txt

预期行为

ERROR: Cannot install -r requirements.txt (line 32), -r requirements.txt (line 48), -r requirements.txt (line 8) and requests==2.18.4 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested requests==2.18.4
    adbutils 0.11.0 depends on requests
    gluoncv 0.6.0 depends on requests
    mxnet 1.6.0 depends on requests<3 and >=2.20.0

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/topics/dependency-resolution/#dealing-with-dependency-conflicts

相关 Logs

No response

截图

No response

还有别的吗?

OS: Ubuntu 22.04.4 LTS x86_64
Kernel: 6.8.0-40-generic
CPU: 13th Gen Intel i5-13600KF
GPU: Nvidia RTX 4070 super
Memory: 32GB

Anaconda version: 24.5.0

另外,我手动从requirements.txt中移除了pywin32,因为Linux本身不支持Windows API并且Pypl也只提供了Windows版wheel,我个人也相信即便提供了源码供编译Linux上也无法编译成功

Naming-isDifficult commented 2 months ago

English ver.

Describe the bug

Cuz I don't have access to sudo, I have to manually install Alas on my Linux machine. However, it seems that it is impossible to resolve some conflicts between dependencies.

To Reproduce

Suppose cwd = "./AzurLaneAutoScript", one could run the following commands:

conda clean -a
conda create -n alas python==3.7.6
conda activate alas
pip cache purge
pip install -r requirements.txt

Expected behavior

ERROR: Cannot install -r requirements.txt (line 32), -r requirements.txt (line 48), -r requirements.txt (line 8) and requests==2.18.4 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested requests==2.18.4
    adbutils 0.11.0 depends on requests
    gluoncv 0.6.0 depends on requests
    mxnet 1.6.0 depends on requests<3 and >=2.20.0

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/topics/dependency-resolution/#dealing-with-dependency-conflicts

Anything else?

OS: Ubuntu 22.04.4 LTS x86_64
Kernel: 6.8.0-40-generic
CPU: 13th Gen Intel i5-13600KF
GPU: Nvidia RTX 4070 super
Memory: 32GB

Anaconda version: 24.5.0

FIY, I removed pywin32 from requirements.txt cuz Linux does not support Windows API. Additionally, Pypl only provides wheels built for Windows, and even if the source code is provided, I doubt if I can compile it on Linux.

Naming-isDifficult commented 2 months ago

一个可行的解决方案是把requirements.txtrequests==2.18.4改成requests==2.20.0,至少能安装能跑。理论上应该可以稳定运行但我不确定,我不是很熟悉request库。

A possible resolution is to change requests==2.18.4 into requests==2.20.0. At least you will be able to install all dependencies and run the application. It should be stable, I believe, but I'm not 100% sure. I'm not familiar with request.

guoh064 commented 2 months ago

用requirements-in.txt试试。

Naming-isDifficult commented 2 months ago

用requirements-in.txt试试。

试了一下确实可以,但相对的requests版本来到了2.31.0,别的依赖也有很多版本和requirements.txt中要求的不符,可以理解成alas对依赖的版本的限制没有那么死吗?requirements.txt中基本都是用==规定版本

guoh064 commented 2 months ago

我的理解,因为windows和非windows上有区别,所以库的选取也不一样。至于怎么理解可能只能问开发者了

LmeSzinc commented 2 months ago

使用 ./deploy/docker/requirements.txt,同级目录下也有 dockerfile

Naming-isDifficult commented 2 months ago

使用 ./deploy/docker/requirements.txt,同级目录下也有 dockerfile

好的,感谢。

另外如果这样的话wiki中安装部分是否需要更新?Linux相关的部分还是

pip install -r requirements.txt

而实际上应该是

pip install -r ./deploy/docker/requirements.txt

pip install -r requirements-in.txt

注: 我用diff看了一下这俩几乎一样,除了requirements-in.txt还多一个alas-webapp以及./deploy/docker/requirements.txt中使用的是opencv-python-headless,我大致翻看了一下GUI相关的代码,至少目前没看到需要调用和GUI相关的opencv方法,暂且认为这俩可以互换

我个人没用过github的wiki不太敢自己上手折腾就是()

我这边也没更多别的问题了,就先把issue关闭了()