pythoncondapdfplumber

Conda wont install pdfplumber


I'm trying to use miniconda3 to install pdfplumber. I keep getting this error message and I don't know how to interpret it.

(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.

Also:

(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

Using pip is not an option as it absolutely will not work behind my corporate proxy whereas miniconda3 will.


Solution

  • No ImageMagick for win-64

    Another case of Conda being terrible at identifying unsatisfiability issues. Mamba does just fine with this, identifying that the imagemagick package is not available for the win-64 platform:

    $ 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
    

    Possible Workaround

    It should work to install ImageMagick natively on your system, and ensure that it is accessible from the command line. Then you could create an environment with a force-installed wand package, the only package that depends on ImageMagick.

    Here are the steps to create the environment (called my_env below but name it as you wish):

    ## 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
    

    Additional Notes

    Don't need ImageMagick. Technically, ImageMagick only seems to be used for the "Visual Debugging" functionality of pdfplumber. If you don't need that, then you can forego installing ImageMagick altogether. I verified (on osx-64) that the above environment without ImageMagick could run both the CLI example and the first Python API example from the pdfplumber docs.

    Use isolated environment. Because force-installs can be dangerous (read the conda install --help on the --no-deps flag), I strongly recommend creating a dedicated environment for this, as shown above.

    Why pin the wand version? I specified a version for wand because that will help prevent Conda from trying to change it in the future when updating.

    Mamba is awesome. I highly recommend using Mamba. It's a simple install:

    conda install -n base -c conda-forge mamba
    

    then just use mamba whenever you would normally type conda (the exception being the conda activate and conda deactivate commands).