cr0hn / enteletaor

Message Queue & Broker Injection tool
Other
148 stars 20 forks source link

Issue with building on ArchLinux due to amqp version #4

Open archey opened 8 years ago

archey commented 8 years ago

The version of python2-amqp on archlinux is 2.0.2, but the code seems to require a version of equal to or above 1.4.9 but below version 2.0.

Traceback (most recent call last): File "/usr/bin/enteletaor", line 5, in from pkg_resources import load_entry_point File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 2927, in @_call_aside File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 2913, in _call_aside f(_args, *_kwargs) File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 2940, in _initialize_master_working_set working_set = WorkingSet._build_master() File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 637, in _build_master return cls._build_from_requirements(requires) File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 650, in _build_from_requirements dists = ws.resolve(reqs, Environment()) File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 834, in resolve raise VersionConflict(dist, req).with_context(dependent_req)

pkg_resources.ContextualVersionConflict: (amqp 2.0.2 (/usr/lib/python2.7/site-packages), Requirement.parse('amqp<2.0,>=1.4.9'), set(['kombu'])) Is it possible to patch the code for 2.0.2, I can certainly put a patch in place to fix the error, but I wanted to check to see if there was a reason not to patch it for 2.0.2

decidedlygray commented 8 years ago

I believe this is for any linux environment, not just Arch. Seems to work fine forcing the AQMP requirement to a lower version, not sure how complicated an update to internal packages would be. Here is the quick fix, in case this helps someone in the future.

The default requirements.txt file included with enteletaor doesn't include any version information. In some environments this may cause installation to fail because a newer version of amqp is installed by pip by default than is allowed. Using a new virtualenv and Python2.7 you will get this error:

Installed /usr/local/lib/python2.7/dist-packages/enteletaor-1.1.1-py2.7.egg
Processing dependencies for enteletaor==1.1.1
error: amqp 2.0.3 is installed but amqp<2.0,>=1.4.9 is required by set(['kombu'])

The fix is to add proper version tags for amqp, so that the kombu requirment can be met.

The new requirements.txt:

six
lxml
wtforms
eventlet
colorlog
ipaddress

# MQ/Brokers requirements
redis
kombu
celery
pyzmq
#amqp
amqp<2.0,>=1.4.9

# contrib dependencies
requests
netaddr
cr0hn commented 8 years ago

Hi,

I can't reproduce the bug. Could you send me the command used?

decidedlygray commented 8 years ago

Not sure if @archey did the same, but for me the issue came up during the initial python setup.py

Are you trying to recreate in a new environment? I believe I was just using a new Kali VM. I git cloned, tried to run python setup.py and got the error message. Fixing requirements.txt to downgrade the version let me set up properly.

decidedlygray commented 6 years ago

Following up on this: It looks like kombu now requires amqp<3.0,>=2.1.4, but the project breaks when connecting to RabbitMQ with the error:

    socket_settings=socket_settings, **kwargs)
  File "/root/projects/amqp/enteletaor/venv-entel/local/lib/python2.7/site-packages/amqp/transport.py", line 443, in Transport
    return transport(host, connect_timeout=connect_timeout, ssl=ssl, **kwargs)
TypeError: new_transport_init() got an unexpected keyword argument 'read_timeout

No fix or workaround for this yet

decidedlygray commented 6 years ago

So the core issue here I believe is that, since no packages in requirements.txt are tagged with version numbers (from something like pip freeze), and since celery, kombu and amqp are actively developed and have gone through changes over the past few years, it is tough to know which version enteletaor was developed using.

This seems to work:

pip uninstall celery
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org celery==3.1.22

On a fresh install, it will rip out the bad/latest versions of stuff and install and older version of celery as well as kombu and amqp. I am still getting a crash, but I am not quite sure if it's because of the message broker or a Python package issue.

decidedlygray commented 6 years ago

Also, for anyone else that happens upon this thread: the release tarball does not contain dependencies, so you'll run into this same issue trying to use it