如何解决texthero安装错误?

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

当我尝试在 Google Colab 上

!pip install texthero
时,发生以下错误,因此我无法导入 texthero。

  • pip安装代码
!pip install texthero
  • 结果消息在
    pip install
  • 后出现错误
Collecting texthero
  Downloading texthero-1.1.0-py3-none-any.whl (24 kB)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Collecting gensim<4.0,>=3.6.0 (from texthero)
  Downloading gensim-3.8.3.tar.gz (23.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.4/23.4 MB 22.2 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Building wheels for collected packages: gensim
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for gensim (setup.py) ... error
  ERROR: Failed building wheel for gensim
  Running setup.py clean for gensim
Failed to build gensim
ERROR: Could not build wheels for gensim, which is required to install pyproject.toml-based projects
  • import texthero as hero
    后出现错误消息
    
ModuleNotFoundError: No module named 'texthero'
    
python nlp gensim data-preprocessing
2个回答
0
投票
可能是因为不同版本的库之间不兼容的问题。你可以指定特定的版本

!pip install gensim==3.6.0 !pip install texthero==1.1.0
这个版本有效我已经尝试过

输出:

Collecting gensim==3.6.0 Downloading gensim-3.6.0.tar.gz (23.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.1/23.1 MB 57.0 MB/s eta 0:00:00 Preparing metadata (setup.py) ... done Requirement already satisfied: numpy>=1.11.3 in /usr/local/lib/python3.10/dist-packages (from gensim==3.6.0) (1.22.4) Requirement already satisfied: scipy>=0.18.1 in /usr/local/lib/python3.10/dist-packages (from gensim==3.6.0) (1.10.1) Requirement already satisfied: six>=1.5.0 in /usr/local/lib/python3.10/dist-packages (from gensim==3.6.0) (1.16.0) Requirement already satisfied: smart_open>=1.2.1 in /usr/local/lib/python3.10/dist-packages (from gensim==3.6.0) (6.3.0) Building wheels for collected packages: gensim Building wheel for gensim (setup.py) ... done Created wheel for gensim: filename=gensim-3.6.0-cp310-cp310-linux_x86_64.whl size=23916489 sha256=7bfecf602e2e3f97fe2d27228073b7c0feacf8c40dbab0e4657759157d5c66f8 Stored in directory: /root/.cache/pip/wheels/00/e8/47/96f55c3144a5ea3537f549f7a97607011f5004b9f13fa8dcc5 Successfully built gensim Installing collected packages: gensim Attempting uninstall: gensim Found existing installation: gensim 4.3.1 Uninstalling gensim-4.3.1: Successfully uninstalled gensim-4.3.1 Successfully installed gensim-3.6.0 Collecting texthero==1.1.0 Using cached texthero-1.1.0-py3-none-any.whl (24 kB) Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from texthero==1.1.0) (1.22.4) Requirement already satisfied: scikit-learn>=0.22 in /usr/local/lib/python3.10/dist-packages (from texthero==1.1.0) (1.2.2) Collecting spacy<3.0.0 (from texthero==1.1.0) Using cached spacy-2.3.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB) Requirement already satisfied: tqdm>=4.3 in /usr/local/lib/python3.10/dist-packages (from texthero==1.1.0) (4.65.0) Requirement already satisfied: nltk>=3.3 in /usr/local/lib/python3.10/dist-packages (from texthero==1.1.0) (3.8.1) Requirement already satisfied: plotly>=4.2.0 in /usr/local/lib/python3.10/dist-packages (from texthero==1.1.0) (5.13.1) Requirement already satisfied: pandas>=1.0.2 in /usr/local/lib/python3.10/dist-packages (from texthero==1.1.0) (1.5.3) Requirement already satisfied: wordcloud>=1.5.0 in /usr/local/lib/python3.10/dist-packages (from texthero==1.1.0) (1.8.2.2) Collecting unidecode>=1.1.1 (from texthero==1.1.0) Using cached Unidecode-1.3.6-py3-none-any.whl (235 kB) Requirement already satisfied: gensim<4.0,>=3.6.0 in /usr/local/lib/python3.10/dist-packages (from texthero==1.1.0) (3.6.0) Requirement already satisfied: matplotlib>=3.1.0 in /usr/local/lib/python3.10/dist-packages (from texthero==1.1.0) (3.7.1) Requirement already satisfied: scipy>=0.18.1 in /usr/local/lib/python3.10/dist-packages (from gensim<4.0,>=3.6.0->texthero==1.1.0) (1.10.1) Requirement already satisfied: six>=1.5.0 in /usr/local/lib/python3.10/dist-packages (from gensim<4.0,>=3.6.0->texthero==1.1.0) (1.16.0) Requirement already satisfied: smart-open>=1.2.1 in /usr/local/lib/python3.10/dist-packages (from gensim<4.0,>=3.6.0->texthero==1.1.0) (6.3.0) Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.0->texthero==1.1.0) (1.1.0) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.0->texthero==1.1.0) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.0->texthero==1.1.0) (4.40.0) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.0->texthero==1.1.0) (1.4.4) Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.0->texthero==1.1.0) (23.1) Requirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.0->texthero==1.1.0) (8.4.0) Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.0->texthero==1.1.0) (3.1.0) Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.1.0->texthero==1.1.0) (2.8.2) Requirement already satisfied: click in /usr/local/lib/python3.10/dist-packages (from nltk>=3.3->texthero==1.1.0) (8.1.3) Requirement already satisfied: joblib in /usr/local/lib/python3.10/dist-packages (from nltk>=3.3->texthero==1.1.0) (1.2.0) Requirement already satisfied: regex>=2021.8.3 in /usr/local/lib/python3.10/dist-packages (from nltk>=3.3->texthero==1.1.0) (2022.10.31) Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas>=1.0.2->texthero==1.1.0) (2022.7.1) Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.10/dist-packages (from plotly>=4.2.0->texthero==1.1.0) (8.2.2) Requirement already satisfied: threadpoolctl>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from scikit-learn>=0.22->texthero==1.1.0) (3.1.0) Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /usr/local/lib/python3.10/dist-packages (from spacy<3.0.0->texthero==1.1.0) (1.0.9) Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /usr/local/lib/python3.10/dist-packages (from spacy<3.0.0->texthero==1.1.0) (2.0.7) Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /usr/local/lib/python3.10/dist-packages (from spacy<3.0.0->texthero==1.1.0) (3.0.8) Collecting thinc<7.5.0,>=7.4.1 (from spacy<3.0.0->texthero==1.1.0) Using cached thinc-7.4.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB) Requirement already satisfied: blis<0.8.0,>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from spacy<3.0.0->texthero==1.1.0) (0.7.9) Collecting wasabi<1.1.0,>=0.4.0 (from spacy<3.0.0->texthero==1.1.0) Using cached wasabi-0.10.1-py3-none-any.whl (26 kB) Collecting srsly<1.1.0,>=1.0.2 (from spacy<3.0.0->texthero==1.1.0) Using cached srsly-1.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (209 kB) Collecting catalogue<1.1.0,>=0.0.7 (from spacy<3.0.0->texthero==1.1.0) Using cached catalogue-1.0.2-py2.py3-none-any.whl (16 kB) Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from spacy<3.0.0->texthero==1.1.0) (67.7.2) Collecting plac<1.2.0,>=0.9.6 (from spacy<3.0.0->texthero==1.1.0) Using cached plac-1.1.3-py2.py3-none-any.whl (20 kB) Requirement already satisfied: requests<3.0.0,>=2.13.0 in /usr/local/lib/python3.10/dist-packages (from spacy<3.0.0->texthero==1.1.0) (2.27.1) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0,>=2.13.0->spacy<3.0.0->texthero==1.1.0) (1.26.16) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0,>=2.13.0->spacy<3.0.0->texthero==1.1.0) (2023.5.7) Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0,>=2.13.0->spacy<3.0.0->texthero==1.1.0) (2.0.12) Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0,>=2.13.0->spacy<3.0.0->texthero==1.1.0) (3.4) Installing collected packages: wasabi, plac, unidecode, srsly, catalogue, thinc, spacy, texthero Attempting uninstall: wasabi Found existing installation: wasabi 1.1.2 Uninstalling wasabi-1.1.2: Successfully uninstalled wasabi-1.1.2 Attempting uninstall: srsly Found existing installation: srsly 2.4.6 Uninstalling srsly-2.4.6: Successfully uninstalled srsly-2.4.6 Attempting uninstall: catalogue Found existing installation: catalogue 2.0.8 Uninstalling catalogue-2.0.8: Successfully uninstalled catalogue-2.0.8 Attempting uninstall: thinc Found existing installation: thinc 8.1.10 Uninstalling thinc-8.1.10: Successfully uninstalled thinc-8.1.10 Attempting uninstall: spacy Found existing installation: spacy 3.5.3 Uninstalling spacy-3.5.3: Successfully uninstalled spacy-3.5.3 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. confection 0.0.4 requires srsly<3.0.0,>=2.4.0, but you have srsly 1.0.6 which is incompatible. en-core-web-sm 3.5.0 requires spacy<3.6.0,>=3.5.0, but you have spacy 2.3.9 which is incompatible. Successfully installed catalogue-1.0.2 plac-1.1.3 spacy-2.3.9 srsly-1.0.6 texthero-1.1.0 thinc-7.4.6 unidecode-1.3.6 wasabi-0.10.1
    

0
投票
经过多次实验,我建议尝试此代码:

!pip install gensim==4.2.0 !pip install texthero==1.0.5 !pip install unidecode
与 Colab 上的 Python3.10 版本一起使用 - 它对我有用。

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