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

requests library uses "wheel" file #134

Closed
cbrinley opened this issue Mar 10, 2014 · 9 comments
Closed

requests library uses "wheel" file #134

cbrinley opened this issue Mar 10, 2014 · 9 comments

Comments

@cbrinley
Copy link
Contributor

This is arguably not a locust issue but I wanted to make you aware of it. Full acknowledgement that I may have also done something dumb by accident.

On a new RHEL AWS server running "pip install locust" finishes correctly.
When running "locust --help" or any other command line variant the package manager raises following exception:

root@AWS_HOST scripts]# locust --help
Traceback (most recent call last):
  File "/usr/bin/locust", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: requests>=2.2

Upon further investigation this appears to be due to the fact that the latest pip install of requests uses Wheel now instead of egg format. As a result the following logic fails in package manager:

> /usr/lib/python2.6/site-packages/pkg_resources.py(1694)find_on_path()->None
-> for entry in os.listdir(path_item):
(Pdb) l
1689                        path_item, os.path.join(path_item,'EGG-INFO')
1690                    )
1691                )
1692            else:
1693                # scan for .egg and .egg-info in directory
1694                for entry in os.listdir(path_item):
1695                    lower = entry.lower()
1696 ->                     if lower.endswith('.egg-info'):
1697                        fullpath = os.path.join(path_item, entry)
1698                        if os.path.isdir(fullpath):
1699                            # egg-info directory, allow getting metadata


Installing requests from source via setup.py creates the egg-info file and fixes this issue.

I am not currently very familiar with this wheel format but will investigate further to see if there is a simple work around. 
@heyman
Copy link
Member

heyman commented Mar 10, 2014

Hmm, interesting. I can't look at it right now, but I I'm very interested to hear of any results if you do any further investigation.

@Huangjiamin
Copy link

I do have this problem too, anyone has any idea?

@mrjf
Copy link
Contributor

mrjf commented Jul 22, 2014

I had the same issue after fresh install of locustio via pip on OS X 10.9.4. The workaround @Huangjiamin is as @cbrinley suggests: install requests from source with setup.py, e.g:

git clone https://github.com/kennethreitz/requests.git
cd requests
python setup.py install

@marshyski
Copy link

Can we close this issue? @mrjf your fix works!

@heyman
Copy link
Member

heyman commented Nov 3, 2014

Does anyone know a way I can reproduce this issue? I have no trouble installing Locust using pip install locustio in a fresh virtualenv. However, if there are common use-cases where the installation fails, we should probably try to fix it if possible.

@marshyski
Copy link

@heyman are you doing this with OS X? It only behaved like this on OS X 10.9.4.

@heyman
Copy link
Member

heyman commented Nov 3, 2014

@marshyski, Yep. OSX 10.9.2 though. Does it happen when installing into a virtualenv, or only when installing it system-wide?

@marshyski
Copy link

system-wide, and installing requests from source system-wide fixes it.

@katkorian
Copy link

Had a similar issue on RHEL6 - python2.6.

Steps:

  • fresh RHEL6 host
$ uname -r
2.6.32-431.23.3.el6.x86_64
  • download and run latest get-pip.py
  • sudo pip install locustio
Collecting MarkupSafe (from Jinja2>=2.4->flask>=0.10.1->locustio)
  Using cached MarkupSafe-0.23.tar.gz
Building wheels for collected packages: locustio, gevent, flask, msgpack-python, greenlet, itsdangerous, MarkupSafe
  Running setup.py bdist_wheel for locustio
  Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-onsSZr/locustio/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpfRfFg1pip-wheel-:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for locustio
  • installation continues and finishes with more failed errors for each dependent packages, last line is
Successfully installed Jinja2-2.8 MarkupSafe-0.23 Werkzeug-0.10.4 flask-0.10.1 gevent-1.0.2 greenlet-0.4.7 itsdangerous-0.24 locustio-0.7.3 msgpack-python-0.4.6 requests-2.7.0
  • As @cbrinley mentioned, locust --help fails with error

Fix

Based on the trace and changes in pip, below steps fixed the issue for me.

$ pip wheel
ERROR: 'pip wheel' requires setuptools >= 0.8 for dist-info support. To fix this, run: pip install --upgrade setuptools

$ sudo pip install --upgrade setuptools

$ pip wheel locustio

@heyman heyman closed this as completed Oct 7, 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

6 participants