错误:无法安装 en-core-web-trf,因为这些软件包版本具有冲突的依赖项

问题描述 投票:0回答:3

我使用以下命令(来自spacy网站这里)在Windows 10 home 64位下安装spacy和en_core_web_trf,但是,我在运行最后一个(第三行)命令时遇到了问题。

pip install -U pip setuptools wheel
pip install -U spacy
python -m spacy download en_core_web_trf

错误:

INFO: pip is looking at multiple versions of en-core-web-trf to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install en-core-web-trf because these package versions have conflicting dependencies.

The conflict is caused by:
    spacy-transformers 1.1.4 depends on torch>=1.6.0
    spacy-transformers 1.1.3 depends on torch>=1.6.0
    spacy-transformers 1.1.2 depends on torch>=1.6.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/user_guide/#fixing-conflicting-dependencies

有谁知道怎么解决吗?谢谢!我整个晚上都被困在这里。

卸载 spacy 并使用

pip install spacy-transformers -f https://download.pytorch.org/whl/torch_stable.html

重新安装后出现错误更新
ERROR: Cannot install spacy-transformers==0.5.0, spacy-transformers==0.5.1, spacy-transformers==0.5.2, spacy-transformers==0.5.3, spacy-transformers==0.6.1, spacy-transformers==0.6.2, spacy-transformers==1.0.0, spacy-transformers==1.0.1, spacy-transformers==1.0.2, spacy-transformers==1.0.3, spacy-transformers==1.0.4, spacy-transformers==1.0.5, spacy-transformers==1.0.6, spacy-transformers==1.1.0, spacy-transformers==1.1.1, spacy-transformers==1.1.2, spacy-transformers==1.1.3 and spacy-transformers==1.1.4 because these package versions have conflicting dependencies.

The conflict is caused by:
    spacy-transformers 1.1.4 depends on torch>=1.6.0
    spacy-transformers 1.1.3 depends on torch>=1.6.0
    spacy-transformers 1.1.2 depends on torch>=1.6.0
    spacy-transformers 1.1.1 depends on torch>=1.6.0
    spacy-transformers 1.1.0 depends on torch>=1.6.0
    spacy-transformers 1.0.6 depends on torch>=1.5.0
    spacy-transformers 1.0.5 depends on torch>=1.5.0
    spacy-transformers 1.0.4 depends on torch>=1.5.0
    spacy-transformers 1.0.3 depends on torch>=1.5.0
    spacy-transformers 1.0.2 depends on torch>=1.5.0
    spacy-transformers 1.0.1 depends on torch>=1.5.0
    spacy-transformers 1.0.0 depends on torch>=1.5.0
    spacy-transformers 0.6.2 depends on spacy<2.4.0 and >=2.3.0
    spacy-transformers 0.6.1 depends on spacy<2.4.0 and >=2.3.0
    spacy-transformers 0.5.3 depends on spacy<2.3.0 and >=2.2.1
    spacy-transformers 0.5.2 depends on spacy<2.3.0 and >=2.2.1
    spacy-transformers 0.5.1 depends on spacy<2.3.0 and >=2.2.1
    spacy-transformers 0.5.0 depends on spacy<2.3.0 and >=2.2.1

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
python pip nlp spacy
3个回答
0
投票

对我来说,我通过安装 PyTorch 解决了这个问题。这就是“冲突”的含义。我还想警告您应该确保 spaCy、PyTorch 和 Python 都是兼容的。对我来说这意味着以下

Python 3.10 斯帕西3.7.2 PyTorch 2.1.2

我运行的命令是:

\Python310\python.exe -m venv .venv
.\.venv\Scripts\Activate.ps1
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install -U pip setuptools wheel
pip install -U 'spacy[cuda12x]'
python -m spacy download en_core_web_trf

-1
投票

尝试:

pip uninstall spacy-transformers 1.1.4

pip uninstall spacy-transformers 1.1.3

pip uninstall spacy-transformers 1.1.2

然后执行:

pip install spacy-transformers -f https://download.pytorch.org/whl/torch_stable.html

您可以在https://pypi.org/project/spacy-transformers/

找到完整的安装过程

-1
投票

为与我有同样问题的人提供信息。

提到的问题最终没有解决,至少我尝试了重新安装软件包,重新安装python(在重新安装之前完全卸载了它)。对我来说没有任何作用。

我最后是如何避免这种情况的?

我完全卸载了python。

安装Anaconda(最新版本),安装Anaconda的同时,也默认安装了pip和python。然后我在windows命令行中使用

pip install XX
,无论是安装spacy,还是安装requirements.txt,都运行良好。这就是我如何避免上述问题的方法。

希望对同样遇到此问题的人有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.