10

I have set up couple of environments with Data Science libraries like pandas, numpy, matplotlib, scikit-learn, tensorflow etc..

However I cannot update some packages to the latest version.

E.g.

conda update pandas

will tell me I have the latest version available however I know for sure the latest version is 1.+ (mine is 0.25)

Is there a way to see which packages prevent a specific package from updating?

Cornelius Roemer
  • 3,772
  • 1
  • 24
  • 55
Sergey Bushmanov
  • 23,310
  • 7
  • 53
  • 72
  • did you try `pip install --upgrade pandas`? new pandas version may not be ported to conda repo. – Quang Hoang Apr 04 '20 at 12:49
  • 1
    Thanks. It's not a question of forcing pandas to update, one can do it with pip for sure. The question is about how to find which package(s) keep a certain package from updating. The newest stable version is in conda repo indeed. – Sergey Bushmanov Apr 04 '20 at 12:52
  • 2
    @SergeyBushmanov, in this case you can try `conda install pandas=1.0.3` and see whether conda suggest downgrading packages. But it can very well happen that you will end up with a solver error and then things get difficult. – cel Apr 04 '20 at 13:30
  • 1
    @SergeyBushmanov Running the install command will let you choose whether or not to continue, as long as you don't have the `always-yes` configuration set to true. You can usually also append the `--dry-run` flag as well. That would run through the environment solution and tell you any conflicts. – darthbith Apr 04 '20 at 20:59
  • 1
    Running `conda install pandas=1.0.3` goes forever without giving any clue what problems `conda` is trying to solve. So, my question is still *How to tell which package(s) prevent a certain library from updating.* Without giving an optimal update plan. – Sergey Bushmanov Apr 05 '20 at 10:18
  • Maybe from [conda-meta/history](https://stackoverflow.com/a/56069934/7109869)? – Gonçalo Peres May 22 '21 at 07:57
  • 1
    You can also have a look at conda-tree (previous answer: https://stackoverflow.com/questions/55912363/how-to-analyze-dependency-tree-for-conda) – Ibrahim.H May 03 '23 at 09:33

2 Answers2

3

There is a way to do it using the drop-in replacement mamba.

All you have to do is provide the version of the package you want to update to, and mamba will tell you what's preventing it from updating.

E.g., in my case, I wanted to update snakemake to version > 7. But mamba update snakemake only gave me 6.15.

So I ran: mamba install snakemake=7, and the result was informative:

Looking for: ['snakemake=7']

Pinned packages:
  - python 3.8.*
  - bcbio-gff 0.6.7.*


Encountered problems while solving:
  - nothing provides yte >=1.0,<2.0 needed by snakemake-minimal-7.0.0-pyhdfd78af_0

It turns out I had forgotten to include -c conda-forge which is where yte was to come from.

Cornelius Roemer
  • 3,772
  • 1
  • 24
  • 55
  • 1
    Yes, you right. Switched to it half a year ago and having no problems since then – Sergey Bushmanov Apr 05 '22 at 18:29
  • It's really nice that it solves so quickly and tells you what prevents the update. One still needs to notice that an expected update isn't happening - but then the above works to find the culprit. – Cornelius Roemer Apr 05 '22 at 19:33
1

As it's explained in anacondas documentation, there is no real way to do it in one step. You can check each package dependencies one by one. This is explained in the following link. https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html#listing-package-dependencies

Reine Baudache
  • 413
  • 4
  • 16