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

pip install --target wants to remove /usr/bin/easy_install #1636

Closed
eevee opened this issue Mar 12, 2014 · 9 comments
Closed

pip install --target wants to remove /usr/bin/easy_install #1636

eevee opened this issue Mar 12, 2014 · 9 comments
Labels
auto-locked Outdated issues that have been locked by automation project: setuptools Related to setuptools

Comments

@eevee
Copy link

eevee commented Mar 12, 2014

pip 1.5.4 from ~/.local/lib/python2.6/site-packages (python 2.6)

I don't know what it is between me and pip, but it really wants to remove easy_install. I'm starting to get suspicious. ;)

I tried to vendor Pyramid into a larger project with pip install pyramid --target vendor/ and got the following:

...
Installing collected packages: pyramid, setuptools, Chameleon, Mako, WebOb, repoze.lru, zope.interface, zope.deprecation, venusian, translationstring, PasteDeploy, ordereddict, unittest2, MarkupSafe
  Running setup.py install for pyramid
    Installing ptweens script to /tmp/tmpmg6BAW/bin
    Installing proutes script to /tmp/tmpmg6BAW/bin
    Installing pshell script to /tmp/tmpmg6BAW/bin
    Installing prequest script to /tmp/tmpmg6BAW/bin
    Installing pviews script to /tmp/tmpmg6BAW/bin
    Installing bfg2pyramid script to /tmp/tmpmg6BAW/bin
    Installing pcreate script to /tmp/tmpmg6BAW/bin
    Installing pserve script to /tmp/tmpmg6BAW/bin
  Found existing installation: distribute 0.6.10
    Uninstalling distribute:
Cleaning up...
Exception:
Traceback (most recent call last):
  File "~/.local/lib/python2.6/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "~/.local/lib/python2.6/site-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "~/.local/lib/python2.6/site-packages/pip/req.py", line 1431, in install
    requirement.uninstall(auto_confirm=True)
  File "~/.local/lib/python2.6/site-packages/pip/req.py", line 598, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "~/.local/lib/python2.6/site-packages/pip/req.py", line 1836, in remove
    renames(path, new_path)
  File "~/.local/lib/python2.6/site-packages/pip/util.py", line 295, in renames
    shutil.move(old, new)
  File "/usr/lib/python2.6/shutil.py", line 261, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/bin/easy_install'

I'm pretty sure --target should never uninstall anything ever, let alone a system package. I would've been very sad if I'd been root.

Incidentally, given how many ways I find to trip over this, perhaps pip should handle inability to delete files a little more gracefully.

@eevee
Copy link
Author

eevee commented Mar 12, 2014

Also, --ignore-installed didn't help (and I think it's implied anyway), but --no-deps did.

@webmaven
Copy link

Looks like this is related to #1489.

@Ivoz
Copy link
Contributor

Ivoz commented Jul 11, 2014

The functional issue with this is that pyramid formally requires setuptools package to be installed. Setuptools is a replacement package for distribute (which is effectively unmaintained / deprecated - it was merged back into setuptools), and also the fundamental build package python uses. Pip will always try to upgrade it if asked to install setuptools when distribute is present.

So in order to install pyramid, pip needs a working version of setuptools, which needs to replace distribute. distribute being installed as root means it can't be replaced by a user-run pip.

An effective work around then would be to sudo pip uninstall distribute and sudo pip setuptools, after which you should have the latest python building package. I am undecided if there's anything better to do than the current behaviour exhibited (other than improving error messages for these sorts of cases, which are hopefully growing rare with distribute being phased out). Distribute & Setuptools being installed together regularly leads to tonnes of woes.

@eevee
Copy link
Author

eevee commented Jul 11, 2014

That doesn't make sense.

  • This machine has setuptools (0.6c11) installed.
  • pip install --user pyramid works fine: it installs setuptools locally. I would expect --target to similarly put setuptools inside vendor/.

Also, I don't have root. Even if I did, I'd really rather not solve all permissions problems by throwing root at them — in this case, I'd then have to deal with a root-owned vendor directory.

@glyph
Copy link

glyph commented Jul 11, 2014

Is this a duplicate of #1851?

@Ivoz
Copy link
Contributor

Ivoz commented Jul 11, 2014

@eevee no, you have distribute. Found existing installation: distribute 0.6.10 Uninstalling distribute:. distribute pretends that it is setuptools (you don't import distribute, you import setuptools) which causes a lot of confusion.

IMHO the biggest problem is that 0.6.10 is heavily outdated.

@xavfernandez
Copy link
Member

Indeed, it looks like an issue in the old workaround for distribute/setuptools.
Since it was removed in pip 7 via 0017942 we can close this

@xavfernandez xavfernandez added the project: setuptools Related to setuptools label Oct 20, 2015
@webmaven
Copy link

Will a fix be backported to 6.x?

@eevee
Copy link
Author

eevee commented Oct 21, 2015

The fix was to delete a whole bunch of backwards-compatibility code, so I doubt it.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation project: setuptools Related to setuptools
Projects
None yet
Development

No branches or pull requests

5 participants