How to Use an Alternate PyPI (Package Index)

The Python Package Index (PyPI) works great, but there may be times when, for whatever reason, you need to host packages elsewhere. You can set up your own index, or you can use a hosted service like Gemfury.

This article describes, in general terms, some of the things you’ll need to do in your development environment to make your use of an alternate package index a little smoother.

Installing Modules with pip

One of the tricks to installing packages from your alternate repository is telling pip about it.


While you can use command line parameters with pip to indicate the location of your package index server, you can also modify (or create) a special pip configuration file called pip.ini that will allow you install packages from the command line just as you would if you were installing them from the public repositories.


On Windows, you can place a pip.ini file at %APPDATA%\pip\pip.ini. Use the extra-index-url option to tell pip where your alternate package index lives. If your package index doesn’t support SSL, you can supress warnings by identifying it as a trusted-host. The example below assumes the name of your server is and you’re running on non-standard port 8080.

extra-index-url =

trusted-host =


Coming soon.


If you are using SSL with a verified certificate, you won’t need the trusted-host directive.

Publishing Modules

This article doesn’t go into much detail on the general process of publishing modules, but we’ll assume that you’re using setuptools to publish.


You can automate the process of publishing your package with distutils by modifying the .pypirc file in your home directory. This file typically contains the common public indexes, but you can also add your alternate index. The example below assumes you’re using Gemfury, but the format will be fundamentally similar regardless of where you’re hosting your repository.

index-servers =


username: $ecret-K3y!

With that in place, you can build and upload your package by identifying the configured index server name.

python sdist upload -r fury


Rembemer that the keys and passwords in your .pypirc are secrets, and should be kept away from prying eyes.