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: cannot import name spec #85

Closed
MrKiven opened this issue May 27, 2016 · 7 comments
Closed

ImportError: cannot import name spec #85

MrKiven opened this issue May 27, 2016 · 7 comments

Comments

@MrKiven
Copy link

MrKiven commented May 27, 2016

Hi, we have got this error

ImportError: cannot import name spec

we use librabbitmq==1.6.1, kombu==3.0.33

Traceback here:

``
File "/srv/ves/arch.note/.venv/lib/python2.7/site-packages/kombu/init.py", line 67, in getattr

module = import(object_origins[name], None, None, [name])

File "/srv/ves/arch.note/.venv/lib/python2.7/site-packages/kombu/connection.py", line 19, in

from kombu import exceptions

File "/srv/ves/arch.note/.venv/lib/python2.7/site-packages/kombu/exceptions.py", line 12, in

from amqp import ChannelError, ConnectionError, ResourceError

File "/srv/ves/arch.note/.venv/lib/python2.7/site-packages/amqp/init.py", line 39, in

from .basic_message import Message # noqa

File "/srv/ves/arch.note/.venv/lib/python2.7/site-packages/amqp/basic_message.py", line 19, in

from . import spec

ImportError: cannot import name spec
``

@air-upc
Copy link

air-upc commented May 27, 2016

Before Python version 2.7.7, the struct.pack() function required a native string as its format argument.

@MrKiven
Copy link
Author

MrKiven commented May 27, 2016

anyone can check it? @ask

@bastbnl
Copy link

bastbnl commented May 27, 2016

I'm seeing the same message using python 2.7.3 using amqp==2.0.0 since I've upgraded amqp-1.4.9 this morning.

...
from amqp import ChannelError, ConnectionError, ResourceError
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/amqp/init.py", line 39, in
from .basic_message import Message # noqa
File "/var/www/brownpapersession/dev/env-brownpapersession/local/lib/python2.7/site-packages/amqp/basic_message.py", line 19, in
from . import spec
ImportError: cannot import name spec

bastbnl pushed a commit to bastbnl/py-amqp that referenced this issue May 27, 2016
…ning in unicode mode. I guess sys.setdefaultencoding('utf-8') breaks the arguments to the pack
@ask
Copy link
Contributor

ask commented May 27, 2016

Hey!

Kombu 3.x should not be used with amqp 2.0, and the kombu requirements have reflected this since the release of 3.0.0:
https://github.com/celery/kombu/blob/3.0/requirements/default.txt

If you use kombu 3.x, you should keep to the 1.4 series of py-amqp!

@ask
Copy link
Contributor

ask commented May 27, 2016

That said, I don't know if kombu 3.x is actually incompatible, and I don't understand why this error is happening.

The earliest 2.7 version I have available is 2.7.8 and importing amqp.spec works there. Same for 2.7.10.

Could you try to do a pip install vine to see if that helps?

@bastbnl
Copy link

bastbnl commented May 27, 2016

I believe it has to do with the imports within the amqp module.

I've done some changes to get the code imported on python 2.7.3 and created pr #88. My virtualenv has vine 1.1.0, kombu 3.0.35 with celery 3.1.23 (and a lot more). I needed one more change to get celery 3.1.23 running with amqp 2.0.0 as well, but I'll create a separate pr for that

ask added a commit that referenced this issue May 27, 2016
Fixes issue #85: the module can be imported on python 2.7.3 running i…
@MrKiven
Copy link
Author

MrKiven commented May 30, 2016

Actually we rely librabbitmq==1.6.1,

but librabbitmq rely amqp>=1.4.6

https://github.com/celery/librabbitmq/blob/v1.6.1/requirements/default.txt

@MrKiven MrKiven closed this as completed Jun 28, 2016
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

No branches or pull requests

4 participants