Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anaconda python: PackagesNotFoundError error when trying to roll back revision

For some reason I decided to upgrade setuptools. The so-called package plan that popped up when I ran conda install -c anaconda setuptools was as follows:

The following packages will be downloaded:

  package                    |            build
  ---------------------------|-----------------
  certifi-2019.3.9           |           py37_0         155 KB  anaconda
  pip-19.1.1                 |           py37_0         1.8 MB  anaconda
  python-3.7.2               |      h8c8aaf0_10        17.7 MB  anaconda
  setuptools-41.0.1          |           py37_0         680 KB  anaconda
  wheel-0.33.4               |           py37_0          57 KB  anaconda
  wincertstore-0.2           |           py37_0          13 KB  anaconda
  ------------------------------------------------------------
                                       Total:        20.4 MB

The following NEW packages will be INSTALLED:

   pip                anaconda/win-64::pip-19.1.1-py37_0

The following packages will be UPDATED:

  certifi     2018.11.29-py36_0 --> 2019.3.9-py37_0
  python      pkgs/main::python-3.6.4-h6538335_1 --> anaconda::python-3.7.2-h8c8aaf0_10
  setuptools  pkgs/main::setuptools-38.4.0-py36_0 --> anaconda::setuptools-41.0.1-py37_0
  wheel       pkgs/main::wheel-0.30.0-py36h6c3ec14_1 --> anaconda::wheel-0.33.4-py37_0

The following packages will be SUPERSEDED by a higher-priority channel:

  wincertstore     pkgs/main::wincertstore-0.2-py36h7fe5~ --> anaconda::wincertstore-0.2-py37_0

However the upgrade broke other parts of my code which are really needed and cannot be updated. Hence I decide to roll back to the previous state. The most recent revisions from conda list --revisions are:

2019-02-12 15:10:38  (rev 12)
    bzip2  {1.0.6 (conda-forge) -> 1.0.6 (anaconda)}
    ca-certificates  {2018.03.07 -> 2019.1.23 (anaconda)}
    certifi  {2018.11.29 -> 2018.11.29 (anaconda)}
    conda  {4.5.12 -> 4.6.2 (anaconda)}
    nbconvert  {5.3.1 -> 5.4.0 (anaconda)}
    openssl  {1.1.1a -> 1.1.1 (anaconda)}
    snappy  {1.1.7 (conda-forge) -> 1.1.7 (anaconda)}
    vc  {14.1 -> 14.1 (anaconda)}
    vs2015_runtime  {14.15.26706 -> 15.5.2 (anaconda)}
    yaml  {0.1.7 (conda-forge) -> 0.1.7 (anaconda)}
    zlib  {1.2.11 (conda-forge) -> 1.2.11 (anaconda)}
   +defusedxml-0.5.0 (anaconda)

2019-05-17 16:52:29  (rev 13)
    certifi  {2018.11.29 (anaconda) -> 2019.3.9 (anaconda)}
    pip  {9.0.1 -> 19.1.1 (anaconda)}
    python  {3.6.4 -> 3.7.2 (anaconda)}
    setuptools  {38.4.0 -> 41.0.1 (anaconda)}
    wheel  {0.30.0 -> 0.33.4 (anaconda)}
    wincertstore  {0.2 -> 0.2 (anaconda)}

The problem now is that when I do conda install --revision 12 I get the following error:

PackagesNotFoundError: The following packages are missing from the target environment:
    - anaconda::certifi==2018.11.29=py36_0

Any ideas how to do the rollback please?

Many thanks

like image 635
Aenaon Avatar asked May 17 '19 16:05

Aenaon


Video Answer


2 Answers

I agree with J_H, the best is to keep your environment.yml produced with conda env export > environment.yml in your code versioning system (Git). Then in case of problem you can delete your environment and recreate it (but not with conda env update) with conda env create -f environment.yml.

like image 66
mathieu.letombe Avatar answered Sep 19 '22 15:09

mathieu.letombe


