1

我正在尝试使用 miniconda3 安装 pdfplumber。我不断收到此错误消息,但我不知道如何解释它。

(env1) C:\Users\engineer>conda install -c conda-forge pdfplumber
Collecting package metadata (current_repodata.json): done
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: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versions
Note that strict channel priority may have removed packages required for satisfiability.

还:

(env1) C:\Users\engineer>conda info

 active environment : env1
active env location : C:\tools\miniconda3\envs\env1
        shell level : 2
   user config file : C:\Users\engineer\.condarc  populated config files : C:\Users\engineer\.condarc
      conda version : 4.10.3
conda-build version : not installed
     python version : 3.8.10.final.0
   virtual packages : __cuda=10.2=0
                      __win=0=0
                      __archspec=1=x86_64
   base environment : C:\tools\miniconda3  (writable)
  conda av data dir : C:\tools\miniconda3\etc\conda   conda av metadata url : None
       channel URLs : https://conda.anaconda.org/conda-forge/win-64
                      https://conda.anaconda.org/conda-forge/noarch
                      https://repo.anaconda.com/pkgs/main/win-64
                      https://repo.anaconda.com/pkgs/main/noarch
                      https://repo.anaconda.com/pkgs/r/win-64
                      https://repo.anaconda.com/pkgs/r/noarch
                      https://repo.anaconda.com/pkgs/msys2/win-64
                      https://repo.anaconda.com/pkgs/msys2/noarch
      package cache : C:\tools\miniconda3\pkgs
                      C:\Users\engineer\.conda\pkgs
                      C:\Users\engineer\AppData\Local\conda\conda\pkgs
   envs directories : C:\tools\miniconda3\envs
                      C:\Users\engineer\.conda\envs
                      C:\Users\engineer\AppData\Local\conda\conda\envs
           platform : win-64
         user-agent : conda/4.10.3 requests/2.26.0 CPython/3.8.10 Windows/10 Windows/10.0.18363
      administrator : False
         netrc file : None
       offline mode : False

使用 pip 不是一个选项,因为它绝对不能在我的公司代理后面工作,而 miniconda3 可以。

4

1 回答 1

2

win-64 没有 ImageMagick

Conda 在识别不可满足性问题方面表现糟糕的另一个案例。Mamba在这方面做得很好,确定该imagemagick软件包不适用于win-64平台:

$ CONDA_SUBDIR="win-64" mamba create -dn foo -c conda-forge pdfplumber

                  __    __    __    __
                 /  \  /  \  /  \  /  \
                /    \/    \/    \/    \
███████████████/  /██/  /██/  /██/  /████████████████████████
              /  / \   / \   / \   / \  \____
             /  /   \_/   \_/   \_/   \    o \__,
            / _/                       \_____/  `
            |/
        ███╗   ███╗ █████╗ ███╗   ███╗██████╗  █████╗
        ████╗ ████║██╔══██╗████╗ ████║██╔══██╗██╔══██╗
        ██╔████╔██║███████║██╔████╔██║██████╔╝███████║
        ██║╚██╔╝██║██╔══██║██║╚██╔╝██║██╔══██╗██╔══██║
        ██║ ╚═╝ ██║██║  ██║██║ ╚═╝ ██║██████╔╝██║  ██║
        ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚═════╝ ╚═╝  ╚═╝

        mamba (0.15.2) supported by @QuantStack

        GitHub:  https://github.com/mamba-org/mamba
        Twitter: https://twitter.com/QuantStack

█████████████████████████████████████████████████████████████


Looking for: ['pdfplumber']

bioconda/win-64          [====================] (00m:00s) No change
pkgs/main/noarch         [====================] (00m:00s) Done
pkgs/r/win-64            [====================] (00m:00s) Done
pkgs/r/noarch            [====================] (00m:00s) No change
pkgs/main/win-64         [====================] (00m:00s) Done
bioconda/noarch          [====================] (00m:01s) Done
conda-forge/noarch       [====================] (00m:01s) Done
conda-forge/win-64       [====================] (00m:02s) Done
Encountered problems while solving:
  - nothing provides imagemagick needed by wand-0.5.6-py_0

可能的解决方法

它应该可以在您的系统上本地安装 ImageMagick,并确保可以从命令行访问它。然后,您可以使用强制安装的包创建环境wand,这是唯一依赖 ImageMagick 的包。

以下是创建环境的步骤(my_env如下所示,但可以随意命名):

## create the environment with python (I think you can use 3.6+)
conda create -n my_env python=3.9

## force-install "wand"
conda install -n my_env --no-deps wand=0.6.5

## install pdfplumber
conda install -n my_env pdfplumber

## try using the environment
conda activate my_env

补充说明

不需要 ImageMagick。从技术上讲,ImageMagick 似乎只用于pdfplumber 的“可视化调试”功能。如果您不需要它,那么您可以完全放弃安装 ImageMagick。我验证(在osx-64上)没有 ImageMagick 的上述环境可以运行 CLI 示例和 pdfplumber 文档中的第一个 Python API 示例。

使用隔离环境。因为强制安装可能很危险(阅读标志conda install --help上的--no-deps),我强烈建议为此创建一个专用环境,如上所示。

为什么要固定wand版本?我指定了一个版本,wand因为这将有助于防止 Conda 将来在更新时尝试更改它。

曼巴真棒。我强烈推荐使用 Mamba。这是一个简单的安装:

conda install -n base -c conda-forge mamba

然后只需mamba在您通常键入时使用condaconda activateandconda deactivate命令除外)。

于 2021-08-06T03:57:59.067 回答