{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3298","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3298/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3298/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3298/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/3298","id":142533337,"number":3298,"title":"Unable to install Python 3.5 packages using the pip module","user":{"login":"fgimian","id":1811813,"avatar_url":"https://avatars.githubusercontent.com/u/1811813?v=3","gravatar_id":"","url":"https://api.github.com/users/fgimian","html_url":"https://github.com/fgimian","followers_url":"https://api.github.com/users/fgimian/followers","following_url":"https://api.github.com/users/fgimian/following{/other_user}","gists_url":"https://api.github.com/users/fgimian/gists{/gist_id}","starred_url":"https://api.github.com/users/fgimian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgimian/subscriptions","organizations_url":"https://api.github.com/users/fgimian/orgs","repos_url":"https://api.github.com/users/fgimian/repos","events_url":"https://api.github.com/users/fgimian/events{/privacy}","received_events_url":"https://api.github.com/users/fgimian/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-22T03:08:49Z","updated_at":"2016-03-25T20:58:33Z","closed_at":null,"body":"##### Issue Type:\r\n\r\n - Bug Report\r\n\r\n##### Plugin Name:\r\n\r\npackaging/language/pip\r\n\r\n##### Ansible Version:\r\n\r\n```\r\n2.0.1.0\r\n```\r\n\r\n##### Ansible Configuration:\r\n\r\nNo ansible.cfg present\r\n\r\n##### Environment:\r\n\r\nMac OS X 10.11.3 (15D21)\r\n\r\n##### Summary:\r\n\r\nUnable to install packages using the pip module when executable is Python 3.x pip\r\n\r\n##### Steps To Reproduce:\r\n\r\nFirstly, you can see that pip3 works correctly when run without Ansible:\r\n\r\n```\r\nFotsies-MBP:macbuild fots$ pip3 install ipython\r\nCollecting ipython\r\n  Downloading ipython-4.1.2-py3-none-any.whl (736kB)\r\n    100% |████████████████████████████████| 737kB 333kB/s \r\nRequirement already satisfied (use --upgrade to upgrade): appnope in /usr/local/lib/python3.5/site-packages (from ipython)\r\nRequirement already satisfied (use --upgrade to upgrade): pickleshare in /usr/local/lib/python3.5/site-packages (from ipython)\r\nRequirement already satisfied (use --upgrade to upgrade): decorator in /usr/local/lib/python3.5/site-packages (from ipython)\r\nRequirement already satisfied (use --upgrade to upgrade): pexpect in /usr/local/lib/python3.5/site-packages (from ipython)\r\nRequirement already satisfied (use --upgrade to upgrade): setuptools>=18.5 in /usr/local/lib/python3.5/site-packages (from ipython)\r\nRequirement already satisfied (use --upgrade to upgrade): simplegeneric>0.8 in /usr/local/lib/python3.5/site-packages (from ipython)\r\nRequirement already satisfied (use --upgrade to upgrade): traitlets in /usr/local/lib/python3.5/site-packages (from ipython)\r\nRequirement already satisfied (use --upgrade to upgrade): gnureadline in /usr/local/lib/python3.5/site-packages (from ipython)\r\nRequirement already satisfied (use --upgrade to upgrade): path.py>=6.2 in /usr/local/lib/python3.5/site-packages (from pickleshare->ipython)\r\nRequirement already satisfied (use --upgrade to upgrade): ptyprocess>=0.5 in /usr/local/lib/python3.5/site-packages (from pexpect->ipython)\r\nRequirement already satisfied (use --upgrade to upgrade): ipython-genutils in /usr/local/lib/python3.5/site-packages (from traitlets->ipython)\r\nInstalling collected packages: ipython\r\nSuccessfully installed ipython-4.1.2\r\nYou are using pip version 8.0.2, however version 8.1.0 is available.\r\nYou should consider upgrading via the 'pip install --upgrade pip' command.\r\n```\r\n\r\nHowever, when trying this with Ansible, we get an exception:\r\n\r\n```\r\notsies-MBP:macbuild fots$ ansible localhost -m pip -a \"name=ipython state=latest executable=pip3\"\r\nlocalhost | FAILED! => {\r\n    \"changed\": false, \r\n    \"cmd\": \"/usr/local/bin/pip3 install -U ipython\", \r\n    \"failed\": true, \r\n    \"msg\": \"\\n:stderr: Traceback (most recent call last):\\n  File \\\"/usr/local/bin/pip3\\\", line 9, in <module>\\n    load_entry_point('pip==8.0.2', 'console_scripts', 'pip3')()\\n  File \\\"/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py\\\", line 549, in load_entry_point\\n    return get_distribution(dist).load_entry_point(group, name)\\n  File \\\"/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py\\\", line 2542, in load_entry_point\\n    return ep.load()\\n  File \\\"/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py\\\", line 2202, in load\\n    return self.resolve()\\n  File \\\"/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py\\\", line 2208, in resolve\\n    module = __import__(self.module_name, fromlist=['__name__'], level=0)\\n  File \\\"/usr/local/lib/python3.5/site-packages/pip/__init__.py\\\", line 15, in <module>\\n    from pip.vcs import git, mercurial, subversion, bazaar  # noqa\\n  File \\\"/usr/local/lib/python3.5/site-packages/pip/vcs/subversion.py\\\", line 9, in <module>\\n    from pip.index import Link\\n  File \\\"/usr/local/lib/python3.5/site-packages/pip/index.py\\\", line 29, in <module>\\n    from pip.wheel import Wheel, wheel_ext\\n  File \\\"/usr/local/lib/python3.5/site-packages/pip/wheel.py\\\", line 6, in <module>\\n    import compileall\\n  File \\\"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/compileall.py\\\", line 20, in <module>\\n    from concurrent.futures import ProcessPoolExecutor\\n  File \\\"/usr/local/Cellar/ansible/2.0.1.0/libexec/vendor/lib/python2.7/site-packages/concurrent/futures/__init__.py\\\", line 8, in <module>\\n    from concurrent.futures._base import (FIRST_COMPLETED,\\n  File \\\"/usr/local/Cellar/ansible/2.0.1.0/libexec/vendor/lib/python2.7/site-packages/concurrent/futures/_base.py\\\", line 357\\n    raise type(self._exception), self._exception, self._traceback\\n                               ^\\nSyntaxError: invalid syntax\\n\"\r\n}\r\n```\r\n\r\n##### Expected Results:\r\n\r\nExpected ipython to be installed in my Python 3.x environment\r\n\r\n##### Actual Results:\r\n\r\n```\r\nFotsies-MBP:macbuild fots$ ansible -vvvv localhost -m pip -a \"name=ipython state=latest executable=pip3\"\r\nNo config file found; using defaults\r\nLoaded callback minimal of type stdout, v2.0\r\nESTABLISH LOCAL CONNECTION FOR USER: fots\r\n127.0.0.1 EXEC /bin/sh -c '( umask 22 && mkdir -p \"` echo $HOME/.ansible/tmp/ansible-tmp-1458616109.17-280776356178950 `\" && echo \"` echo $HOME/.ansible/tmp/ansible-tmp-1458616109.17-280776356178950 `\" )'\r\n127.0.0.1 PUT /var/folders/rf/z0ksnk7d4031bmw8zg8gh5f00000gn/T/tmphAAvMP TO /Volumes/Data/fots/.ansible/tmp/ansible-tmp-1458616109.17-280776356178950/pip\r\n127.0.0.1 EXEC /bin/sh -c 'LANG=en_AU.UTF-8 LC_ALL=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8 /usr/bin/python /Volumes/Data/fots/.ansible/tmp/ansible-tmp-1458616109.17-280776356178950/pip; rm -rf \"/Volumes/Data/fots/.ansible/tmp/ansible-tmp-1458616109.17-280776356178950/\" > /dev/null 2>&1'\r\nlocalhost | FAILED! => {\r\n    \"changed\": false, \r\n    \"cmd\": \"/usr/local/bin/pip3 install -U ipython\", \r\n    \"failed\": true, \r\n    \"invocation\": {\r\n        \"module_args\": {\r\n            \"chdir\": null, \r\n            \"editable\": true, \r\n            \"executable\": \"pip3\", \r\n            \"extra_args\": null, \r\n            \"name\": \"ipython\", \r\n            \"requirements\": null, \r\n            \"state\": \"latest\", \r\n            \"use_mirrors\": true, \r\n            \"version\": null, \r\n            \"virtualenv\": null, \r\n            \"virtualenv_command\": \"virtualenv\", \r\n            \"virtualenv_python\": null, \r\n            \"virtualenv_site_packages\": false\r\n        }, \r\n        \"module_name\": \"pip\"\r\n    }, \r\n    \"msg\": \"\\n:stderr: Traceback (most recent call last):\\n  File \\\"/usr/local/bin/pip3\\\", line 9, in <module>\\n    load_entry_point('pip==8.0.2', 'console_scripts', 'pip3')()\\n  File \\\"/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py\\\", line 549, in load_entry_point\\n    return get_distribution(dist).load_entry_point(group, name)\\n  File \\\"/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py\\\", line 2542, in load_entry_point\\n    return ep.load()\\n  File \\\"/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py\\\", line 2202, in load\\n    return self.resolve()\\n  File \\\"/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py\\\", line 2208, in resolve\\n    module = __import__(self.module_name, fromlist=['__name__'], level=0)\\n  File \\\"/usr/local/lib/python3.5/site-packages/pip/__init__.py\\\", line 15, in <module>\\n    from pip.vcs import git, mercurial, subversion, bazaar  # noqa\\n  File \\\"/usr/local/lib/python3.5/site-packages/pip/vcs/subversion.py\\\", line 9, in <module>\\n    from pip.index import Link\\n  File \\\"/usr/local/lib/python3.5/site-packages/pip/index.py\\\", line 29, in <module>\\n    from pip.wheel import Wheel, wheel_ext\\n  File \\\"/usr/local/lib/python3.5/site-packages/pip/wheel.py\\\", line 6, in <module>\\n    import compileall\\n  File \\\"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/compileall.py\\\", line 20, in <module>\\n    from concurrent.futures import ProcessPoolExecutor\\n  File \\\"/usr/local/Cellar/ansible/2.0.1.0/libexec/vendor/lib/python2.7/site-packages/concurrent/futures/__init__.py\\\", line 8, in <module>\\n    from concurrent.futures._base import (FIRST_COMPLETED,\\n  File \\\"/usr/local/Cellar/ansible/2.0.1.0/libexec/vendor/lib/python2.7/site-packages/concurrent/futures/_base.py\\\", line 357\\n    raise type(self._exception), self._exception, self._traceback\\n                               ^\\nSyntaxError: invalid syntax\\n\"\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/201498488","html_url":"https://github.com/ansible/ansible-modules-core/issues/3298#issuecomment-201498488","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/3298","id":201498488,"user":{"login":"guhcampos","id":3371352,"avatar_url":"https://avatars.githubusercontent.com/u/3371352?v=3","gravatar_id":"","url":"https://api.github.com/users/guhcampos","html_url":"https://github.com/guhcampos","followers_url":"https://api.github.com/users/guhcampos/followers","following_url":"https://api.github.com/users/guhcampos/following{/other_user}","gists_url":"https://api.github.com/users/guhcampos/gists{/gist_id}","starred_url":"https://api.github.com/users/guhcampos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guhcampos/subscriptions","organizations_url":"https://api.github.com/users/guhcampos/orgs","repos_url":"https://api.github.com/users/guhcampos/repos","events_url":"https://api.github.com/users/guhcampos/events{/privacy}","received_events_url":"https://api.github.com/users/guhcampos/received_events","type":"User","site_admin":false},"created_at":"2016-03-25T20:58:33Z","updated_at":"2016-03-25T20:58:33Z","body":"+1 I get the exact same error while trying to use Ansible from Homebrew and Python 3.5.1. \r\n\r\nAnsible is installed into Python2.7 site-packages by brew, but it turns out it's impossible to manage a Python 3.5 virtual env from it. \r\n\r\nI got the same error on a remote Python 3.5 install as well, as opposed to `localhost`"}}