pkg_resources.get_distribution() завершается с ошибкой при успешном импорте

#python #package #conda

#python #пакет #conda

Вопрос:

Я тестирую установку Python. Я нашел два пакета, sqlite3 и graph_tool , которые я могу import , но они выдают DistributionNotFound ошибку pkg_resources (см. Журналы консоли ниже).

Что именно pkg_resources делает и как он может пропустить установленный модуль?

Журналы консоли:

 >>> import pkg_resources
>>> import graph_tool
>>> pkg_resources.get_distribution("graph_tool")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/anaconda/envs/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 481, in get_distribution
    dist = get_provider(dist)
  File "/anaconda/envs/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 357, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/anaconda/envs/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/anaconda/envs/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'graph_tool' distribution was not found and is required by the application
  

и

 >>> import sqlite3
>>> pkg_resources.get_distribution("sqlite3")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/anaconda/envs/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 481, in get_distribution
    dist = get_provider(dist)
  File "/anaconda/envs/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 357, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/anaconda/envs/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/anaconda/envs/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'sqlite3' distribution was not found and is required by the application