18

I recently discovered my numpy installation (MacOS, with anaconda) was on an old version 1.11.x, instead of the latest 1.12.0, when a function documented on their website was not found. When I would type conda update numpy, I would be told the installation is up to date. Finally after trying to force conda install numpy=1.12.0, an error showed up indicating packages had dependency issues -- turns out my astropy installation (which I don't even use) required numpy version 1.11.x. After uninstalling astropy and installing numpy, the upgrade to version 1.12.0 was successful.

It really bothers me that anaconda did not give any sort of notice that it was ignoring the latest numpy version due to dependency issues. Is there any way to display, by force, some kind of warning or flag?

Edit: I see from this github issue thread that there seems to be no native way to do this, at the moment. Though perhaps until the developers add the feature, there is a slightly hacky way it can be done with a BASH script -- something like querying the latest version available, then conda installing and comparing the two version strings.

Zero Piraeus
  • 56,143
  • 27
  • 150
  • 160
Luke Davis
  • 2,548
  • 2
  • 21
  • 43

2 Answers2

1

You are asking if it is possible to write code that will scan each line of environment.yml and report whether the "foo=X.Y.Z" version for foo is up-to-date, ignoring other deps in the file (like astropy) which might conflict and therefore hold it back.

Yes.

Write a script that iterates through each package line, tears down and then rebuilds a brand new environment with a one-line environment.yml (or even without that file), and installs the latest version in isolation. Read whatever version that turns out to be, compare against the target environment.yml, and report on any mismatches. If you write a script that you find useful, please do post it here.

J_H
  • 17,926
  • 4
  • 24
  • 44
0

I would actually say that using pip instead of conda would solve that problem as well. When upgrading a package using pip install --upgrade <package_name>, it will upgrade it to the latest version compatible with your OS and Python version. However, if this upgrade caused an installed package to no longer be compatible, pip will raise a warning telling you exactly that.

1313e
  • 1,112
  • 9
  • 17