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

ImportError: No module named 'aiohttp.errors' #95

Closed
fabianbaier opened this issue Mar 21, 2017 · 10 comments · Fixed by #96
Closed

ImportError: No module named 'aiohttp.errors' #95

fabianbaier opened this issue Mar 21, 2017 · 10 comments · Fixed by #96

Comments

@fabianbaier
Copy link
Contributor

Looks like in version 2.0.0 aiohttp dropped aiohttp.errors: https://media.readthedocs.org/pdf/aiohttp/2.0.0/aiohttp.pdf

When I try to load the library I get:

File "/Users/fabianbaier/anaconda/envs/libmaas/lib/python3.5/site-packages/maas/client/bones/__init__.py", line 19, in <module>
    import aiohttp.errors
ImportError: No module named 'aiohttp.errors'

pip freeze shows aiohttp==2.0.0 - as a work around I installed aiohttp==1.3.3 which produced no import error.

@allenap
Copy link
Contributor

allenap commented Mar 21, 2017

#96 pins aiohttp to >=2.0.0 and fixes the incompatibilities, so hopefully things will be up and running again in a bit. At some point we will freeze the dependencies... looks like sooner might be better than later.

@fabianbaier
Copy link
Contributor Author

mhhh still showing:

File "/usr/local/lib/python3.5/dist-packages/maas/client/viscera/__init__.py", line 39, in <module>
    from .. import bones
  File "/usr/local/lib/python3.5/dist-packages/maas/client/bones/__init__.py", line 20, in <module>
    import aiohttp.errors
ImportError: No module named 'aiohttp.errors'

@brendan-donegan
Copy link
Contributor

brendan-donegan commented Mar 22, 2017

@fabianbaier Can you try running python3.5 then:

>> import aiohttp
>> aiohttp.__version__

See what it says

@brendan-donegan
Copy link
Contributor

@allenap I think @fabianbaier is on to something here. I just installed in a venv and it gave me aiohttp 2.0.1, but I still see the same error

@fabianbaier
Copy link
Contributor Author

I patched it by installing aiohttp==1.3.3 as described above but even with that version:

root@86f797502acb:/# python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aiohttp
>>> aiohttp.version
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'aiohttp' has no attribute 'version'
root@86f797502acb:/# pip3 freeze
aiohttp==1.3.3

@brendan-donegan
Copy link
Contributor

@fabianbaier I think this fix hasn't been released yet. You could install from Github directly?

@brendan-donegan
Copy link
Contributor

@allenap I think we should make a point of updating the setup.py file immediately after releasing so that it's clear that that version hasn't been released yet - I was a bit confused here because the version in the setup.py is 0.4.1 and that is what is in PyPi, but it's not the same code

@brendan-donegan
Copy link
Contributor

@fabianbaier pip install git+https://github.com/maas/python-libmaas.git, fyi

@fabianbaier
Copy link
Contributor Author

Yep, thanks that is working.

Interestingly it fixed also another issue I ran into:

[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from maas.client import viscera, bones
>>> import asyncio
>>> 
>>> 
>>> url = "http://10.0.50.50:5240/MAAS/"
>>> token = "qK9RYAT3pgs2SncrWk:2fL3gMjZasdf8mF5Jrf:ZJ3N5GFUdRBraZsasdfhe3yJYmJMseP8z"
>>> 
>>> profile, session = bones.SessionAPI.connect(url, apikey=token)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'coroutine' object is not iterable

I was wondering why the TypeError was showing in the Docker container but not on my laptop when I am running it on my virtual env. So I checked the virtual env and the versions were everywhere identically. What made the difference and after upgrading back to aiohttp-2.0.1 I directly installed libmaas from Github and the error message disappeared:

Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from maas.client import viscera, bones
>>> import asyncio
>>> 
>>> 
>>> url = "http://galaxy.mesosphe.re:5240/MAAS/"
>>> token = "qK9RfdAT3pgs2SncrWk:2fL3gMjZCdfdamF5Jrf:ZJ3N5GFUdRBraZsM4she3yJYmJMfddsz"
>>> 
>>> profile, session = bones.SessionAPI.connect(url, apikey=token)
>>> print(session)
<maas.client.bones.SessionAPI object at 0x7f330af446a0>
>>> 

In Docker container:

root@687234a00f5d:/galaxy/pulsar# pip3 freeze
aiohttp==2.0.1
argcomplete==1.8.2
asn1crypto==0.22.0
async-timeout==1.2.0
beautifulsoup4==4.5.3
cffi==1.10.0
chardet==2.3.0
colorclass==2.2.0
cryptography==1.8.1
falcon==1.1.0
gunicorn==19.7.1
idna==2.5
multidict==2.1.4
oauthlib==2.0.2
packaging==16.8
paramiko==2.1.2
pyasn1==0.2.3
pycparser==2.17
pyparsing==2.2.0
python-libmaas==0.4.1
python-mimeparse==1.6.0
pytz==2016.10
PyYAML==3.12
requests==2.13.0
six==1.10.0
terminaltables==3.1.0
yarl==0.10.0

In Anaconda env:

pip freeze
aiohttp==1.3.3
argcomplete==1.8.2
asn1crypto==0.22.0
async-timeout==1.2.0
awscli==1.11.63
botocore==1.5.26
cffi==1.10.0
chardet==2.3.0
colorclass==2.2.0
cryptography==1.8.1
Cython==0.25.2
docutils==0.13.1
falcon==1.1.0
gunicorn==19.7.1
idna==2.5
jmespath==0.9.2
multidict==2.1.4
oauthlib==2.0.2
packaging==16.8
paramiko==2.1.2
pyasn1==0.2.3
pycparser==2.17
pyparsing==2.2.0
python-dateutil==2.6.0
python-libmaas==0.4.1
python-mimeparse==1.6.0
pytz==2016.10
PyYAML==3.12
requests==2.13.0
rsa==3.4.2
s3transfer==0.1.10
six==1.10.0
terminaltables==3.1.0
yarl==0.9.8

@vinitkantrod
Copy link

I have aiohttp version 2.3.1 but still getting error

from aiohttp import errors
ImportError: cannot import name 'errors'

Is there any alternative to fix this issue?

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.

5 participants