Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`pip3 search aiohttp` shows updated version, but won't install

Tags:

python-3.x

pip

I am installing a python package that depends on aiohttp, version >=3. pip3 search aiohttp returns:

aiohttp (3.3.2)  - Async http client/server framework (asyncio)
  INSTALLED: 2.3.10
  LATEST:    3.3.2

So why does pip3 install --upgrade --user aiohttp respond that it's already up to date, and pip3 install --user aiohttp==3.3.2 say:

Could not find a version that satisfies the requirement aiohttp==3.3.2 [... snip ...] No matching distribution found for aiohttp==3.3.2

I am running Ubuntu 16.04, Python v.3.5.2, and pip3 v.18.0. The latter is an upgrade to the system's v.8.1.1 from the apt package python3-pip. Pip3 was upgraded locally using pip3 upgrade --user so as not to conflict with the system packages.

like image 479
Diagon Avatar asked Oct 19 '25 09:10

Diagon


1 Answers

Version 3 of aiohttp requires Python to be at least version 3.5.3; the documentation explains:

Why not 3.5.0? Because 3.5.3 has a crucial change: asyncio.get_event_loop() returns the running loop instead of default, which may be different, e.g.:

loop = asyncio.new_event_loop()
loop.run_until_complete(f())

Note, asyncio.set_event_loop() was not called and default loop is not equal to actually executed one.

As a result, pip running on Python 3.5.2 or any earlier version will ignore aiohttp v3 when installing; the fact that the newer version still shows up under pip search is arguably a bug.

like image 96
jwodder Avatar answered Oct 22 '25 03:10

jwodder