Hello,
I am unable to install a pip using a virtualenv. I believe the problem is that the virtualenv is not actually activating (by design?) and it's trying to create a file in /opt, which if the virtualenv is active, it would chroot within itself, rather than try to touch /opt.
If I activate virtualenv as the depuser user, I can pip install newrelic-plugin-agent with no problem and additionally, I can even run the command it tries to run with no problem.
What is the recommended way to install a pip that requires that a virtualenv be activated?
/home/{{ salt['pillar.get']('PYTHON_USER', 'depuser') }}/newrelic_agent:
virtualenv.managed:
- no_site_packages: True
- venv_bin: /opt/python{{ salt['pillar.get']('PYTHON:VERSION', '275')}}/bin/virtualenv
- runas: {{ salt['pillar.get']('PYTHON_USER', 'depuser') }}
- require:
- user: {{ salt['pillar.get']('PYTHON_USER', 'depuser') }}
- cmd: installvirtualenv
newrelic-plugin-agent:
pip.installed:
- user: {{ salt['pillar.get']('PYTHON_USER', 'depuser') }}
- bin_env: /home/{{ salt['pillar.get']('PYTHON_USER', 'depuser') }}/newrelic_agent/bin/pip
- require:
- virtualenv: /home/{{ salt['pillar.get']('PYTHON_USER', 'depuser') }}/newrelic_agent
When this pip tries to install, it fails with:
running install_data
creating /opt/newrelic_plugin_agent
error: could not create '/opt/newrelic_plugin_agent': Permission denied
----------------------------------------
Command /home/depuser/newrelic_agent/bin/python -c "import setuptools;__file__='/home/depuser/newrelic_agent/build/newrelic-plugin-agent/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-yPUGen-record/install-record.txt --single-version-externally-managed --install-headers /home/depuser/newrelic_agent/include/site/python2.7 failed with error code 1 in /home/depuser/newrelic_agent/build/newrelic-plugin-agent
Storing complete log in /home/depuser/.pip/pip.log