zmeri / PC-SAFT

Functions implementing the PC-SAFT equation of state, including association, electrolyte and dipole terms
GNU General Public License v3.0
46 stars 18 forks source link

Installation/compiling PCSAFT problem #81

Closed vdWaals closed 3 years ago

vdWaals commented 3 years ago

Having unzipped the PCSAFT file in a dedicated directory, the python command from this directory:
python setup.py build_ext __inplace

yields following error trail:

File "setup.py", line 39, in ext_modules=cythonize(ext_modules, language_level="3")) File "C:....\Dependencies.py", line 888, in cythonize ctx = c_option.create_context() File "C:....\Main.py", line 596, in create_context self.cplus, self.language_level, option=self) File "C:...\Main.py", line 94 in init self.set_language(language_level) File "C:...\Main.py", line 100 in set_language_level if level >= 3; TypeError '>=' not supported between instances 'str' and 'int'

How to continue?

I also tried following Jupyter notebook code without success.

from setuptools import setup, Extension, find_packages from Cython.Build import cythonize extensions = [Extension('pcsaft',["pcsaft.pyx"])] setup(ext_modules=cythonize(extensions))

This notebook yields a compile error: arning: pcsaft.pxd:21:30: Function signature does not match previous declaration warning: pcsaft.pxd:23:30: Function signature does not match previous declaration

Error compiling Cython file:

... cppargs = create_struct(pyargs) try: if t_guess is not None: result = flashPQ_cpp(p, q, x, cppargs, t_guess) else: result = flashPQ_cpp(p, q, x, cppargs) ^

pcsaft.pyx:366:32: Call with wrong number of arguments (expected 5, got 4)

Error compiling Cython file:

... cppargs = create_struct(pyargs) try: if p_guess is not None: result = flashTQ_cpp(t, q, x, cppargs, p_guess) else: result = flashTQ_cpp(t, q, x, cppargs) ^

pcsaft.pyx:457:32: Call with wrong number of arguments (expected 5, got 4)

Error compiling Cython file:

... try: if p_guess is not None: result = np.asarray(flashTQ_cpp(t, q, x, cppargs, p_guess)) Pvap = result[0] else: result = np.asarray(flashTQ_cpp(t, q, x, cppargs)) ^

pcsaft.pyx:546:43: Call with wrong number of arguments (expected 5, got 4)

zmeri commented 3 years ago

Firstly, it looks like you possibly used the wrong option when running setup.py. Instead of "__inplace" it should be "--inplace". Did you use underscores instead of dashes?

If you did indeed use dashes, then it's hard for me to tell what the problem is because I can't reproduce it. I've never gotten that error before and I've built the package on both Ubuntu Linux and Windows 10. I just double checked with a fresh clone from GitHub and it built without an error. All the unit tests passed as well. As you may have already noticed, the error raised seems to imply that Cython was expecting language_level as an integer instead of a string. Could it be possible that you are using a different version of Cython that didn't accept strings for that parameter?

vdWaals commented 3 years ago

Thank you for the quick reply. The -- was used. I'll check Cython.