The environment is inconsistent, please check the package plan carefully

前端 未结 10 1598
忘了有多久
忘了有多久 2020-11-28 02:29

I tried to update or install new packages from anaconda and lately, this message has appeared:

The environment is inconsistent, please check the package plan         


        
10条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 02:57

    Given a situation like the following,

    > conda update -c intel --all
    Collecting package metadata: done
    Solving environment: |
    The environment is inconsistent, please check the package plan carefully
    The following packages are causing the inconsistency:
    
      - intel/win-64::ipython==6.3.1=py36_3
      - intel/win-64::prompt_toolkit==1.0.15=py36_2
    done
    

    As mentioned in other answers, the idea is to have some sort of re-installation to occur for the inconsistent packages.

    Thus, with a few copy-&-paste's, you could:

    > conda install intel/win-64::ipython==6.3.1=py36_3
    Collecting package metadata: done
    Solving environment: /
    The environment is inconsistent, please check the package plan carefully
    The following packages are causing the inconsistency:
    
      - intel/win-64::ipython==6.3.1=py36_3
      - intel/win-64::prompt_toolkit==1.0.15=py36_2
    done
    
    ## Package Plan ##
    
      environment location: c:\conda
    
      added / updated specs:
        - ipython
    
    
    The following NEW packages will be INSTALLED:
    
      jedi               intel/win-64::jedi-0.12.0-py36_2
      parso              intel/win-64::parso-0.2.0-py36_2
      pygments           intel/win-64::pygments-2.2.0-py36_5
      wcwidth            intel/win-64::wcwidth-0.1.7-py36_6
    
    
    Proceed ([y]/n)? y
    
    Preparing transaction: done
    Verifying transaction: done
    Executing transaction: done
    

    (and you would have to repeat for all the packages)


    My “Shortcut”

    Alternatively, cook up an (ugly) one-liner (this should work for Windows as well as other platforms)

    Note: by "ORIGINAL_COMMAND", I'm referring to any command that gives you the error message (without any other side-effects, ideally)

     2>&1 | python -c "import sys,re,conda.cli; conda.cli.main('conda','install','-y',*re.findall(r'^\s*-\s*(\S+)$',sys.stdin.read(),re.MULTILINE))"
    

    Expanding the above one-liner:

    from re import findall, MULTILINE
    from sys import stdin
    from conda.cli import main
    
    main(
        "conda", "install", "-y",
        "--force",  # Maybe add a '--force'/'--force-reinstall' (I didn't add it for the one-liner above)
        *findall(r"^\s*-\s*(\S+)$", stdin.read(), MULTILINE)  # Here are the offenders
    )
    

提交回复
热议问题