{"action":"opened","issue":{"url":"https://api.github.com/repos/nvie/pip-tools/issues/422","repository_url":"https://api.github.com/repos/nvie/pip-tools","labels_url":"https://api.github.com/repos/nvie/pip-tools/issues/422/labels{/name}","comments_url":"https://api.github.com/repos/nvie/pip-tools/issues/422/comments","events_url":"https://api.github.com/repos/nvie/pip-tools/issues/422/events","html_url":"https://github.com/nvie/pip-tools/issues/422","id":195182212,"number":422,"title":"pip-sync uninstalls pkg-resources, breaks psycopg2","user":{"login":"IlyaSemenov","id":128121,"avatar_url":"https://avatars.githubusercontent.com/u/128121?v=3","gravatar_id":"","url":"https://api.github.com/users/IlyaSemenov","html_url":"https://github.com/IlyaSemenov","followers_url":"https://api.github.com/users/IlyaSemenov/followers","following_url":"https://api.github.com/users/IlyaSemenov/following{/other_user}","gists_url":"https://api.github.com/users/IlyaSemenov/gists{/gist_id}","starred_url":"https://api.github.com/users/IlyaSemenov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IlyaSemenov/subscriptions","organizations_url":"https://api.github.com/users/IlyaSemenov/orgs","repos_url":"https://api.github.com/users/IlyaSemenov/repos","events_url":"https://api.github.com/users/IlyaSemenov/events{/privacy}","received_events_url":"https://api.github.com/users/IlyaSemenov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-13T07:37:08Z","updated_at":"2016-12-13T07:37:08Z","closed_at":null,"body":"`pip-sync` uninstalls `pkg-resources`, which in turn breaks installation of many other packages. `pkg-resources` is a new \"system\" package that was recently extracted from `setuptools` (since version 31, I believe). I think it must be handled similarly to `setuptools`.\r\n\r\n##### Steps to replicate\r\n\r\nOn a fully updated Ubuntu 16.04 LTS:\r\n\r\n```console\r\nsemenov@dev2:~/tmp$ rm -rf ~/.cache/pip\r\nsemenov@dev2:~/tmp$ virtualenv --python=$(which python3) test\r\nAlready using interpreter /usr/bin/python3\r\nUsing base prefix '/usr'\r\nNew python executable in /home/semenov/tmp/test/bin/python3\r\nAlso creating executable in /home/semenov/tmp/test/bin/python\r\nInstalling setuptools, pkg_resources, pip, wheel...done.\r\nsemenov@dev2:~/tmp$ cd test\r\nsemenov@dev2:~/tmp/test$ . bin/activate\r\n(test) semenov@dev2:~/tmp/test$ pip install pip-tools\r\nCollecting pip-tools\r\n  Downloading pip_tools-1.8.0-py2.py3-none-any.whl\r\nCollecting six (from pip-tools)\r\n  Downloading six-1.10.0-py2.py3-none-any.whl\r\nCollecting first (from pip-tools)\r\n  Downloading first-2.0.1-py2.py3-none-any.whl\r\nCollecting click>=6 (from pip-tools)\r\n  Downloading click-6.6-py2.py3-none-any.whl (71kB)\r\n    100% |████████████████████████████████| 71kB 559kB/s\r\nInstalling collected packages: six, first, click, pip-tools\r\nSuccessfully installed click-6.6 first-2.0.1 pip-tools-1.8.0 six-1.10.0\r\n(test) semenov@dev2:~/tmp/test$ echo psycopg2 > requirements.in\r\n(test) semenov@dev2:~/tmp/test$ pip-compile\r\n#\r\n# This file is autogenerated by pip-compile\r\n# To update, run:\r\n#\r\n#    pip-compile --output-file requirements.txt requirements.in\r\n#\r\npsycopg2==2.6.2\r\n(test) semenov@dev2:~/tmp/test$ pip-sync\r\nUninstalling pkg-resources-0.0.0:\r\n  Successfully uninstalled pkg-resources-0.0.0\r\nCollecting psycopg2==2.6.2\r\n  Downloading psycopg2-2.6.2.tar.gz (376kB)\r\n    100% |████████████████████████████████| 378kB 2.4MB/s\r\nCould not import setuptools which is required to install from a source distribution.\r\nTraceback (most recent call last):\r\n  File \"/home/semenov/tmp/test/lib/python3.5/site-packages/pip/req/req_install.py\", line 387, in setup_py\r\n    import setuptools  # noqa\r\n  File \"/home/semenov/tmp/test/lib/python3.5/site-packages/setuptools/__init__.py\", line 10, in <module>\r\n    from setuptools.extern.six.moves import filter, filterfalse, map\r\n  File \"/home/semenov/tmp/test/lib/python3.5/site-packages/setuptools/extern/__init__.py\", line 1, in <module>\r\n    from pkg_resources.extern import VendorImporter\r\nImportError: No module named 'pkg_resources.extern'\r\n\r\nTraceback (most recent call last):\r\n  File \"/home/semenov/tmp/test/bin/pip-sync\", line 11, in <module>\r\n    sys.exit(cli())\r\n  File \"/home/semenov/tmp/test/lib/python3.5/site-packages/click/core.py\", line 716, in __call__\r\n    return self.main(*args, **kwargs)\r\n  File \"/home/semenov/tmp/test/lib/python3.5/site-packages/click/core.py\", line 696, in main\r\n    rv = self.invoke(ctx)\r\n  File \"/home/semenov/tmp/test/lib/python3.5/site-packages/click/core.py\", line 889, in invoke\r\n    return ctx.invoke(self.callback, **ctx.params)\r\n  File \"/home/semenov/tmp/test/lib/python3.5/site-packages/click/core.py\", line 534, in invoke\r\n    return callback(*args, **kwargs)\r\n  File \"/home/semenov/tmp/test/lib/python3.5/site-packages/piptools/scripts/sync.py\", line 72, in cli\r\n    install_flags=install_flags))\r\n  File \"/home/semenov/tmp/test/lib/python3.5/site-packages/piptools/sync.py\", line 157, in sync\r\n    check_call([pip, 'install'] + pip_flags + install_flags + sorted(to_install))\r\n  File \"/usr/lib/python3.5/subprocess.py\", line 581, in check_call\r\n    raise CalledProcessError(retcode, cmd)\r\nsubprocess.CalledProcessError: Command '['pip', 'install', 'psycopg2==2.6.2']' returned non-zero exit status 1\r\n```\r\n\r\n##### Expected result\r\n\r\n`pip-sync` keeps `pkg-resources` in place, `psycopg2` installs normally.\r\n\r\n##### Actual result\r\n\r\n`pip-sync` uninstalls `pkg-resources`, then `psycopg2` installation fails with: `ImportError: No module named 'pkg_resources.extern'`"}}
{"actor":{"display_login":"IlyaSemenov"}}