Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8705649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:25:00+00:00 2026-06-13T03:25:00+00:00

The problem I wanted to include requirement for pytz in setup.py script in my

  • 0

The problem

I wanted to include requirement for pytz in setup.py script in my library, but wanted also to set the minimal version required. But the version numbers used by pytz module (eg. “2012f“) seem to be incompatible with what distutils wants to be provided (eg. “1.1.3“).

Is there any way to include requirement for specific version of pytz (eg. >=2012f) without altering pytz or distutils?

Details

To do that I did something like that in setup.py file:

setup(
    # ... basic data here ...
    requires=[
        'pytz (>=2012f)',
    ],
    # ... some other data here ...
)

But when I was doing sudo python setup.py install, the following error appeared:

Traceback (most recent call last):
  File "setup.py", line 25, in <module>
    long_description=long_description,
  File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python2.7/distutils/dist.py", line 259, in __init__
    getattr(self.metadata, "set_" + key)(val)
  File "/usr/lib/python2.7/distutils/dist.py", line 1220, in set_requires
    distutils.versionpredicate.VersionPredicate(v)
  File "/usr/lib/python2.7/distutils/versionpredicate.py", line 115, in __init__
    self.pred = [splitUp(aPred) for aPred in str.split(",")]
  File "/usr/lib/python2.7/distutils/versionpredicate.py", line 25, in splitUp
    return (comp, distutils.version.StrictVersion(verStr))
  File "/usr/lib/python2.7/distutils/version.py", line 40, in __init__
    self.parse(vstring)
  File "/usr/lib/python2.7/distutils/version.py", line 107, in parse
    raise ValueError, "invalid version number '%s'" % vstring
ValueError: invalid version number '2012f'

Seemingly the issue is caused by distutils trying to match this regular expression:

version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
                        re.VERBOSE)

and when it does not match, the above error is raised.

I have seen people altering the source code of pytz (to change the version into something more like 2012.6), but it looks like extremely bad idea to me. I hope there is another way that I missed.

Changing pytz (>=2012f) into pytz works, but it then does not limit the requirement to specific version of pytz module.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:25:01+00:00Added an answer on June 13, 2026 at 3:25 am

    Using install_requires setuptools option:

    setup(
        # ... basic data here ...
        install_requires='pytz>=2012f', # distutils ignores it with a warning, pip uses it
        # ... some other data here ...
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to say that I solved the problem but I wanted post this
I wanted to know the execution time of a program, but I also wanted
Came across a problem whereby I wanted the last time data was imported to
I wanted to show problem with this video. Please watch... I've 2 pages. Second
I wanted to make a JOptionPane.showOptionDialog with some JTextArea and JLabel . The problem
I have this little problem. My client wanted two distinct swf on a web
This wiki post outlines both a problem and a solution. I wanted to post
hm, i have an strange problem... i just wanted to test an app on
While developing an application, I had the following problem. I wanted to return an
I have a problem of listing duplicated rows that include NULL columns. Lemme show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.