Just in case someone bumps into this, facing a similar situation, this what I did and to be fair, it is not actually a rollback. It also appears that my conda environment was really messed-up the upgrade I mentioning in my original post because when I did conda update conda I received the following error:

>conda update conda
Collecting package metadata: done
Solving environment: | WARNING 
conda.common.logic:get_sat_solver_cls(289): Could not run SAT solver through interface "pycosat".
WARNING conda.common.logic:get_sat_solver_cls(289): Could not run SAT solver through interface "pycryptosat".
WARNING conda.common.logic:get_sat_solver_cls(289): Could not run SAT solver through interface "pysat".failed

My numpy was also broken and who knows what else....

I followed the steps desribed by Kale Franz at this link: https://github.com/conda/conda/issues/7714#issuecomment-417553149

For the sake of completeness, I am attaching a screenshot of his answer below: enter image description here

Running the command that Kale suggests in his post, I got a really long list of the packages that are causing inconsistencies. I was a really long list, I am just pasting below the very first few lines:

Collecting package metadata: done
Solving environment: \
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - defaults/win-64::alabaster==0.7.10=py36hcd07829_0
  - defaults/win-64::anaconda-client==1.6.9=py36_0
  - defaults/win-64::anaconda==custom=py36h363777c_0
  - defaults/win-64::anaconda-project==0.8.2=py36hfad2e28_0
  - defaults/win-64::asn1crypto==0.24.0=py36_0
  - defaults/win-64::astroid==1.6.1=py36_0
    .... (A lot more that I am not pasting here) ....

And after the list ended the message continued as follows:

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
ca-certificates-2019.5.15  |                0         166 KB
certifi-2019.3.9           |           py36_0         156 KB
cffi-1.12.3                |   py36h7a1dbc1_0         225 KB
chardet-3.0.4              |           py36_1         210 KB
conda-4.6.14               |           py36_0         2.1 MB
cryptography-2.7           |   py36h7a1dbc1_0         564 KB
idna-2.8                   |           py36_0         134 KB
menuinst-1.4.16            |   py36he774522_0         227 KB
openssl-1.1.1c             |       he774522_1         5.7 MB
pip-19.1.1                 |           py36_0         1.9 MB
pycosat-0.6.3              |   py36hfa6e2cd_0          98 KB
pycparser-2.19             |           py36_0         174 KB
pyopenssl-19.0.0           |           py36_0          82 KB
pysocks-1.7.0              |           py36_0          30 KB
python-3.6.8               |       h9f7ef89_7        20.3 MB
pywin32-223                |   py36hfa6e2cd_1         9.3 MB
requests-2.22.0            |           py36_0          90 KB
ruamel_yaml-0.15.46        |   py36hfa6e2cd_0         262 KB
setuptools-41.0.1          |           py36_0         663 KB
six-1.12.0                 |           py36_0          22 KB
urllib3-1.24.2             |           py36_0         153 KB
wheel-0.33.4               |           py36_0          57 KB
win_inet_pton-1.1.0        |           py36_0           9 KB
wincertstore-0.2           |   py36h7fe50ca_0          13 KB
------------------------------------------------------------
                                       Total:        42.6 MB

The following packages will be UPDATED:

  ca-certificates     anaconda::ca-certificates-2019.1.23-0 --> pkgs/main::ca-certificates-2019.5.15-0
  cffi                                1.11.4-py36hfa6e2cd_0 --> 1.12.3-py36h7a1dbc1_0
  conda                        anaconda::conda-4.6.2-py36_0 --> pkgs/main::conda-4.6.14-py36_0
  cryptography                         2.4.2-py36h7a1dbc1_0 --> 2.7-py36h7a1dbc1_0
  idna                                   2.6-py36h148d497_1 --> 2.8-py36_0
  menuinst                            1.4.11-py36hfa6e2cd_0 --> 1.4.16-py36he774522_0
  pycparser                             2.18-py36hd053e01_1 --> 2.19-py36_0
  pyopenssl                           17.5.0-py36h5b7d817_0 --> 19.0.0-py36_0
  pysocks                              1.6.7-py36h698d350_1 --> 1.7.0-py36_0
  pywin32                                222-py36hfa6e2cd_0 --> 223-py36hfa6e2cd_1
  requests                            2.18.4-py36h4371aae_1 --> 2.22.0-py36_0
  ruamel_yaml                        0.15.35-py36hfa6e2cd_1 --> 0.15.46-py36hfa6e2cd_0
  six                                 1.11.0-py36h4db2310_1 --> 1.12.0-py36_0
  urllib3                               1.22-py36h276f60a_0 --> 1.24.2-py36_0
  win_inet_pton                        1.0.1-py36he67d7fd_1 --> 1.1.0-py36_0

