Eugene Ciurana Official Site

Broken devpi / pip builds with PEP-503 HOWTO fix

Using devpi-server 3.1.x with pip 8.1.2 breaks builds because pip is now a correct implementation of PEP-503.  The presence of dots in the path breaks devpi 3.1.x builds (or earlier versions).  Here is a quick no-nonsense HOWTO to rolling out devpi 4.0.0 to fix the issue.

devpi 4.0.0 is not GA at this time (20160512).  This document will be invalidated when devpi 4.0.0 is released.

For information on how to upgrade from earlier devpi-server versions please refer to Florian Schulze's instructions.

Ensure the latest devpi is installed

export PIP_INDEX_URL="https://devpi.net/fschulze/devpi400"
python --version # 2.7.11
pip install -U "devpi-server<4.0" # Successfully installed devpi-common-2.0.10 devpi-server-3.1.2

Validate environment pre-requisites

pip list | grep devpi
  • devpi-client (2.6.2)
  • devpi-common (2.0.10)
  • devpi-server (3.1.2)
  • devpi-web (3.1.0)

Export the existing devpi state

mkdir -p ~/devpi-state
devpi-server --export ~/devpi-state
devpi-server --stop # killed server pid=1545

Install devpi 4.0.0. and all its dependencies

pip install "devpi-server<5.0.0"
devpi-server --version # 4.0.0
[[ -d "$HOME/.devpi" ]] && mv "$HOME/.devpi" "$HOME/_devpi-3_1_20-backup"
devpi-server --import ~/devpi-state # wait up to 10 minutes; then confirm all is well:  wait_for_events: importing finished; latest_serial = 8

The devpi-server import takes a long time because it checks PyPI and indexes all current packages in-use. Your mileage will vary depending on your network speed.

Clean up

Now that everything is copacetic, start the server and clean everything up:

devpi-server --start # process u'devpi-server' started pid=4285
devpi use "http://localhost:3141/$USER/dev/+simple/" # current devpi index: http://localhost:3141/ciurana/dev (not logged in)
devpi login "$USER" --password "$devpiPassword" # logged in 'ciurana', credentials valid for 10.00 hours
[[ "0" == "$?" ]] && rm -Rf ~/devpi-state/ # cleans the 3.1.2 state backups
[[ "0" == "$?" ]] && rm -Rf "$HOME/_devpi-3_1_20-backup" # cleans up the old devpi database
unset PIP_INDEX_URL

devpiPassword may be set to "" for private builds and Jenkins. Use whatever you set up for your own configuration.

If these steps complete without errors, the system is running OKi.

Test the Build

  1. Enter a virtual environment
  2. Upgrade pip to 8.1.2
  3. Use devpi to install a package known to have PEP-503 issues
    1. repoze.lru is a good one
  4. The package should install and appear in pip's list.
cd your_project
activate # virtual env
pip --version # pip 8.1.2
devpi install repoze.lru # Successfully installed repoze.lru-0.6<

That's it!

Comments

Share your comments, questions, etc. via Twitter and/or Facebook.

Cheers!

Written by Eugene Ciurana on Thursday May 12, 2016
Permalink -

« Dodging Gratuitous Email Spying - ProtonMail - No-nonsense CocoaPods Upgrade HOWTO »