Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use module on a vanilla Python 3.9 Docker container or venv due to No module named 'packaging' error #250

Closed
cloudwitch opened this issue Dec 14, 2023 · 1 comment · Fixed by #254

Comments

@cloudwitch
Copy link

I cannot use module on a vanilla python:3.9 Docker container or venv due to No module named 'packaging' error. It seems that installing packaging is a requirement. Please update aioresponses to include packaging as a dependency.

Issue seems to be with aioresponses-0.7.6-py2.py3-none-any.whl, in my experience, but I have not tried any other versions because this is what my team is using, and it isn't working for me.

This is easily replicatable with this script.

#!/usr/bin/env python3

import aioresponses

if __name__ == "__main__":
    print("hello")

Take this in a python:3.9 container, install aioresponses, run script, cry.

docker run -it --rm -v "$(pwd)":/scratch python:3.9 /bin/bash
root@computer:/# pip install aioresponses
Collecting aioresponses
  Downloading aioresponses-0.7.6-py2.py3-none-any.whl (11 kB)
Collecting aiohttp<4.0.0,>=3.3.0
  Downloading aiohttp-3.9.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 1.6 MB/s eta 0:00:00
Collecting frozenlist>=1.1.1
  Downloading frozenlist-1.4.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (228 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 228.0/228.0 kB 230.1 kB/s eta 0:00:00
Collecting yarl<2.0,>=1.0
  Downloading yarl-1.9.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (304 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 304.3/304.3 kB 191.0 kB/s eta 0:00:00
Collecting async-timeout<5.0,>=4.0
  Downloading async_timeout-4.0.3-py3-none-any.whl (5.7 kB)
Collecting multidict<7.0,>=4.5
  Downloading multidict-6.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (114 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 114.2/114.2 kB 15.8 MB/s eta 0:00:00
Collecting attrs>=17.3.0
  Downloading attrs-23.1.0-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.2/61.2 kB 1.6 MB/s eta 0:00:00
Collecting aiosignal>=1.1.2
  Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting idna>=2.0
  Downloading idna-3.6-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6/61.6 kB 3.3 MB/s eta 0:00:00
Installing collected packages: multidict, idna, frozenlist, attrs, async-timeout, yarl, aiosignal, aiohttp, aioresponses
Successfully installed aiohttp-3.9.1 aioresponses-0.7.6 aiosignal-1.3.1 async-timeout-4.0.3 attrs-23.1.0 frozenlist-1.4.0 idna-3.6 multidict-6.0.4 yarl-1.9.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
root@computer:/# cd scratch/tests/
root@computer:/scratch/tests# ./test.py
Traceback (most recent call last):
  File "/scratch/tests/./test.py", line 3, in <module>
    import aioresponses
  File "/usr/local/lib/python3.9/site-packages/aioresponses/__init__.py", line 2, in <module>
    from .core import CallbackResult, aioresponses
  File "/usr/local/lib/python3.9/site-packages/aioresponses/core.py", line 33, in <module>
    from .compat import (
  File "/usr/local/lib/python3.9/site-packages/aioresponses/compat.py", line 10, in <module>
    from packaging.version import Version
ModuleNotFoundError: No module named 'packaging'
@gaby
Copy link
Contributor

gaby commented Jan 12, 2024

This actually happens in any version because "packaging" is missing as a dependency.

@pnuckowski Ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants