Conda uninstall one package and one package only

197,804

You can use conda remove --force.

The documentation says:

--force               Forces removal of a package without removing packages
                      that depend on it. Using this option will usually
                      leave your environment in a broken and inconsistent
                      state
Share:
197,804

Related videos on Youtube

Amelio Vazquez-Reina
Author by

Amelio Vazquez-Reina

I'm passionate about people, technology and research. Some of my favorite quotes: "Far better an approximate answer to the right question than an exact answer to the wrong question" -- J. Tukey, 1962. "Your title makes you a manager, your people make you a leader" -- Donna Dubinsky, quoted in "Trillion Dollar Coach", 2019.

Updated on October 10, 2021

Comments

  • Amelio Vazquez-Reina
    Amelio Vazquez-Reina over 2 years

    When I try to uninstall pandas from my conda virtual env, I see that it tries to uninstall more packages as well:

    $ conda uninstall pandas
    Using Anaconda Cloud api site https://api.anaconda.org
    Fetching package metadata: ....
    Solving package specifications: .........
    
    Package plan for package removal in environment /Users/amelio/anaconda/envs/py35:
    
    The following packages will be downloaded:
    
        package                    |            build
        ---------------------------|-----------------
        dask-0.7.6                 |           py35_0         276 KB
    
    The following packages will be REMOVED:
    
        blaze:       0.10.1-py35_0
        odo:         0.5.0-py35_1
        pandas:      0.18.1-np111py35_0
        seaborn:     0.7.0-py35_0
        statsmodels: 0.6.1-np111py35_1
    
    The following packages will be DOWNGRADED:
    
        dask:        0.10.1-py35_0      --> 0.7.6-py35_0
    
    Proceed ([y]/n)?
    

    I would like to uninstall pandas only and not have anything else downgraded.

    I understand that there these packages have dependencies to pandas and even to specific versions of pandas, but is this even possible at all with conda?

    Partial motivation

    My understanding is that it isn't that easy to install a package from GitHub using conda. At least it isn't as easy as using a one-liner as one can do with pip.

    Since I want to use the version in master, my plan is to uninstall the conda version and use pip to install pandas from master on the official repo GitHub.

    How can I do this?

    • cel
      cel almost 8 years
      a simple solution would be to just pip install the new version from master over conda's version.
  • MichaelChirico
    MichaelChirico about 5 years
    For me, I was trying to get around all the extra fluff when you run plain conda remove x about updates/etc, but I still wanted to remove some dependencies. I was able to do some piping: conda remove --force -y $(conda list $MATCHING_PATTERN | grep "$MATCHING_PATTERN" | awk '{ print $1 }') got rid of a package and its dependencies matching $MATCHING_PATTERN
  • Dhiren Hamal
    Dhiren Hamal almost 5 years
    conda remove --force pandas
  • wordsforthewise
    wordsforthewise over 2 years
    unfortunately this isn't possible with mamba at the moment: github.com/mamba-org/mamba/issues/412