The following packages will be SUPERSEDED by a higher-priority channel:

certifi                 anaconda::certifi-2019.3.9-py37_0 --> pkgs/main::certifi-2019.3.9-py36_0
openssl                anaconda::openssl-1.1.1-he774522_0 --> pkgs/main::openssl-1.1.1c-he774522_1
pip                           anaconda::pip-19.1.1-py37_0 --> pkgs/main::pip-19.1.1-py36_0
python                 anaconda::python-3.7.2-h8c8aaf0_10 --> pkgs/main::python-3.6.8-h9f7ef89_7
setuptools             anaconda::setuptools-41.0.1-py37_0 --> pkgs/main::setuptools-41.0.1-py36_0
wheel                       anaconda::wheel-0.33.4-py37_0 --> pkgs/main::wheel-0.33.4-py36_0
wincertstore            anaconda::wincertstore-0.2-py37_0 --> pkgs/main::wincertstore-0.2-py36h7fe50ca_0

The following packages will be DOWNGRADED:

 chardet                              3.0.4-py36h420ce6e_1 --> 3.0.4-py36_1
 pycosat                              0.6.3-py36h413d8a4_0 --> 0.6.3-py36hfa6e2cd_0


Proceed ([y]/n)? y

Everything looks fine now and If I do conda list --revisions my two most recent revisions are:

 2019-05-17 16:52:29  (rev 13)
     certifi  {2018.11.29 (anaconda) -> 2019.3.9 (anaconda)}
     pip  {9.0.1 -> 19.1.1 (anaconda)}
     python  {3.6.4 -> 3.7.2 (anaconda)}
     setuptools  {38.4.0 -> 41.0.1 (anaconda)}
     wheel  {0.30.0 -> 0.33.4 (anaconda)}
     wincertstore  {0.2 -> 0.2 (anaconda)}

 2019-06-10 14:05:10  (rev 14)
     ca-certificates  {2019.1.23 (anaconda) -> 2019.5.15}
     certifi  {2019.3.9 (anaconda) -> 2019.3.9}
     cffi  {1.11.4 -> 1.12.3}
     chardet  {3.0.4 -> 3.0.4}
     conda  {4.6.2 (anaconda) -> 4.6.14}
     cryptography  {2.4.2 -> 2.7}
     idna  {2.6 -> 2.8}
     menuinst  {1.4.11 -> 1.4.16}
     openssl  {1.1.1 (anaconda) -> 1.1.1c}
     pip  {19.1.1 (anaconda) -> 19.1.1}
     pycosat  {0.6.3 -> 0.6.3}
     pycparser  {2.18 -> 2.19}
     pyopenssl  {17.5.0 -> 19.0.0}
     pysocks  {1.6.7 -> 1.7.0}
     python  {3.7.2 (anaconda) -> 3.6.8}
     pywin32  {222 -> 223}
     requests  {2.18.4 -> 2.22.0}
     ruamel_yaml  {0.15.35 -> 0.15.46}
     setuptools  {41.0.1 (anaconda) -> 41.0.1}
     six  {1.11.0 -> 1.12.0}
     urllib3  {1.22 -> 1.24.2}
     wheel  {0.33.4 (anaconda) -> 0.33.4}
     win_inet_pton  {1.0.1 -> 1.1.0}
     wincertstore  {0.2 (anaconda) -> 0.2}
like image 23
Aenaon Avatar answered Sep 20 '22 15:09

Aenaon