Reputation: 17238
pip install some_package -i my_index
all the timeIn that case, which file should I modify and how?
Upvotes: 15
Views: 22920
Reputation: 1133
The other answers are not entirely clear and complete. Add a section (if absent) to $VIRTUAL_ENV/pip.conf
(%VIRTUAL_ENV%\pip.ini
on Windows) containing these lines
[global]
index-url = https://download.zope.org/ppix
where you replace https://download.zope.org/ppix
with the actual URL of your PyPi index.
Documentation: https://pip.pypa.io/en/latest/topics/configuration/#naming
Upvotes: 0
Reputation: 829
I run into the same problem, and found that pip support this in current version de facto https://pip.pypa.io/en/latest/user_guide.html#config-file
Inside a virtualenv:
On Unix and Mac OS X the file is $VIRTUAL_ENV/pip.conf
On Windows the file is: %VIRTUAL_ENV%\pip.ini
Upvotes: 13
Reputation: 2274
I never tried using my own index, but after some research this article should cover what you want to do.
Basically you need to add the following to your ~/.pip/pip.conf
(on Windows systems, located at %HOME%\pip\pip.ini
):
[global]
index-url = http://my.pypi.index/comes/here
The problem is that you will have a global definition for all your projects and what you want is a definition for all your users in the specific project. From pip documentation you can alter the config file lookup by using the environment var PIP_CONFIG_FILE
You could edit the virtual-env-folder/bin/activate
script to include this environment var, but the problem is that creating a new virtual environment would lose this change and would not be possible to automate. What you can do is creating the .pip/pip.conf
file in the root of your project and creating a simple activate-virtual-env
script also on the root of the project with the following:
pushd $(dirname $0)
export PIP_CONFIG_FILE="$(pwd)/.pip/pip.conf"
source "$(pwd)/virtual-env-folder/bin/activate"
popd
and instruct your users to source this file instead of virtual-env-folder/bin/activate
Upvotes: 10