Hi Daniel,
I updated to 6.5.2 ! Sadly the error persist! DWSIM complain it cannot find python3.8! If I set the path in Environmental variable, then on clicking run script, DWSIM closes and session terminated!
I will do more investigation! like using a virtual windows 10 machine with no python! Install a clean 3.8 and DWSIM 6.5.2 to see what will happen! I will inform you the result!
Thank you for all your efforts!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Daniel!
I am installing a virtual machine and I return to you
Regarding the above question:
I tested on Windows 10 with a portable Python!
The Python was tested separately and it works!
The Python Bridge setting set to D:\Python\Python38-DWSIM a Python distribution I have installed to be used with DWSIM! In the above folder I see python38.dll
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello again Daniel
I installed a clean Windows 10 through VirtualBox
I then install Python 3.8.6
Check Python it works!
Python is in path now!
I then installed DWSIM 6.5.2
I created a sample simulation: Water + Raoult's law
I then added a stram!
Opened the Sript Manager with below text
print("Hello World...")
Set the python Interpreter to Python.Net in Script manager
Opened the Genarl setting and set the Python Bridge path to where python38.dll and python.exe are there (my Python installation root folder)
Click on the Run Script in Script Manager
DWSIM closes itself!!
If I use a user model (custom unit operation) the situation is different and I get the same error of dll not found but DWSIM stays open! The error is displayed inside information window as below
Hi Daniel
I have run the dependency walker and attached the results!
I used python39 as Python Bridge
I updated the Python.Runtime.dll in the DWSIM root folder
Python 3.9 executable path is my System Variable (Path)
Issues:
1. Using the Script Manager for print("Hello Word") DWSIM crashes and closes itself
2. Using User Model (Python Script) DWSIM stays open, but I get another error
I gave another try!
I use a Python 3.8 with numpy and scipy and and and used a User Model. DWSIM keeps open but I see error in Information window which I attached!
So Script Manager and User Model Script raise different type of errors!
I am not one hundred percent sure, but it seems there is something special here! Amir (who start the thread) told me he has installed winpython 3.8 and amazingly he was able to use Python through Python bridge and was able to reproduce your results in ANN-Exchanger article!
I will install winpython to see if there is such dependency between DWSIM and winpython! and if it will work on my system or not!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Daniel,
I installed winpython 3.8 as yours! DWSIM works without complains!
So, the issue is DWSIM has some connection with winpython!
DWSIM does NOT work not with Python from python.org and NOT with Anaconda!
Should I submit a ticked in GitHub?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Both worked OK with DWSIM. I"m installing python distros in the root of my hard drive (C:). So, in my computer, both distros in the above + winpython work without issues.
One possible reason would be your computer missing the VC++ redistributables (https://www.microsoft.com/en-US/download/details.aspx?id=48145), but all distros already include it. It is worth installing just for safety, though.
Last edit: Daniel Medeiros 2021-05-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So:
1. First many thanks for all your time and help Daniel
2. Those path are automatically added by Python official when I install python
3. I assume when we set Python Bridge in DWSIM, it just uses that environment or at least this path takes the precedence, but it seems it is not true!
Is it a way to tag this thread as SOLVED!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't know how python handles the PATH environment variable, but what I can do (and what I actually do) is to add more variables to PATH according to your setting in DWSIM. I append more lines to the existing list, but only for the currently running DWSIM process in memory.
It is not safe to remove lines or modify the existing PATH value permanently in any way...
Now you know that you can't have multiple python lines for different python versions in PATH - and this is not a DWSIM or Python.NET issue... this is a problem for any software which uses PATH for something - which is something that DWSIM doesn't do... the issue here is 100% in Python.NET communication with Python.
Last edit: Daniel Medeiros 2021-05-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Daniel,
I updated to 6.5.2 ! Sadly the error persist! DWSIM complain it cannot find python3.8! If I set the path in Environmental variable, then on clicking run script, DWSIM closes and session terminated!
I will do more investigation! like using a virtual windows 10 machine with no python! Install a clean 3.8 and DWSIM 6.5.2 to see what will happen! I will inform you the result!
Thank you for all your efforts!
it is working here in my virtual machine without the path variable set... what are the contents of the path that you're trying to set?
If I run the biodiesel cantera sample, python complains about the missing cantera package, but does not crash.
Hi Daniel!
I am installing a virtual machine and I return to you
Regarding the above question:
I tested on Windows 10 with a portable Python!
The Python was tested separately and it works!
The Python Bridge setting set to D:\Python\Python38-DWSIM a Python distribution I have installed to be used with DWSIM! In the above folder I see python38.dll
Hello again Daniel
I installed a clean Windows 10 through VirtualBox
I then install Python 3.8.6
Check Python it works!
Python is in path now!
I then installed DWSIM 6.5.2
I created a sample simulation: Water + Raoult's law
I then added a stram!
Opened the Sript Manager with below text
print("Hello World...")
Set the python Interpreter to Python.Net in Script manager
Opened the Genarl setting and set the Python Bridge path to where python38.dll and python.exe are there (my Python installation root folder)
Click on the Run Script in Script Manager
DWSIM closes itself!!
If I use a user model (custom unit operation) the situation is different and I get the same error of dll not found but DWSIM stays open! The error is displayed inside information window as below
Python 3.8.6 64-bit + DWSIM 64-bit?
yes, both are 64 bit
I am wondering if there are other users in the forum can check this and send their feedback
can you run dependency walker on your python38.dll to see if there is something else who is missing? https://www.dependencywalker.com
Hi Daniel
I have run the dependency walker and attached the results!
Issues:
1. Using the Script Manager for print("Hello Word") DWSIM crashes and closes itself
2. Using User Model (Python Script) DWSIM stays open, but I get another error
Hi Daniel
Sure! I will and return to you!
Do you use Standard Python distribution?
Or use some special like Anaconda or Winpython?
I gave another try!
I use a Python 3.8 with numpy and scipy and and and used a User Model. DWSIM keeps open but I see error in Information window which I attached!
So Script Manager and User Model Script raise different type of errors!
I use winpython 3.8
I use standard python from pyhton.org!
I am not one hundred percent sure, but it seems there is something special here! Amir (who start the thread) told me he has installed winpython 3.8 and amazingly he was able to use Python through Python bridge and was able to reproduce your results in ANN-Exchanger article!
I will install winpython to see if there is such dependency between DWSIM and winpython! and if it will work on my system or not!
there is no special dependency with winpython. what are the contents of your python folder?
Daniel,
I installed winpython 3.8 as yours! DWSIM works without complains!
So, the issue is DWSIM has some connection with winpython!
DWSIM does NOT work not with Python from python.org and NOT with Anaconda!
Should I submit a ticked in GitHub?
no, i will investigate.
Thank you! I just can say using WInpython, DWSIM stays open! and I can invoke libraries like numpy and scipy? Why I cannot using official python!
Sorry for making troubles and thank you for all your efforts.
I've installed both the normal package and the embeddable one:
https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe
https://www.python.org/ftp/python/3.8.10/python-3.8.10-embed-amd64.zip
Both worked OK with DWSIM. I"m installing python distros in the root of my hard drive (C:). So, in my computer, both distros in the above + winpython work without issues.
One possible reason would be your computer missing the VC++ redistributables (https://www.microsoft.com/en-US/download/details.aspx?id=48145), but all distros already include it. It is worth installing just for safety, though.
Last edit: Daniel Medeiros 2021-05-29
Hi Daniel,
Sure I go through your advice! while as you said the official distribution install the VC++ dlls and redistributables.
I will go back to you
Daniel!
I have reinstalled VC++ redistributable! some form other software were installed on my machine!
Still I am wondering why DWSIM Python.NET bridge does not work on my system!
Last edit: Mohammad 2021-05-30
One reason I can think of is that you may have something in your PATH environment variable that redirects python.net to somewhere else...
I will check! I have only Python 9 in the path!
I assume when we set Python Bridge path we ask DWSIM to use that environment!
Daniel,
I removed Python 9 from my path as below
[removed] D:\Python\Python39\Scripts\
[removed] D:\Python\Python39
and DWSIM works even with official version!
So:
1. First many thanks for all your time and help Daniel
2. Those path are automatically added by Python official when I install python
3. I assume when we set Python Bridge in DWSIM, it just uses that environment or at least this path takes the precedence, but it seems it is not true!
Is it a way to tag this thread as SOLVED!
I don't know how python handles the PATH environment variable, but what I can do (and what I actually do) is to add more variables to PATH according to your setting in DWSIM. I append more lines to the existing list, but only for the currently running DWSIM process in memory.
It is not safe to remove lines or modify the existing PATH value permanently in any way...
Now you know that you can't have multiple python lines for different python versions in PATH - and this is not a DWSIM or Python.NET issue... this is a problem for any software which uses PATH for something - which is something that DWSIM doesn't do... the issue here is 100% in Python.NET communication with Python.
Last edit: Daniel Medeiros 2021-05-30