Home > Uncategorized > setuptools install_requires quirk

setuptools install_requires quirk

November 3, 2008 Leave a comment Go to comments

It’s interesting that having “dev” version packages in the install_requires list will fail.

Say for example, if you do:

from setuptools import setup
setup(
...
install_requires=["Pylons==dev"],
...
)

It won’t work:

Installed d:\python25\lib\site-packages\pylons-0.9.7rc3dev_20081103-py2.5.egg
Reading http://www.pylonshq.com/download/0.9.7
error: Could not find required distribution Pylons==dev

I imagine it would match if the package would literally have the version “dev”.

One solution is to change the install_requires to ["Pylons==dev,!=foo"] or some other bogus version to match whatever is downloaded for the dev version. “>=0.1.2.3” will match for packages that don’t have tagged versions (won’t work for example for Pylons “0.9.7beta3dev-20080422″).

EDIT: Looks like I was wrong. having “!=foo” will work if you already have the package installed but will fail to find the dev package when downloading. Having “>=0.9.7″ in the requirements will not work because “0.9.7beta3dev-20080422″ is considered a lower version (prerelease to the final 0.9.7). A solution would be having a requirement like “>=0.9.7a”. “a” will be lower than “beta3dev-20080422″.

About these ads
  1. November 4, 2008 at 4:01 pm | #1

    You don’t need a fake version; use “==dev,>=0.9.7beta3dev-r2363″ or whatever revision number is needed. Then when you change your required revision, an upgrade will get pulled from the dev version.

  2. ionelmc
    November 4, 2008 at 4:06 pm | #2

    That won’t work with later versions. Pretty pointless to change that each time when the “dev” package has a new version.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 170 other followers