Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find a version that satisfies the requirement pytz

I have a problem installing pytz in virtualenv.

Downloading/unpacking pytz
Could not find a version that satisfies the requirement pytz (from versions: 2009r, 2008b, 2009f, 2008c, 2007g, 2011g, 2005m, 2011e, 2007f, 2011k, 2007k, 2006j, 2008h, 2008i, 2011e, 2008a, 2009e, 2006g, 2011j, 2010l, 2005m, 2008i, 2005k, 2008g, 2007c, 2007i, 2009l, 2009r, 2006j, 2011k, 2007d, 2006p, 2009i, 2009u, 2007i, 2009f, 2010g, 2008h, 2009a, 2007g, 2011e, 2006p, 2012b, 2010k, 2005r, 2007f, 2009l, 2009p, 2008c, 2009j, 2008g, 2010g, 2010h, 2011h, 2010k, 2007c, 2007d, 2011d, 2009l, 2011c, 2008a, 2005m, 2007k, 2009n, 2011d, 2010o, 2013b, 2012h, 2010e, 2012c, 2012d, 2012f, 2011n, 2011b, 2011j, 2008c, 2012j, 2007k, 2009f, 2009d, 2010e, 2010b, 2013b, 2011d, 2009p, 2008h, 2005r, 2009i, 2009n, 2009a, 2010k, 2008g, 2006g, 2008b, 2012c, 2009i, 2007g, 2012c, 2010h, 2011n, 2012g, 2007d, 2008a, 2009u, 2012g, 2010o, 2006p, 2010b, 2009u, 2012d, 2011k, 2012f, 2009a, 2007f, 2011h, 2010l, 2009j, 2011g, 2009g, 2009g, 2005r, 2011c, 2012g, 2009g, 2012d, 2009j, 2010o, 2007c, 2010g, 2006g, 2009d, 2010h, 2005k, 2006j, 2010b, 2009n, 2011g, 2011c, 2012b, 2009e, 2009d, 2011j, 2007i, 2012j, 2010l, 2009r, 2012h, 2010e, 2009p, 2008i, 2012f, 2009e, 2012b, 2011h, 2005k, 2008b, 2013b, 2011n, 2012j, 2004b)
Cleaning up...
No distributions matching the version for pytz

It seems like it's a problem with the latest version of pip.

Is there any workaround?

like image 338
Houman Avatar asked Aug 14 '13 11:08

Houman


People also ask

How do you fix could not find a version that satisfies the requirement?

To Solve Could not find a version that satisfies the requirement Error You just need to update pip and your error will be resolve.

Is pytz included in Python?

pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher. It also solves the issue of ambiguous times at the end of daylight saving time, which you can read more about in the Python Library Reference (datetime. tzinfo).

How install pytz on Windows?

How to Install pytz on Windows? Type "cmd" in the search bar and hit Enter to open the command line. Type “ pip install pytz ” (without quotes) in the command line and hit Enter again. This installs pytz for your default Python installation.

Is pytz built in?

What is pytz? pytz is a Python module mostly used for resolving the issues related to time zone differences. This module determines the time of any region using the local timezone name taking UTC time as the reference. The datetime is a python built-in library.


1 Answers

This error occurs when installing pytz using pip v1.4 or newer, due to this change in behaviour:

Pre-release Versions

Starting with v1.4, pip will only install stable versions as specified by PEP426 by default. If a version cannot be parsed as a compliant PEP426 version then it is assumed to be a pre-release.

If a Requirement specifier includes a pre-release or development version (e.g. >=0.0.dev0) then pip will allow pre-release and development versions for that requirement. This does not include the != flag.

The pip install command also supports a --pre flag that will enable installing pre-releases and development releases.

The version identifiers for the pytz package have a format like 2013b. PEP426 uses the version identifiers described in PEP440, which specifies that:

Public version identifiers MUST comply with the following scheme:

N[.N]+[{a|b|c|rc}N][.postN][.devN]

Because the pytz versions like 2013b do not match this format, version 1.4+ of pip is treating all versions of pytz as pre-release versions, and is not installing them by default.

If you are only installing pytz, you can use the --pre flag to avoid this behaviour, but you wouldn't want to use this flag for installing your entire project's requirements: some packages might have unstable pre-release versions you don't want. In that case, use the behaviour described above: if you specify a "pre-release" version number for the package, then pip will search for "pre-release" versions of the package. So I've added this to my requirements.txt:

pytz>=2013b

When I upgrade my packages, pip will now correctly search for and install the latest version of pytz.

This has been filed as issue #1204837 in the pytz bug tracker and issue #974 in the pip bug tracker.

Stop Press: As described in the PyTz bug report, the version numbering of pytz has now been changed to, for example, 2013.7 - so once you have upgraded to this, the problem should no longer occur.

like image 160
Jeremy Avatar answered Sep 23 '22 22:09

Jeremy