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

Not compatible with alternative install locations, e.g. `--user`? #74

Open mrmachine opened 8 years ago

mrmachine commented 8 years ago

See: https://pip.pypa.io/en/stable/user_guide/#user-installs and https://docs.python.org/2/install/#alternate-installation-the-user-scheme

First, I attempt to install a package into user directory with pip-accel:

root@2e8a8b0ecfaf:/opt/icekit# pip-accel install --user jsonfield
2016-08-09 05:31:31 2e8a8b0ecfaf pip_accel[843] INFO Unpacking distribution(s) ..
2016-08-09 05:31:31 2e8a8b0ecfaf pip_accel[843] INFO Executing command: pip install --download=/root/.pip-accel/sources --find-links=file:///root/.pip-accel/sources --no-index --no-clean --build-directory=/tmp/pip-accel-build-dir-WYPs6p --user jsonfield
2016-08-09 05:31:31 2e8a8b0ecfaf pip.commands.install[843] INFO Ignoring indexes: https://devpi.ixcsandbox.com/ic/dev/+simple
2016-08-09 05:31:32 2e8a8b0ecfaf pip.req.req_set[843] INFO Collecting jsonfield
2016-08-09 05:31:32 2e8a8b0ecfaf pip.download[843] INFO File was already downloaded /root/.pip-accel/sources/jsonfield-1.0.3.tar.gz
2016-08-09 05:31:33 2e8a8b0ecfaf pip.req.req_set[843] INFO Requirement already satisfied (use --upgrade to upgrade): Django>=1.4.3 in ./venv/lib/python2.7/site-packages (from jsonfield)
2016-08-09 05:31:33 2e8a8b0ecfaf pip.commands.install[843] INFO Successfully downloaded jsonfield
2016-08-09 05:31:33 2e8a8b0ecfaf pip_accel[843] INFO Finished unpacking 1 distribution in 1.4 second.
2016-08-09 05:31:33 2e8a8b0ecfaf pip_accel[843] INFO Installing from binary distributions ..
2016-08-09 05:31:33 2e8a8b0ecfaf pip_accel[843] INFO Installing jsonfield (1.0.3) binary distribution using pip-accel ..
2016-08-09 05:31:33 2e8a8b0ecfaf pip_accel[843] INFO Finished installing 1 requirement in 0.11 seconds.

But when I check installed packages, it's not there:

root@2e8a8b0ecfaf:/opt/icekit# pip freeze --user | grep jsonfield
(no output)

It's also not even in system site packages:

root@2e8a8b0ecfaf:/opt/icekit# pip freeze | grep jsonfield
(no output)

Try again, same result:

root@2e8a8b0ecfaf:/opt/icekit# pip-accel install --user jsonfield
2016-08-09 05:31:57 2e8a8b0ecfaf pip_accel[858] INFO Unpacking distribution(s) ..
2016-08-09 05:31:57 2e8a8b0ecfaf pip_accel[858] INFO Executing command: pip install --download=/root/.pip-accel/sources --find-links=file:///root/.pip-accel/sources --no-index --no-clean --build-directory=/tmp/pip-accel-build-dir-5SFXU5 --user jsonfield
2016-08-09 05:31:57 2e8a8b0ecfaf pip.commands.install[858] INFO Ignoring indexes: https://devpi.ixcsandbox.com/ic/dev/+simple
2016-08-09 05:31:58 2e8a8b0ecfaf pip.req.req_set[858] INFO Collecting jsonfield
2016-08-09 05:31:58 2e8a8b0ecfaf pip.download[858] INFO File was already downloaded /root/.pip-accel/sources/jsonfield-1.0.3.tar.gz
2016-08-09 05:31:59 2e8a8b0ecfaf pip.req.req_set[858] INFO Requirement already satisfied (use --upgrade to upgrade): Django>=1.4.3 in ./venv/lib/python2.7/site-packages (from jsonfield)
2016-08-09 05:31:59 2e8a8b0ecfaf pip.commands.install[858] INFO Successfully downloaded jsonfield
2016-08-09 05:31:59 2e8a8b0ecfaf pip_accel[858] INFO Finished unpacking 1 distribution in 1.17 second.
2016-08-09 05:31:59 2e8a8b0ecfaf pip_accel[858] INFO Installing from binary distributions ..
2016-08-09 05:31:59 2e8a8b0ecfaf pip_accel[858] INFO Installing jsonfield (1.0.3) binary distribution using pip-accel ..
2016-08-09 05:31:59 2e8a8b0ecfaf pip_accel[858] INFO Finished installing 1 requirement in 0.1 seconds.
root@2e8a8b0ecfaf:/opt/icekit# pip freeze --user | grep jsonfield
root@2e8a8b0ecfaf:/opt/icekit# pip freeze | grep jsonfield

Try with pip, and it works as expected:

root@2e8a8b0ecfaf:/opt/icekit# pip install --user jsonfield
Collecting jsonfield
Requirement already satisfied (use --upgrade to upgrade): Django>=1.4.3 in ./venv/lib/python2.7/site-packages (from jsonfield)
Installing collected packages: jsonfield
Successfully installed jsonfield-1.0.3
root@2e8a8b0ecfaf:/opt/icekit# pip freeze --user | grep jsonfield
jsonfield==1.0.3
mrmachine commented 8 years ago

I subsequently noticed a lib directory in my current working directory. I didn't look inside it before it was removed, but I suspect that my PIP_SRC and/or PYTHONUSERBASE environment variables are not being passed through to pip by pip-accel?

xolox commented 8 years ago

Hi Tai Lee and thanks for the feedback. I'll take a more detailed look at this soon, but I wanted to share an observation with you:

I have been successfully using pip-accel install --user ... commands for a few months now (as part of a scheme to install my personal and favorite Python packages and tools in my per-user site-packages directory, this concerns roughly 90 packages) and while trying to get this to work the first time around, I found out that I needed to install pip-accel in the per-user site-packages directory in order to successfully install other packages in the per-user site-packages directory using pip-accel.

I realize pip doesn't require the same treatment and yes this is a bug (not sure how easy it is to fix), but I wanted to point out that there is at least a workaround that I've used successfully for a while now.