Menu

IronPython and Official Python 3

Mohammad
2020-08-01
2020-08-06
  • Mohammad

    Mohammad - 2020-08-01
    1. Does DWSIM support officvial Python 3.8.5 or the older 2.7.18?
    2. In documentation always Ironpython is used. Based on python.org aanouncement Python 2.7 will not be supported beyond 2020 and Ironpython is based on 2.7 (there was efforts for developing IronPython 3 but it seems a dead project!), so does DWSIM will support official Python?
     
  • Daniel Medeiros

    Daniel Medeiros - 2020-08-04

    DWSIM uses two Python interpreters: IronPython and Python.NET.

    IronPython is totally based on .NET so there is no relation with an specific Python version, it is "embedded" in DWSIM and contains the Python Standard Library corresponding to 2.7, though it is always better to use .NET equivalent of the classes and functions, which are directly accessible, for instance the System.IO namespace which deals with files, directories, etc on your system.

    Python.NET links DWSIM with a Python installation on your machine. It actually runs your scripts using that external Python environment. The Python.NET library must be compiled against a specific Python version. Currently the macOS version targets 3.7 and the Windows and Linux versions target 3.6.

    Unless you need to use a specific Python external module like numpy, scipy, tensorflow, matplotlib, etc, which is the main reason why I've added the Python.NET interpreter, you should stick to IronPython because it is much faster and has much better integration with DWSIM.

     
    ❤️
    1
  • Mohammad

    Mohammad - 2020-08-06

    Many thanks Daniel. I understood I can use the modern Python installed on my system and I should only note to the Python.NET version shiped with DWSIM. So, I can use SciPy or Scikit-learn with DWSIM.

    DWSIM is really awesome!

     
  • Daniel Medeiros

    Daniel Medeiros - 2020-08-06

    Yes. When using Python.NET, the Python.NET library will look for python36.dll on your python installation directory. On macOS, it looks for libpython3.7m.dylib and, on Linux, it looks for libpython36.so. Your script then runs using the native python library, but the magic here is that all DWSIM objects go together with the standard python ones so you can use all installed modules on your script and interact with the flowsheet and all its components (compounds, models, PFD, etc).

    IronPython is much more integrated with DWSIM but it doesn't support external modules, and that is its main weakness. On the other side, you can use .NET equivalent libraries to do the same tasks.

     
    ❤️
    1
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.