Skip to content

[Windows WSL] Fatal Python error: _Py_InitializeMainInterpreter: can't initialize time, after year 2038 #78146

Closed

Description

@vstinner
BPO 33965
Nosy @pfmoore, @vstinner, @tjguk, @zware, @zooba, @leewz, @PetterS

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2018-07-12.11:01:09.051>
created_at = <Date 2018-06-26.08:05:40.767>
labels = ['interpreter-core', 'invalid', '3.8', 'OS-windows']
title = "[Windows WSL] Fatal Python error: _Py_InitializeMainInterpreter: can't initialize time, after year 2038"
updated_at = <Date 2019-07-04.15:29:51.453>
user = 'https://github.com/vstinner'

bugs.python.org fields:

activity = <Date 2019-07-04.15:29:51.453>
actor = 'leewz'
assignee = 'none'
closed = True
closed_date = <Date 2018-07-12.11:01:09.051>
closer = 'vstinner'
components = ['Interpreter Core', 'Windows']
creation = <Date 2018-06-26.08:05:40.767>
creator = 'vstinner'
dependencies = []
files = []
hgrepos = []
issue_num = 33965
keywords = []
message_count = 9.0
messages = ['320475', '320477', '320491', '321536', '321539', '321542', '324373', '324377', '347283']
nosy_count = 7.0
nosy_names = ['paul.moore', 'vstinner', 'tim.golden', 'zach.ware', 'steve.dower', 'leewz', 'Petter S']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue33965'
versions = ['Python 3.8']

Activity

  1. vstinner commented on Jun 26, 2018

    @vstinner
    MemberAuthor

    Petter S commented the closed bpo-25155, so I open a new issue. Copy of messages starting at https://bugs.python.org/issue25155#msg320431:

    msg320431 - (view) Author: Petter S (Petter S) * Date: 2018-06-25 17:52

    I get this error when starting the interpreter in Windows subsystem for Linux (WSL).

    I am using Python 2.7.15rc1

    $ python --version
    Python 2.7.15rc1
    $ python
    Fatal Python error: _Py_InitializeMainInterpreter: can't initialize time                                                                                                                                          OverflowError: timestamp too large to convert to C _PyTime_t                                                                                                                                                                                                                                                                                                                                                                        Current thread 0x00007fe547231080 (most recent call first):                                                                                                                                                       Aborted (core dumped)

    msg320432 - (view) Author: Petter S (Petter S) * Date: 2018-06-25 17:55

    For Python 3:

    $ python3 --version
    Python 3.7.0b3
    $ python3
    Fatal Python error: _Py_InitializeMainInterpreter: can't initialize time
    OverflowError: timestamp too large to convert to C _PyTime_t

    Current thread 0x00007f0232c21080 (most recent call first):
    Aborted (core dumped)

    msg320441 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-25 21:06

    I get this error when starting the interpreter in Windows subsystem for Linux (WSL).

    This bug is currently closed, please open a new bug.

    About your issue. I'm not sure if Windows subsystem for Linux is officially supported. How did you install Python 2.7 and 3.7? Are you testing 32-bit or 64-bit Python? (Again, please answer in your new issue.)

    msg320447 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-25 22:05

    I tried 64-bit builds of Python 2.7 and 3.7rc1 (binaries from python.org) on Windows 10 on year 2045: start with no error, time.time() and datetime.datetime.now() don't fail.

    I tried Python 2.7.12 and 3.5.2 on Ubuntu 16.04 in WSL on my Windows 10: same, start with no error, time.time() and datetime.datetime.now() don't fail. It's 64-bit Ubuntu with 64-bit binaries for Python 2 and Python 3 (check sys.maxsize).

    I even compiled Python 2.7.15 and 3.7rc1 on Ubuntu 16.04 in WSL on my Windows 10: same again, start with no error, time.time() and datetime.datetime.now() don't fail. Python 2 and 3 have been compiled in 64-bit mode, since it's a 64-bit Ubuntu.

    Everything is fine. I failed to reproduce your bug.

    msg320473 - (view) Author: Petter S (Petter S) * Date: 2018-06-26 07:26

    I also compiled Python myself on WSL.

    The bug seemed to appear after computer had been running for a while. Before that, the interpreters were working normally. And after rebooting the problem disappeared.

  2. added
    3.8 (EOL)
    interpreter-core
    on Jun 26, 2018
  3. vstinner commented on Jun 26, 2018

    @vstinner
    MemberAuthor

    Petter S:

    • What is your Windows version?
    • Which operating system are you running on WSL? Name and version?
    • In WSL: can you copy/paste the output of "uname -a"? What is your compiler version? Are you compiling in 32-bit or 64-bit mode?

    Maybe the exception came from:

    static int
    pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
    {
    #if defined(MS_WINDOWS)
        ...
        if (_PyTime_check_mul_overflow(t, MS_TO_NS)) {
            if (raise) {
                _PyTime_overflow();
                return -1;
            }
            /* Hello, time traveler! */
            Py_UNREACHABLE();
        }
        ...
    }
  4. zooba commented on Jun 26, 2018

    @zooba
    Member

    Also please include your sys.version. It is possible to launch Windows applications from WSL, which means we need to know if you ran the Linux version or the Windows version (though it sounds like it was a Linux version which means MS_WINDOWS is not defined).

  5. vstinner commented on Jul 12, 2018

    @vstinner
    MemberAuthor

    Petter S: If you don't provide further information, I will close the issue in one week.

    I tried all possible ways to compile Python on Windows and I failed to reproduce the bug. I'm not saying that there is no bug, just that the bug cannot fixed it if I fail to reproduce it.

  6. PetterS commented on Jul 12, 2018

    PetterSmannequin
    Mannequin

    Makes sense. I fail to reproduce it myself. :-(

  7. vstinner commented on Jul 12, 2018

    @vstinner
    MemberAuthor

    Ok, no problem, I close the issue.

  8. PetterS commented on Aug 30, 2018

    PetterSmannequin
    Mannequin

    I am updating this bug since someone may find it.

    The problem lies with WSL. After having my computer running for many days, this is the result of the uptime command:

    $ uptime
     11:23:19 up -24855 days, -3:-14,  0 users,  load average: 0.52, 0.58, 0.59

    Restarting the computer fixes this and the Python issue discussed in this thread.

  9. vstinner commented on Aug 30, 2018

    @vstinner
    MemberAuthor

    11:23:19 up -24855 days, -3:-14, 0 users, load average: 0.52, 0.58, 0.59

    Impressive uptime!

  10. leewz commented on Jul 4, 2019

    leewzmannequin
    Mannequin

    Petter S reported the issue to Microsoft, and got the response that it was already fixed in Insider Preview.
    microsoft/WSL#3514

    Should be fixed in Windows 10 version 1809, according to the tags here:
    microsoft/WSL#3252

  11. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.8 (EOL)OS-windowsinterpreter-core

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions