Skip to content

Embedding test failed #156

Closed
Closed

Description

@letianzj

Hi, the code doesn't run on my machine, anyone happens to have a clue? really appreciated.

It's PythonEngine.Initialize() failed on Py_Initialize() call, exit code 1 with no further error message. I checked python27.dll is in c:\windows\system32.

The machine is windows 10, python 2.7.11 64bit, visual studio 2015 community. I'm trying to run the embedding test, calling python from C#. VS configuration is switched to DebugWin x64.

Activity

  1. den-run-ai commented on Feb 19, 2016

    @den-run-ai
    Contributor

    When you built pythonnet from VS, did you install it to site-packages? What exception and traceback do you get?

  2. den-run-ai commented on Feb 19, 2016

    @den-run-ai
    Contributor

    here is troubleshooting FAQ page to start with:

    https://github.com/denfromufa/pythonnet/wiki/Troubleshooting-FAQ

  3. letianzj commented on Feb 21, 2016

    @letianzj
    Author

    Hi denfromufa, I followed your FAQ steps. I piped pythonnet and I can see this subfolder under \site-packages, which also contains clr.pyd and python.runtime.dll. Then I tried three winforms in \pythonnet-develop\demo all went through successfully.

    I have to copy Python.Test.dll to pythonnet-develop\src\tests in order to run python pythonnet\src\tests\runtests.py. There are four failures in MethodTest, complaining no method matches given arguments. But I believe other tests went through.

    Now it comes to the part I'm most interested. The console project still doesn't work. It exits on PythonEngine.Initialize() call with no error message. Just jumps out. Do you have suggestions on how to proceed? Thanks.

  4. den-run-ai commented on Feb 21, 2016

    @den-run-ai
    Contributor

    By console app, I assume you mean nPython.exe? try starting it up from command line (cmd or ps) and see if you get exception and traceback with debug build of console app? I do not have windows 10 machine ready to confirm your problem. also might worth running embedding tests, which I updated in FAQ troubleshooting.

    4 failing tests in MethodTest is not normal.

    BTW, you do not have to use nPython for pythonnet. You can import clr from regular cpython interpreter or ipython.

  5. tonyroberts commented on Feb 21, 2016

    @tonyroberts
    Contributor

    Sounds like Python's not able to find where the python packages are
    installed to me. If you enable debug logging it might tell you what's going
    wrong (try setting PYTHONDEBUG and PYTHONVERBOSE environment variables).

    Depending on how python's installed it might not find the python install
    (if it's not installed as the default Python for example). You should try
    setting PYTHONHOME.

    See https://docs.python.org/2/using/cmdline.html (towards the end, at the
    environment variable section) for details. You can also set PYTHONHOME
    programmatically before initializing Python if that is the problem.

    regards,
    Tony
    On Sun, Feb 21, 2016 at 5:05 PM denfromufa notifications@github.com wrote:

    By console app, I assume you mean nPython.exe? try starting it up from
    command line (cmd or ps) and see if you get exception and traceback with
    debug build of console app? I do not have windows 10 machine ready to
    confirm your problem. also might worth running embedding tests, which I
    updated in FAQ troubleshooting.

    4 failing tests in MethodTest is not normal.

    BTW, you do not have to use nPython for pythonnet. You can import clr
    from regular cpython interpreter or ipython.

    —
    Reply to this email directly or view it on GitHub
    #156 (comment)
    .

  6. den-run-ai commented on Apr 13, 2016

    @den-run-ai
    Contributor

    @tonyroberts @letianzj there are 2 issues with python 2.7.11 windows installer from python.org, looks like others are hitting this issue also. I spent few hours debugging this until upgrading to anaconda.

    http://stackoverflow.com/questions/36603052/pythonengine-initialize-fails-without-any-error-message

  7. den-run-ai commented on Sep 7, 2016

    @den-run-ai
    Contributor

    closing this issue, since python 2.7.12 was released with fixes to embedding paths.

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