New GitHub issue #94113 from pfmoore:<br>
<hr>
<pre>
**Bug report**
If I install `rich` in a temporary directory and then add that directory to `sys.path`, `importlib.metadata.packages_distributions` cannot see rich (even though it can see dependencies of rich like `pygments`).
Reproducer:
```python
import sys
import subprocess
import shutil
from pathlib import Path
tst = Path("test")
tst.mkdir()
subprocess.run([sys.executable, "-m", "pip", "install", "-t", str(tst), "rich"])
reproducer = Path("reproducer.py")
reproducer.write_text(f"""\
import sys
import importlib.metadata
sys.path.append({repr(str(tst))})
import rich # to confirm rich is importable
dists = importlib.metadata.packages_distributions()
print(dists)
print("Rich version is accessible:", importlib.metadata.version("rich"))
if not "rich" in dists:
print("Rich is not visible to importlib.metadata.package_distributions")
# Oddly, dependencies of rich (in the same sys.path entry) *are* visible
if "pygments" in dists:
print("Pygments *is* visible to importlib.metadata.package_distributions")
"""
)
subprocess.run([sys.executable, str(reproducer)])
# tidy up
reproducer.unlink()
shutil.rmtree(tst)
```
**Your environment**
- CPython versions tested on: 3.10
- Operating system and architecture: Windows 11, 64-bit.
- Tested in a clean virtual environment created using `py -m venv .venv`
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/94113">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>