Could not find a version that satisfies the requirement pytz Could not find a version that satisfies the requirement pytz python python

Could not find a version that satisfies the requirement pytz


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.


Just a student. I was learning pytz(downloaded, Run, command prompt then tried IntelliJ, Project Structure, SDKS) and it would not import even after deleting, redoing the files. Read the Launchtype bug list. I switched to pendulum. It worked with prior script that used pytz. Just an idea not a direct answer. Original script was Buchalka (teaching Python3 script in a lesson and lesson would not work with IntelliJ) with pytz. Adapted script to pendulum(Intellij,Project Structure, SDKS, +) so I could experience timezone. (no indents with this block of code) Posting since a search of Internet sites did not reveal much help to solve pytz. Pendulum offered an alternative.

import pendulumimport datetimecountry = "Europe/Paris"tz_to_display = pendulum.timezone(country)local_time = datetime.datetime.now(tz=tz_to_display)print("The time in {} is {}".format(country, local_time))print("UTC is {}".format(datetime.datetime.utcnow()))

For those with more knowledge and more complicated script here is the pendulum site. https://pendulum.eustace.io/blog/a-faster-alternative-to-pyz.htmlA library exists for pendulum on the site. It states ( SÉBASTIEN EUSTACE)

This is due to the fact that Pendulum relies heavily on the presence of the fold attribute which was introduced in Python 3.6.

The reason it works inside the Pendulum ecosystem is that it backported the fold attribute in the DateTime class.