easybuild-easyblocks icon indicating copy to clipboard operation
easybuild-easyblocks copied to clipboard

Python packages might have the wrong version due not using pip

Open Flamefire opened this issue 4 years ago • 4 comments

In e.g. Python-3.7.4-GCCcore-8.3.0.eb we install pip without pip which leads to the installation of an egg-file/folder.

This doesn't play nice with pip in general. E.g. pip list lists pip as 19.2.3 (as it should be) but python -c 'import pip; print(pip.__version__) shows 19.0.3

This means that we don't get what we asked for.

In this case it is admittedly quite special because we install a base pip via ensurepip (a bundled pip in Python) and then again via setup.py but it shows that using setup.py is unreliable / doesn't work well together with pip

Hence we should strive VERY hard to avoid any use_pip: False or anything where use_pip: True is not set.

Additionally it might make sense to check for the case where python -c 'import <module>; print(<module>.__version__) prints something else than the expected version and add this as a sanity check. Possible problems:

  • __version__ may not be defined --> I'd allow the command to fail
  • it may be faulty, i.e. claim a different version --> Bug in the package, should be fixed via patches

Flamefire avatar Apr 14 '21 16:04 Flamefire

Wouldn't a better way of verifying which version is installed via pip list?

boegel avatar Apr 28 '21 14:04 boegel

pip list uses the packages meta-data to show versions and name. So the major problem here is that we don't know what the name of the package is. It might be the module name or something completely different (yes, there are examples of that)

And in this case this is actually the problem:

pip list lists pip as 19.2.3 (as it should be) but python -c 'import pip; print(pip.__version__) shows 19.0.3

I.e. pip finds meta data of 19.2.3 but the actually used package is version 19.0.3

Flamefire avatar Apr 28 '21 14:04 Flamefire

@Flamefire I think we can consider this as fixed thanks to https://github.com/easybuilders/easybuild-easyblocks/pull/2367 + https://github.com/easybuilders/easybuild-easyblocks/pull/2377?

boegel avatar Oct 27 '23 09:10 boegel

The issue here wasn't the 0.0 version but the difference shown via pip list vs python -c 'import foo; print(foo.__version__)

So rather https://github.com/easybuilders/easybuild-easyconfigs/pull/12650 was a good step in fixing this and we should get https://github.com/easybuilders/easybuild-easyblocks/issues/2127 done, at least for 5.0

Flamefire avatar Oct 27 '23 10:10 Flamefire