gustavochm / phasepy

Other
82 stars 28 forks source link

Installing with “pip install phasepy” not working #2

Closed penpy closed 4 years ago

penpy commented 4 years ago

I tried installing phasepy using the “pip install phasepy” command on Windows 10. It did not work. Here is the error message:

[...] building ‘phasepy.coloc_cy’ extension error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual Build Tools”: https://visualstudio.microsoft.com/downloads/ ————————————

I tried again after downloading Microsoft Visual Studio (2019) with C++ Build Tools. But the same error message appeared. The Visual Studio individual components I used for this are:

I also tried with the setup.py method. The same error came up.

Questions: 1) Is Microsoft Visual Studio really required to install the phasepy package. (It is not specified in the phasepy documentation). 2) If so, what is the exact C++ component needed. 3) Is there a specific version of Python which is needed for the phasepy package. I’m using Python 3.7.5 and I tried with 3.8.0 (and it did not work).

Thanks for your help

gustavochm commented 4 years ago

Hi penpy!

Phasepy has included several activity coefficient models that rely on nested loops, these are known for been slow in pure python code. In order to avoid this bottleneck those models were coded with Cython.

A C/C++ compiler is necessary for phasepy to be installed, I'm going to update the documentation to make that clear. About your questions.

  1. Any C compiler that work with cython should work. When working with Linux or mac the compiler installation is straightforward but in windows it may be tricky. Here there are two links that can be help you.

https://docs.microsoft.com/en-us/visualstudio/python/installing-python-support-in-visual-studio?view=vs-2019

https://github.com/cython/cython/wiki/CythonExtensionsOnWindows

These will help to install Microsoft Visual Studio and set up the python development tools.

  1. Beside the C/C++ compiler no extra component is needed.

  2. I have use phasepy with python 3.7.5 and I have added compatibility for Python 2.X. I haven't tried with version 3.8.0 but I don't see with it should not work.

Hope this help. Greets

samiit commented 4 years ago

Thank you for some suggestions. But do you have any suggestion on installing it within a conda environment?

gustavochm commented 4 years ago

I can try to upload a wheel of the package so you don't have to deal with the compilation step. As this was my first python project I had to learn how to upload packages to GitHub and by that time I had some ussies building and uploading the wheel and decided just to upload the source files. I will try and then let you know how it goes.

samiit commented 4 years ago

Thanks very much for your great effort.

Best wishes in these difficult times. Just to know though, how is phasepy different from the other package, thermo? And how about coolprop?

samiit commented 4 years ago

By the way, I got to know more about thermo, from your github contributions, and also your request on the main page, to cite thermo :). I guess you mean your own work, phasepy!

As far as I understand, you are implementing the phase equilibria and interfacial property computations, which thermo hasn't implemented yet. I would greatly appreciate if you can help me out to understand if there is more difference. Thanks.

gustavochm commented 4 years ago

I got news! I successfully uploaded a wheel of the package (it worked in a virtual environment for me) so you don't have to compile the source files anymore. Please let me now if you are still facing issues.

About the contributions, its a little embarrassing but thermo was the internal name that the package had before I uploaded it. When I discovered that there was a package with that name I changed it but I took its readme file and modify it but I guess didn't review it that well. lol. Thanks for the notice!

About some differences, I haven't use CoolProp or thermo packages so much, but I have read about them, I think thermo includes several databases for fluid properties including transport properties and also targets vapor liquid phase equilibria with activity coefficient models. CoolProp has a interface to deal with REFPROP which can access several fluid properties info. Phasepy, in the other hand, just include UNIFAC database and their purpose is to study fluid phase equilibria and stability of mixtures, dealing with vapor/liquid, liquid/liquid and vapor/liquid/liquid equilibria. Those results can be used with SGT to study the interfacial behavior of the mixture, allowing to study the surface activity of each compoenent and interfacial tension of the mixture.

samiit commented 4 years ago

Hi, I can't find the wheel of the package, and I tried to install it in a virtual conda environment (python 3.8) and pip install phasepy did not work (neither in Windows, nor in Ubuntu 16). Please help out how it can be installed! Thanks

gustavochm commented 4 years ago

Which version of windows are you using? The wheel target the specific version it was compiled, I am using x64 windows 10. As you can see here: https://pypi.org/project/phasepy/#files

I didnt upload a wheel for ubuntu because I don't have an ubuntu computer. However in Linux system you can get cython with pip3 install cython and the compiler with sudo apt-get install build-essential will get you everything that you need.

samiit commented 4 years ago

Ohhh... I am using Windows 8.1

I managed to install the wheel (after downloading it from the link you shared) in Windows nevertheless, by creating a python 3.7 environment.

In Ubuntu it worked after I installed cython, within a Python 3.8 environment.

Thanks. Will now explore your package!

A suggestion, in case you haven't considered, to have the whole code in Julia, then you don't have this two language problem (loops run super fast).

If you can guide me a bit, I can also try to help out, and learn in the process!

gustavochm commented 4 years ago

I am glad to read you managed to install it! phasepy's use is explained in the documentation (https://phasepy.readthedocs.io/en/latest/) but if you have any further question feel free to ask.

I have read about julia, but never had used. thanks for the suggestion I will study how much effort it is necessary to migrate the whole package.