Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Fixing version collection #688

Open
aguschin opened this issue Jul 11, 2023 · 2 comments · May be fixed by #694
Open

Fixing version collection #688

aguschin opened this issue Jul 11, 2023 · 2 comments · May be fixed by #694
Assignees
Labels
bug Something isn't working feedback User's feedback requirements Finding requirements and dependencies needed to properly serialize objects

Comments

@aguschin
Copy link
Contributor

aguschin commented Jul 11, 2023

I kept running with issues with the automatic 3rd party dependencies (inferring the wrong version, or missing packages). The version issue is due to some python packages having a mismatch between MODULE.__version__ and the version required for pip:

  • After installing regex==2023.6.3, import regex ; regex.__version__ gives 2.5.129 . But there is no 2.5.129 version of regex so the install fail
  • After installing opencv-python-headless=4.8.0.74, import cv2 ; cv2.__version__ gives 4.8.0 but there is no 4.8.0 version of opencv-python-headless (you need to give the 4th-level version).

Reported in discord.

@aguschin aguschin added bug Something isn't working enhancement New feature or request requirements Finding requirements and dependencies needed to properly serialize objects labels Jul 11, 2023
@aguschin aguschin changed the title Fixing version collection and allowing to override versions found Fixing version collection Jul 11, 2023
@aguschin aguschin added feedback User's feedback and removed enhancement New feature or request labels Jul 11, 2023
@omesser
Copy link
Contributor

omesser commented Jul 13, 2023

@aguschin have you tried to see if importlib.metadata ? They cover packages and distributions. I believe this should work as of python 3.10 (before that we may need to patch or copy packages_distributions() helper but that's it:

>>> packages = importlib.metadata.packages_distributions()
>>> packages
{'pip': ['pip'], 'cv2': ['opencv-python-headless'], '_distutils_hack': ['setuptools'], 'pkg_resources': ['setuptools'], 'setuptools': ['setuptools'], 'regex': ['regex'], 'wheel': ['wheel'], 'numpy': ['numpy']}
>>> importlib.metadata.distribution(packages['cv2'][0]).version
'4.8.0.74'

works for regex as well:

>>> importlib.metadata.distribution(packages['regex'][0]).version
'2023.6.3'

@omesser omesser self-assigned this Jul 13, 2023
@omesser omesser linked a pull request Jul 13, 2023 that will close this issue
@omesser
Copy link
Contributor

omesser commented Jul 13, 2023

@aguschin issued a patch in #694

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Something isn't working feedback User's feedback requirements Finding requirements and dependencies needed to properly serialize objects
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants