1

I'm wrestling with some legacy Python code. Thanks to the help of this great answer I was able to write a conda call which executes correctly, and which hopefully contains all the packages needed to run the code:

conda install IPython scipy numpy PIL scikit-image matplotlib tensorflow keras

However, now conda is telling me that

The following packages will be DOWNGRADED:

  certifi                                 2018.11.29-py36_0 --> 2018.11.29-py27_0
  pip                                         19.0.3-py36_0 --> 19.0.3-py27_0
  python                                   3.6.8-haf84260_0 --> 2.7.15-h8f8e585_6
  setuptools                                  40.8.0-py36_0 --> 40.8.0-py27_0
  wheel                                       0.33.1-py36_0 --> 0.33.1-py27_0

What the what?! Python 2.7.15? No way. Also, the project README contains "instructions" to run the code with Python 3.6, so in theory the code should be compatible with Python 3.6. Is there a way to understand exactly which package and/or combination of package is causing the downgrade?

Before you say that, I know I could just install one package at a time, and see which one is the culprit. But the conda docs specifically warn against installing the packages needed in an environment, one at a time:

https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands

Install all the programs that you want in this environment at the same time. Installing 1 program at a time can lead to dependency conflicts.


PS the output of the conda install command is actually much longer than the one I included here. I only copied the DOWNGRADE part because it's the only one which is bothering me, but of course if you want I can include the full multi-page output.

DeltaIV
  • 4,773
  • 12
  • 39
  • 86
  • well step one would be install packages separately (conda install IPython; conda install scipy, etc) – murksiuke Mar 05 '19 at 17:22
  • @murksiuke but as I wrote, the conda docs explicitly advise against doing that. – DeltaIV Mar 05 '19 at 17:23
  • dont install it, but just run the command separately, see if you can narrow it down to what package does it. – Paritosh Singh Mar 05 '19 at 17:28
  • @ParitoshSingh you mean, I run the command and then when it asks me to `proceed [y/n]`, I say no, right? – DeltaIV Mar 05 '19 at 17:29
  • 1
    indeed. instructions and guidelines are great to follow as long as they work. If they start to break something down, its okay to dig deeper or deviate. – Paritosh Singh Mar 05 '19 at 17:31
  • @ParitoshSingh ok. Apparently the package `PIL` is the culprit. I'll try to understand what this PIL package does, and if the code runs without it. – DeltaIV Mar 05 '19 at 17:32
  • 1
    [this may help](https://stackoverflow.com/questions/39179948/how-do-i-install-pil-pillow-for-python-3-6) . Personally though, if you need to work with images, you might as well just use open-cv instead. However ,that is up to you. If you are on windows, you can use wheels for python 3 PIL. – Paritosh Singh Mar 05 '19 at 17:41
  • @ParitoshSingh thank you very much for your answer: I'm on Mac. Your link says to use `pip3 install pillow`, if I interpret it correctly. I'll still try to do `conda install pillow` and see if it works, but if it asks me again to downgrade, I'll try with `pip3`. Concerning `open-cv`, I know little about both `open-cv` and `pillow`: if you say the former is better than the latter, I believe you. However, I'm firmly convinced that the first thing to do when one receives legacy code, is to get it running with as little modifications to the code as possible. Thus, unless you strongly 1/ – DeltaIV Mar 05 '19 at 17:47
  • 2/ advocate that I should substitute all calls to `pillow` (PIL) with calls to `open-cv`, I'd rather not introduce further entropy in the code for now. – DeltaIV Mar 05 '19 at 17:48
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/189469/discussion-between-paritosh-singh-and-deltaiv). – Paritosh Singh Mar 05 '19 at 17:48

0 Answers0