diff --git a/news/8161.bugfix b/news/8161.bugfix new file mode 100644 index 00000000000..9b4088ee296 --- /dev/null +++ b/news/8161.bugfix @@ -0,0 +1 @@ +Fix ``list --outdated`` and ``list --uptodate` on platforms without ``sem_open`` diff --git a/src/pip/_internal/commands/list.py b/src/pip/_internal/commands/list.py index cf3be7eb459..555607551cc 100644 --- a/src/pip/_internal/commands/list.py +++ b/src/pip/_internal/commands/list.py @@ -210,17 +210,23 @@ def latest_info(dist): dist.latest_filetype = typ return dist - # This is done for 2x speed up of requests to pypi.org - # so that "real time" of this function - # is almost equal to "user time" - pool = Pool(DEFAULT_POOLSIZE) - - for dist in pool.imap_unordered(latest_info, packages): - if dist is not None: - yield dist - - pool.close() - pool.join() + try: + # This is done for 2x speed up of requests to pypi.org + # so that "real time" of this function + # is almost equal to "user time" + pool = Pool(DEFAULT_POOLSIZE) + + for dist in pool.imap_unordered(latest_info, packages): + if dist is not None: + yield dist + + pool.close() + pool.join() + except ImportError: + for dist in packages: + dist = latest_info(dist) + if dist is not None: + yield dist def output_package_listing(self, packages, options): packages = sorted(