{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/29039","labels_url":"https://api.github.com/repos/saltstack/salt/issues/29039/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/29039/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/29039/events","html_url":"https://github.com/saltstack/salt/pull/29039","id":117773844,"number":29039,"title":"Allow passing list of pip packages to virtualenv.managed","user":{"login":"anlutro","id":163093,"avatar_url":"https://avatars.githubusercontent.com/u/163093?v=3","gravatar_id":"","url":"https://api.github.com/users/anlutro","html_url":"https://github.com/anlutro","followers_url":"https://api.github.com/users/anlutro/followers","following_url":"https://api.github.com/users/anlutro/following{/other_user}","gists_url":"https://api.github.com/users/anlutro/gists{/gist_id}","starred_url":"https://api.github.com/users/anlutro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anlutro/subscriptions","organizations_url":"https://api.github.com/users/anlutro/orgs","repos_url":"https://api.github.com/users/anlutro/repos","events_url":"https://api.github.com/users/anlutro/events{/privacy}","received_events_url":"https://api.github.com/users/anlutro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-19T09:28:52Z","updated_at":"2015-11-19T10:42:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/saltstack/salt/pulls/29039","html_url":"https://github.com/saltstack/salt/pull/29039","diff_url":"https://github.com/saltstack/salt/pull/29039.diff","patch_url":"https://github.com/saltstack/salt/pull/29039.patch"},"body":"If I want to create a simple virtualenv, I have to add a `file.managed` for a requirements.txt, or I have to use `pip.installed` with `bin_env`, but that requires the pip system package to be installed."},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/158019303","html_url":"https://github.com/saltstack/salt/pull/29039#issuecomment-158019303","issue_url":"https://api.github.com/repos/saltstack/salt/issues/29039","id":158019303,"user":{"login":"silenius","id":1225348,"avatar_url":"https://avatars.githubusercontent.com/u/1225348?v=3","gravatar_id":"","url":"https://api.github.com/users/silenius","html_url":"https://github.com/silenius","followers_url":"https://api.github.com/users/silenius/followers","following_url":"https://api.github.com/users/silenius/following{/other_user}","gists_url":"https://api.github.com/users/silenius/gists{/gist_id}","starred_url":"https://api.github.com/users/silenius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silenius/subscriptions","organizations_url":"https://api.github.com/users/silenius/orgs","repos_url":"https://api.github.com/users/silenius/repos","events_url":"https://api.github.com/users/silenius/events{/privacy}","received_events_url":"https://api.github.com/users/silenius/received_events","type":"User","site_admin":false},"created_at":"2015-11-19T10:42:20Z","updated_at":"2015-11-19T10:42:20Z","body":"*bin_env* doesn't require a \"global\" pip, it will use the \"local\" pip if it's installed, this is how I do it:\r\n\r\n```salt\r\n# Install the virtualenv\r\n{{ venv }}_venv:\r\n  virtualenv.managed:\r\n    - name: {{ cfg.full_path }}\r\n    - venv_bin: {{ cfg.venv_builder }}\r\n    - system_site_packages: False\r\n    - user: {{ cfg.user }}\r\n    - clear: True\r\n    - require:\r\n      - file: {{ cfg.full_path }}\r\n      - user: {{ cfg.user }}\r\n      - pkg: {{ salt['pillar.get']('postgresql:lookup:pkg_client') }}\r\n      {% if cfg.python_version == 3.4 %}\r\n      - pkg: python34\r\n      {% elif cfg.python_version == 2.7 %}\r\n      - pkg: python27\r\n      - pkg: py27-virtualenv\r\n      {% endif %}\r\n\r\n# Upgrade pip to latest, once the virtualenv is installed\r\n{{ venv }}_upgrade_pip:\r\n  cmd.run:\r\n    - name: {{ cfg.pip }} --no-cache-dir install -U pip\r\n    - user: {{ cfg.user }}\r\n    - group: {{ cfg.user }}\r\n    - reload_modules: True\r\n    - require:\r\n      - virtualenv: {{ venv }}_venv\r\n\r\n# Install requirements in the virtualenv\r\n{{ cfg.name }}_deps:\r\n  pip.installed:\r\n    - bin_env: {{ cfg.venv.full_path }}\r\n    - cwd: {{ cfg.venv.full_path }}\r\n    - requirements: {{ cfg.deps }}\r\n    - user: {{ cfg.venv.user }}\r\n    - use_wheel: False\r\n    - no_use_wheel: True\r\n    - use_vt: False\r\n    - reload_modules: True\r\n#    - cert: /usr/local/share/certs/ca-root-nss.crt\r\n    - env_vars:\r\n        PIP_CACHE_DIR: /tmp\r\n    - watch:\r\n      - cmd: {{ cfg.venv.name }}_upgrade_pip\r\n    - require:\r\n      - pkg: {{ salt['pillar.get']('postgresql:lookup:pkg_client') }}\r\n      - pkg: ca_root_nss\r\n```"}}