Using pip.conf during pack install

(Aaron) #1

Hello,

I am attempting to install my pack on a standard Vagrant instance, but it can’t seem to find the pip packages located in my extra-index-url for pip.

Everything works as expected if I copy /home/vagrant/.pip/pip.conf to /opt/stackstorm/virtualenv/mypack, and manually run pip install with opt/stackstorm/virtualenvs/mypack/bin/pip install -U -r /opt/stackstorm/packs/mypack/requirements.txt. However, installing the pack again will override this manual change to the virtualenv, and result in a failed install due to an unknown package in requirements.txt.

What is the correct way to configure pip prior to the pack install. Do I perhaps need to configure pip for the stanley or st2 users, rather than the default vagrant user, or is there a more idiomatic way to do this?

Cheers and thank you for your time!

(Tomaz Muraus) #2

Under which user does st2actionrunner process run on your Vagrant instance?

If it’s stanley, I would try putting pip pip config in stanley user home directory (/home/stanley/.config/pip/pip.conf - https://pip.pypa.io/en/stable/user_guide/#config-file).

Another option would be to try to run packs.install action directly and utilize environment variable approach - https://pip.pypa.io/en/stable/user_guide/#environment-variables.

So something like:

st2 run packs.install packs=mypack env="EXTRA_INDEX_URL=http://foo.bar"

If that doesn’t work, there might be no other way but for us to add a new config option which allows user to specify additional flags which are passed to the pip binary (similar as we do with the existing actionrunner.virtualenv_ops config option).