{"action":"created","issue":{"url":"https://api.github.com/repos/pypa/pip/issues/1356","labels_url":"https://api.github.com/repos/pypa/pip/issues/1356/labels{/name}","comments_url":"https://api.github.com/repos/pypa/pip/issues/1356/comments","events_url":"https://api.github.com/repos/pypa/pip/issues/1356/events","html_url":"https://github.com/pypa/pip/issues/1356","id":23583376,"number":1356,"title":"Installing several libs to the same target can result in an exception","user":{"login":"mal","id":591257,"avatar_url":"https://avatars.githubusercontent.com/u/591257?v=3","gravatar_id":"","url":"https://api.github.com/users/mal","html_url":"https://github.com/mal","followers_url":"https://api.github.com/users/mal/followers","following_url":"https://api.github.com/users/mal/following{/other_user}","gists_url":"https://api.github.com/users/mal/gists{/gist_id}","starred_url":"https://api.github.com/users/mal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mal/subscriptions","organizations_url":"https://api.github.com/users/mal/orgs","repos_url":"https://api.github.com/users/mal/repos","events_url":"https://api.github.com/users/mal/events{/privacy}","received_events_url":"https://api.github.com/users/mal/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pypa/pip/labels/bug","name":"bug","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2013-12-02T16:26:06Z","updated_at":"2015-02-14T12:30:23Z","closed_at":null,"body":"Steps to produce:\r\n```sh\r\nmkdir test; cd test\r\npip install -t local bottle\r\npip install -t local pytest\r\npip install -t local pytest_cov\r\n```\r\n\r\nResult:\r\n```\r\nSuccessfully installed pytest-cov pytest cov-core py coverage\r\nCleaning up...\r\nException:\r\nTraceback (most recent call last):\r\n  File \"/home/mal/.pyenv/versions/3.3.2/lib/python3.3/site-packages/pip-1.4.1-py3.3.egg/pip/basecommand.py\", line 134, in main\r\n    status = self.run(options, args)\r\n  File \"/home/mal/.pyenv/versions/3.3.2/lib/python3.3/site-packages/pip-1.4.1-py3.3.egg/pip/commands/install.py\", line 268, in run\r\n    os.path.join(options.target_dir, item)\r\n  File \"/home/mal/.pyenv/versions/3.3.2/lib/python3.3/shutil.py\", line 520, in move\r\n    raise Error(\"Destination path '%s' already exists\" % real_dst)\r\nshutil.Error: Destination path '/home/mal/local/__pycache__/__pycache__' already exists\r\n```\r\n\r\nWrapping [this line](https://github.com/pypa/pip/blob/48f8c0a18e931c60837b01e59e8fa3d16aa94fbf/pip/commands/install.py#L301) in a `try..except` solves this problem for me, not sure how viable that is as a real world fix.\r\n\r\nGuessing this occurs because each tries to move the `__pycache__` folder. The first two succeed (sort of; the second `__pycache__` ends up inside the first), the third fails. Another solution might be to exempt `__pycache__` from being copied here?"},"comment":{"url":"https://api.github.com/repos/pypa/pip/issues/comments/74373250","html_url":"https://github.com/pypa/pip/issues/1356#issuecomment-74373250","issue_url":"https://api.github.com/repos/pypa/pip/issues/1356","id":74373250,"user":{"login":"mal","id":591257,"avatar_url":"https://avatars.githubusercontent.com/u/591257?v=3","gravatar_id":"","url":"https://api.github.com/users/mal","html_url":"https://github.com/mal","followers_url":"https://api.github.com/users/mal/followers","following_url":"https://api.github.com/users/mal/following{/other_user}","gists_url":"https://api.github.com/users/mal/gists{/gist_id}","starred_url":"https://api.github.com/users/mal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mal/subscriptions","organizations_url":"https://api.github.com/users/mal/orgs","repos_url":"https://api.github.com/users/mal/repos","events_url":"https://api.github.com/users/mal/events{/privacy}","received_events_url":"https://api.github.com/users/mal/received_events","type":"User","site_admin":false},"created_at":"2015-02-14T12:30:23Z","updated_at":"2015-02-14T12:30:23Z","body":"/cc @qwcode \r\n\r\nAs of #2122 (v6.0) this issue changed, but still exists:\r\n\r\n```\r\n$ python --version; pip --version\r\nPython 3.4.1\r\npip 6.0.8 from /home/mal/.pyenv/versions/3.4.1/lib/python3.4/site-packages (python 3.4)\r\n$ pip install -t local bottle\r\n...\r\nSuccessfully installed bottle\r\n\r\n$ pip install -t local pytest\r\n...\r\nSuccessfully installed py pytest\r\nTarget directory /home/mal/code/personal/pip/test/local/__pycache__ already exists. Specify --upgrade to force replacement.\r\n```\r\n\r\n```\r\n$ python --version; pip --version\r\nPython 2.7.3\r\npip 6.0.8 from /usr/local/lib/python2.7/dist-packages (python 2.7)\r\n$ pip install -t local bottle\r\n...\r\nSuccessfully installed bottle\r\n\r\n$ pip install -t local pytest\r\n...\r\nSuccessfully installed py-1.4.13 pytest-2.3.4\r\n\r\n$ pip install -t local pytest_cov\r\n...\r\nSuccessfully installed cov-core coverage py-1.4.13 pytest-2.3.4 pytest-cov\r\nTarget directory /home/mal/code/personal/pip/test/local/pytest-2.6.4-py2.7.egg-info already exists. Specify --upgrade to force replacement.\r\nTarget directory /home/mal/code/personal/pip/test/local/pytest.py already exists. Specify --upgrade to force replacement.\r\nTarget directory /home/mal/code/personal/pip/test/local/py-1.4.26-py2.7.egg-info already exists. Specify --upgrade to force replacement.\r\nTarget directory /home/mal/code/personal/pip/test/local/_pytest already exists. Specify --upgrade to force replacement.\r\nTarget directory /home/mal/code/personal/pip/test/local/py already exists. Specify --upgrade to force replacement.\r\nTarget directory /home/mal/code/personal/pip/test/local/pytest.pyc already exists. Specify --upgrade to force replacement.\r\n```\r\n\r\nIt can now be mitigated more easily by simply always using the `--upgrade` flag however this is far from desired and risks breaking the dependency tree. I'm guessing the \"proper\" solution to this involves some earlier part of pip looking in the target directory to establish the current state of it and the contained dependencies?\r\n\r\nAs previously stated, I'm happy to spend a bit of time on this, but would appreciate some guidance as to what desired behaviour would be, and where that logic should live in advance of committing time and effort to a solution that may ultimately be unacceptable in the context of the broader community."}}