Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anaconda: any way to indicate if dependency issues prevent "conda update"ing the *absolute* latest version of a module?

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.

like image 549
Luke Davis Avatar asked Feb 21 '17 18:02

Luke Davis


People also ask

How do I stop conda update?

To prevent existing packages from updating, use the --no-update-deps option. This may force conda to install older versions of the requested packages, and it does not prevent additional dependency packages from being installed.

Does conda install dependencies?

Conda provides many of the features found in pip, virtualenv, venv and pyenv. However it is a completely separate tool that will manage Python dependencies differently, and only works in Conda environments. Conda analyzes each package for compatible dependencies, and how to install them without conflict.

Can I use both pip and conda?

Built into Anaconda, conda is a powerful package manager and environment manager that you use with command-line in the Anaconda Prompt for Windows, or in a terminal window for macOS or Linux. pip is the standard package manager for python, meaning you can use it both inside and outside of Anaconda.


1 Answers

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.

like image 128
J_H Avatar answered Oct 12 '22 14:10

J_H