Skip to content

Error using the latest Python.Runtime 2.2.0 #2

Open

Description

@JimSEOW

// Copy the data to that array [line 189 of PythonConnection.cs]
System.IntPtr ptr = (System.IntPtr)PyInt.AsInt(pydata.__array_interface__["data"][0]).ToInt32();
Marshal.Copy(data, 0, ptr, nbytes) //Error

Activity

  1. JimSEOW commented on Jan 27, 2017

    @JimSEOW
    Author

    Done!

  2. den-run-ai commented on Jan 27, 2017

    @den-run-ai

    @Lodomir would you be interested in contributing this back to pythonnet project, maybe as part of separate repo?

  3. JimSEOW commented on Jan 27, 2017

    @JimSEOW
    Author

    There were two pitfalls which you may avoid by looking at my implementation:

    [1] The conversion of multidimensional numpy arrays to C# arrays and back. Especially, ensure that the numpy arrays are contiguous.
    [2] Redraw a matplotlib plot repeatedly without having memory leaks. This requires careful usage of the OO interface and manual calls to the garbage collector (apparently). Look at the implementation for details.

    As described in the readme. These are 2 challenging issues.
    For [1], the current embed python example for pythonnet using Numpy, there is regression issue. Has that be resolved. Without that, it is not trivial to get the example to work, every time numpy list is interoperate between c# and python.

    /* this block is temporarily disabled due to regression
    dynamic a = np.array(new List<float> { 1, 2, 3 });
    dynamic b = np.array(new List<float> { 6, 5, 4 }, Py.kw("dtype", np.int32));
    Console.WriteLine(a.dtype);
    Console.WriteLine(b.dtype);
    Console.WriteLine(a * b);
    */

    For [2], redraw and update needs to be optimized. A critical example to show that pythonned embed could perform in practical and reliable way.

  4. ncgeib commented on Jan 28, 2017

    @ncgeib
    Owner

    I would be interested in contributing back, however, I do not think that the code is in a state that allows this. As I am currently not using this code (or PythonNet at all) I will not be able to invest much time in it. So, the answer is probably no...

    And, yeah, redraw could be optimized.

  5. JimSEOW commented on Jan 29, 2017

    @JimSEOW
    Author

    @Lodomir pushes the limits of pythonnet in persistent ways using these proof-of-concepts examples for embedding python in c# using pythonnet. I am sure many in community has benefited of this brave effort.
    @denfromufa: A few people I came across have tried and tested pythonnet and "gave up". e.g. pythonnet and tensorflow [e.g. pythonnet not practical].

    Pythonnet github forum is a very hot and active group and you have done an excellent job to response as timely as possible.

    From my side. It would be great to understand your goals. It would be great if you could push the activities towards one that the "motivated" people do not give up BY ADDRESSING The CRITICAL part of pythonnet. e.g as illustrated by the 2 issues raised through these examples.

  6. den-run-ai commented on Jan 29, 2017

    @den-run-ai
  7. JimSEOW commented on Jan 29, 2017

    @JimSEOW
    Author

    @denfromufa thanks for your feedback.
    Q1: Was pythonnet originated from python.NET? Where I can read more about the transition from Python.NET to pythonnet. When u took over? Having the historical background helps to understand the challenges your faced. Does phytonnet combine the adv of both Python.NET, ironclad, and ironpython?
    Q2: Making others know the current limitations help to position the expectations so experienced users new to pythonnet understand what are reasonable and what need to be done.
    Q3: I appreciate your "Horizontal" effort - the general health of the project in all possible OS. It would be good to occasionally that you summarize where are the "vertical" contributions needed from experienced programmers in README, not just fragmented enhanced features distributed all over the ISSUES.
    Q4: You have the helicopter view: If you could have a separated README-Second or an OPEN Vertical Issues to gather the "vertical discussions" e.g. Debugging in VS from python to c# to python or c# to python etc.

    In summary: thanks for your PERSISTENT effort to keep the group's members motivated.

  8. den-run-ai commented on Jan 30, 2017

    @den-run-ai
  9. JimSEOW commented on Jan 30, 2017

    @JimSEOW
    Author

    @denfromufa
    Regression issue:
    ironclad makes numpy accessible to .NET
    Do you think ironclad code may have some tips on how to address the regression issue? Just guessing.

  10. JimSEOW commented on Jan 30, 2017

    @JimSEOW
    Author

    @denfromufa
    For some framework on tutorial, perhaps one could look at R.NET or RdotNET to see how the tutorials are organized for interoperability between Robjects and .NET counterparts. R.NET also has the challenging issue to do Graphic Redraw.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions