Taylor Childers
Taylor Childers

Reputation: 393

Install Test Python Package in Different directory Using Pip

I have a python distutils module that I use in production. I have that production module installed in a virtual environment. However, I'd like to be able to test upgrades before installing in the production environment. I'm also trying to avoid creating a second virtual environment. Therefore I tried the following:

# inside my virtualenv
# checkout master of my repo
git clone git+git://github.com/myrepo
cd myrepo
# create directory where my testing install will live
mkdir testinstall
# prepend my testing install to the PYTHONPATH to over-ride the
# production install of my repo
export PYTHONPATH=$PWD/testinstall/lib/python2.7/site-packages:$PYTHONPATH
# install my local package with pip into the test area
pip install --prefix=$PWD/testinstall .

In this case I get the error from pip:

Requirement already satisfied from /path/to/production/myrepo

If I use

pip install --upgrade --prefix=$PWD/testinstall

pip proceeds to uninstall the production version from /path/to/production/myrepo and install my test version in the testinstall area.

Any idea how to force pip to install in this way?

Upvotes: 0

Views: 288

Answers (2)

user9754923
user9754923

Reputation:

Try doing it this way instead

pip install --target=d:\somewhere\other\than\the\default package_name

Upvotes: 1

Alastair McCormack
Alastair McCormack

Reputation: 27744

I'd just use a new venv but if you really can't, use the -t (target) option.

pip3 install --upgrade -t my_new_directory

Upvotes: 1

Related Questions