Rhino Crashes When Initializing Python.NET with CPython (Conda)

Problem Description

I am trying to integrate Python.NET (pythonnet 3.0.4) with CPython 3.7.12 inside Rhino 7, which defaults to IronPython 2.7.12.
The goal is to replace IronPython with CPython, allowing the use of libraries like numpy and scipy in Grasshopper and RhinoPython.

Issue:

  • Rhino only detects IronPython 2.7.12 instead of CPython.
  • sys.executable is None, meaning Rhino cannot find CPython.
  • Calling Python.Runtime.PythonEngine.Initialize() crashes Rhino instantly.
  • All environment variables seem correctly set (PYTHONNET_PYDLL, PYTHONHOME, PYTHONPATH, PATH).

I have attached a .gh file for reference.
gh_pythonnet.gh (2.1 KB)

Can someoe help me with this? Using Rhino8 or Plugins like Hops is not an option. According to Getting Numpy inside Rhino it somehow is working but for now I cannot get it working.

Thanks in advance!
Raphael

This is basically carrying out third party alterations, or even modding/hacking an unsupported version of Rhino 7.

Can’t you just call out to an external Python run time that has the conda stuff etc. ?

There used to be an old plug-in - is this no use? https://www.food4rhino.com/en/app/ghcpython

Sorry for the lack of help, but even if it did work, using Python.Net together with Conda, in Rhino 7 strikes me as an enormous undertaking. A nightmare even. But one that is like to be unnecessary, given Rhino 8 has already integrated Python.Net and CPython.

One answer use Rhino8. What was before was really painful for many people…