Description
I built an in-place version of numpy
with python setup.py build_ext -i
(note that that will not have a .dist-info
dir at the root of the repo, distutils
doesn't produce that), and then used PYTHONPATH
to switch between the numpy
installed into the conda env and this in-place build:
$ echo $PYTHONPATH
/home/rgommers/code/numpy
Then open IPython and:
>>> import numpy as np
>>> np.__version__
'1.24.0.dev0+291.g2c5f407cf6'
>>> import importlib.metadata
>>> importlib.metadata.version("numpy")
'1.22.3'
So rather than returning None
or raising an exception, I'm getting the metadata for the wrong package.
I haven't yet decided if metadata items being undefined should result in None or raise an Exception (maybe KeyError).
Either way would be fine with me, as long as it's not silently returning incorrect metadata. There will be other cases like that other than numpy
, and PYTHONPATH
is pretty commonly used to switch around packages when developing. A .dist-info
directory may be required to get correct metadata, but it being missing should not cause incorrect results - that's a clear bug.
Originally posted by @rgommers in #91216 (comment)