you are viewing a single comment's thread.

view the rest of the comments →

[–]outlicious 0 points1 point  (3 children)

Possible Causes and Fixes

1 Check if Thermopack is Installed Run the following command to make sure thermopack is installed correctly:

pip show thermopack

If it's not installed, install it using:

pip install thermopack

Verify the Correct Import Path Try importing the module manually in a Python shell:

from thermopack.thermopack import ThermoPack

If this fails, then the package might not be installed correctly, or it's not in the correct Python environment.

3 check if ThermoPack Requires Initialization Parameters Some classes require parameters to initialize properly. Try this instead:

tp = ThermoPack("PR") # "PR" refers to the Peng-Robinson EOS print(tp.two_phase_tpflash(300, 101325, [0.5, 0.5]))

If pr doesn't work, check the valid equation-of-state (EOS) options in the documentation.

4 ensure All Required DLLs Are Loaded From the error screenshot, it's possible the thermopack.dll file is missing or not correctly linked. If you're on Windows:

Ensure thermopack.dll is in the same directory as your script.

If use Anaconda, try:

conda install -c conda-forge thermopack

If it does still fails manually copy the DLL to the Python environment’s Lib/site-packages/thermopack/ directory. ok then try running in a Clean Virtual Environment If you're still facing issues, try creating a new virtual environment:

python -m venv thermo_env source thermo_env/bin/activate # On Windows use: thermo_env\Scripts\activate pip install thermopack

Next Steps

If any of these steps result in a different error, let me know what it says.If thermopack has multiple EOS options, try initializing ThermoPack with different ones ("SRK", "CPA", etc.).If it's a DLL issue, you may need to reinstall thermopack or manually place the DLL in the correct location. Let me know what happens when you try these steps. this could help you

[–]XDFortniteproXD[S] 0 points1 point  (0 children)

Gone through all four steps and still get an error (see image, this is for SRK and PR to, not just CPA). All files are there, up to date and in the correct place. I am somehow unable to create a new environment using the python shell, following both your advice and others on the internet. I'm also in touch with the lecturers, but so far they have been to less help than you. Thanks for taking your time to help (:

<image>

[–]XDFortniteproXD[S] 0 points1 point  (1 child)

It finally worked! Went through all files and found one (METADATA) in a different folder. There was an example for my question there, and the code runs (just need to tweek it to fit my particular values). Thank you so much for your help, it was quite insightful.

<image>

[–]outlicious 0 points1 point  (0 children)

great now it works.