← Back to DAGDA | Support | Source: https://github.com/jpype-project/jpype/issues/331
Skip to content

JPype is incompatible with Python 3.7: Fatal Python error: _Py_InitializeCore: main interpreter already initialized #331

Closed

Description

@vstinner

Since Python 3.7, calling Py_Initialize() twice now fails with a fatal error:

Fatal Python error: _Py_InitializeCore: main interpreter already initialized

But PyInit__jpype() calls Py_Initialize() at native/python/jpype_python.cpp:161:

https://github.com/originell/jpype/blob/490eb6511a0a0b57be2191cbbf3a90bac45e5879/native/python/jpype_python.cpp#L150-L157

It doesn't make sense to call Py_Initialize() in the initialization function of a module, since Python must be initialized to able to... import jpype :-)

The fix is just to remove the call.

Activity

  1. vstinner commented on Jun 21, 2018

    @vstinner
    ContributorAuthor

    Note: I found the issue when running the test suite of https://github.com/konlpy/konlpy with Python 3.7.

  2. marscher commented on Jun 21, 2018

    @marscher
    Member
  3. vstinner commented on Jun 21, 2018

    @vstinner
    ContributorAuthor

    Thanks! good catch. Are you willing to remove this line with Githubs online editor and send us a PR? :)

    I'm actually trying to do that.

  4. marscher commented on Jun 21, 2018

    @marscher
    Member
  5. vstinner commented on Jun 21, 2018

    @vstinner
    ContributorAuthor
  6. vstinner commented on Jun 21, 2018

    @vstinner
    ContributorAuthor

    there is the edit button hidden somewhere in the right upper corner :)

    Yep, I found it! I proposed the PR #332 to fix this bug.

  7. added a commit that references this issue on Jun 21, 2018
    d3be80f
  8. rapgro commented on Jun 21, 2018

    @rapgro

    FTC, PEP 432

  9. Thrameos commented on Jun 21, 2018

    @Thrameos
    Contributor

    Yes. That is one of the lines that caused PyPy to fail. Unfortunately, there were additional issues so I never go around to patching it and didn't look at the PEP to see if it belonged. Thanks for catching it.

  10. mludvig commented on Nov 5, 2018

    @mludvig

    Hi are you going to release the fixes package anytime soon? I ran into this problem today and would very much prefer to use an official release from PyPy rather than a patched one. Thanks! :)

  11. vstinner commented on Nov 5, 2018

    @vstinner
    ContributorAuthor

    My PR #332 has been merged, and in the meanwhile, Python 3.7.1 has been released. Since Python 3.7.1, calling Py_Initialize() twice is accepted again ;-)

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions