Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.
SOLVED

Installing packages from corporate PyPi mirror?

TheodoreLindsey
7 - Meteor

Using the python node, normally you would use 

Package.installPackages([...])

The company firewall I work behind blocks pypi but my company hosts a pypi mirror at, for example, https://pypi.mirror.corpintra.net/root/pypi.  In pip, you'd do something like

pip install -i https://pypi.mirror.corpintra.net/root/pypi <package-name> --trusted-host pypi.mirror.corpintra.net

Does Package.installPackages have a similar way to use an alternative pypi source?

4 REPLIES 4
wthompson
Alteryx
Alteryx

The YXI package uses built-in options for installing packages and are not configurable.  You should, however, be able to modify the pypi (package-index) source path by creating a pip.ini configuration file: https://pip.readthedocs.io/en/stable/user_guide/#config-file.  I have been able to do that on my setup to test out certain pip settings, so hopefully you will be able to do something similar.

TheodoreLindsey
7 - Meteor

This only works for running alteryx workflows locally, right?  How would I translate such a solution to workflows I publish to my company's Alteryx Server (for example, ones I plan to schedule)?

wthompson
Alteryx
Alteryx

That is correct, the pip.ini file will only be able to affect your local pip installs.  To affect this on an Alteryx Server, you would have to request that the server admin create a pip.ini configuration in the %APP_DATA%/pip path.

TheodoreLindsey
7 - Meteor

I did some more reading about pip parameters and it seems like an alternative to using pip.ini is to set environment variables.  It looks like if you do

os.environ['PIP_INDEX_URL'] = "https://pypi.mirror.corpintra.net/root/pypi"
os.environ['PIP_TRUSTED_HOST'] = "pypi.mirror.corpintra.net"
os.environ['PIP_USER'] = '1'

you can accomplish the same effect as modifying the pip.ini file.