paylogic / pip-accel

pip-accel: Accelerator for pip, the Python package manager
https://pypi.python.org/pypi/pip-accel
MIT License
308 stars 35 forks source link

pip-accel doesn't support the newest pip? #73

Open santagada opened 8 years ago

santagada commented 8 years ago

Don't know why this exception is happening but here it is, its python3.5.2 on osx with pip: pip 8.1.2 from /Users/santagada/.virtualenvs/accel1/lib/python3.5/site-packages (python 3.5)

pip-accel install -r requirements.txt
2016-07-04 11:47:27 appletart.local pip_accel[34798] INFO Unpacking distribution(s) ..
2016-07-04 11:47:27 appletart.local pip_accel.cli[34798] ERROR Caught unhandled exception!
Traceback (most recent call last):
  File "/Users/santagada/.virtualenvs/accel1/lib/python3.5/site-packages/pip_accel/cli.py", line 57, in main
    accelerator.install_from_arguments(arguments)
  File "/Users/santagada/.virtualenvs/accel1/lib/python3.5/site-packages/pip_accel/__init__.py", line 237, in install_from_arguments
    requirements = self.get_requirements(arguments, use_wheels=self.arguments_allow_wheels(arguments))
  File "/Users/santagada/.virtualenvs/accel1/lib/python3.5/site-packages/pip_accel/__init__.py", line 297, in get_requirements
    return self.unpack_source_dists(arguments, use_wheels=use_wheels)
  File "/Users/santagada/.virtualenvs/accel1/lib/python3.5/site-packages/pip_accel/__init__.py", line 392, in unpack_source_dists
    with PatchedAttribute(pip_install_module, 'PackageFinder', CustomPackageFinder):
  File "/Users/santagada/.virtualenvs/accel1/lib/python3.5/site-packages/pip_accel/__init__.py", line 805, in __enter__
    self.original_value = getattr(self.object, self.attribute)
AttributeError: module 'pip.commands.install' has no attribute 'PackageFinder'
xolox commented 8 years ago

Hey Leonardo and thanks for the feedback. At the moment pip-accel indeed is not compatible (yet) with the 8.x releases of pip, I intend to rectify this in the coming days.

However usually you install pip-accel using pip and when you do so the pip >= 7.0, < 7.2 requirement of pip-accel makes sure that (when necessary) pip is downgraded to the appropriate version. What likely happened here is that you installed pip-accel (and pip was indeed dowgraded) but then something else came along, upgraded pip to the latest 8.x release while being unaware of pip-accel and thereby broke the requirement.

This interaction is an an unfortunate side effect of the Python packaging ecosystem and tooling but I can't really do anything about it; pip and related tools will blindly upgrade any package you give it without double checking whether that breaks the requirements of already installed packages (as opposed to Linux distribution packaging systems based on tools like for example dpkg and apt-get which are way more strict in these things).

I could build in strict version checks within the pip-accel code base that scream at you to upgrade or downgrade pip but to be honest I'm not sure if that would be an actual improvement — I'd rather work on simply updating pip-accel to be compatible with pip 8.x :-).

santagada commented 8 years ago

Then pip 9 will come and it will break again. I really think command line tools should check things and IIRC that is what setuptools does if you are using it to create the bin script for your app.

xolox commented 8 years ago

Yes, software compatibility is not magic, someone has to do the actual work :-P. When you run the pip-accel command line tool you are actually invoking a "console scripts entry point" produced by setuptools (and I'm kind of surprised myself that setuptools didn't complain here), so what more can pip-accel do in this situation? Do you suggest that pip-accel explicitly check the versions of installed requirements at runtime? Nine out of ten times this won't work because an import error will occur before the "please sanity check the versions of installed requirements" code gets to run, so to be honest I'm not sure if there is a point to this. Don't get me wrong, if there is something to take away from the failure that you ran into then I might incorporate that into pip-accel, but only it it's actually useful :-).

xolox commented 8 years ago

I guess the most productive thing we can do here is investigate why setuptools is not validating the requirements before launching pip-accel, so I'll see if I can figure out what is going on there; I've seen setuptools console script entry points breaking due to missing or invalid requirements, so I was expecting the same thing to happen here.