CoolProp icon indicating copy to clipboard operation
CoolProp copied to clipboard

build error on MacOS 11.2 Big Sur

Open teresabtb opened this issue 5 years ago • 13 comments

Description

Trying to pip install CoolProp package on macOS Big Sur, but getting error message about MACOSX_DEPLOYMENT_TARGET

Steps to Reproduce

  1. python -m pip install CoolProp

Expected behavior: install CoolProp package

Actual behavior:

Collecting CoolProp
  Using cached CoolProp-6.4.1.tar.gz (12.9 MB)
Building wheels for collected packages: CoolProp
  Building wheel for CoolProp (setup.py) ... error
  ERROR: Command errored out with exit status 1:
...
error: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.9" but "11.2" during configure

Versions

CoolProp Version: [6.4.1]
Operating System and Version: [MacOS Big Sur 11.2.1 with Apple Silicon (arm64)]
Access Method: [Python 3.9.1]

Additional Information

If possible, please post examples and/or screenshots of the issue.

teresabtb avatar Feb 18 '21 05:02 teresabtb

Not having access to 11.x, can you please provide a complete build log? Even better, can you build from the git source? Supporting OSX and their changing deployment targets has been notoriously challenging.

ibell avatar Feb 19 '21 04:02 ibell

Perhaps @jowr has some idea?

ibell avatar Feb 19 '21 04:02 ibell

Not having access to 11.x, can you please provide a complete build log? Even better, can you build from the git source?

I just build from source and posted the log at https://gist.github.com/teresabtb/48b2b7cb5147ef84dddadb457d79dfde

teresabtb avatar Feb 19 '21 05:02 teresabtb

Hum. It isn't Coolprop that resets the deployment target to 10.9. Can you build a normal shared library as well, or does that not work either?

Do you have the most updated XCode?

ibell avatar Feb 19 '21 13:02 ibell

I'm sorry I spoke too soon. We have some magic in the CMakeLists.txt: https://github.com/CoolProp/CoolProp/blob/master/CMakeLists.txt#L93 . Can you comment out the line mentioning 10.9 and try again? I think we will have to revisit this approach in general.

ibell avatar Feb 19 '21 13:02 ibell

That worked. Thanks. Here is a diff showing the lines I commented out in CMakeLists.txt and setup.py:

CoolProp % git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0b59bcb0..a07f0c17 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,9 +100,9 @@ option (COOLPROP_NO_EXAMPLES
 # https://gitlab.kitware.com/cmake/cmake/issues/18396
 if (DEFINED DARWIN_USE_LIBCPP)
   if(DARWIN_USE_LIBCPP)
-    set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
+    #set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
     set(OSX_COMPILE_FLAGS "${OSX_COMPILE_FLAGS} -stdlib=libc++")
-    set(OSX_COMPILE_FLAGS "${OSX_COMPILE_FLAGS} -mmacosx-version-min=10.9")
+    #set(OSX_COMPILE_FLAGS "${OSX_COMPILE_FLAGS} -mmacosx-version-min=10.9")
     set(OSX_LINK_FLAGS "${OSX_LINK_FLAGS} -lc++")
     set(OSX_LINK_FLAGS "${OSX_LINK_FLAGS} -nodefaultlibs")
     set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
diff --git a/wrappers/Python/setup.py b/wrappers/Python/setup.py
index 85df5110..c8898323 100644
--- a/wrappers/Python/setup.py
+++ b/wrappers/Python/setup.py
@@ -81,13 +81,13 @@ if __name__ == '__main__':
             print("OSX build detected, targetting {0} using clang/gcc v{1}.".format(osx_target, osx_compiler))
 
         # allow to override things manually
-        if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
-            if osx_version >= "10.14":
-                os.environ['MACOSX_DEPLOYMENT_TARGET'] = "10.9"
-                print("Assuming that we cannot build for {0} on {1}, resetting target to {2}".format(osx_target, osx_version, os.environ['MACOSX_DEPLOYMENT_TARGET']))
-            if osx_compiler >= "10":
-                os.environ['MACOSX_DEPLOYMENT_TARGET'] = "10.9"
-                print("Assuming that we cannot build for {0} using clang/gcc {1}, resetting target to {2}".format(osx_target, osx_compiler, os.environ['MACOSX_DEPLOYMENT_TARGET']))
+        #if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
+            #if osx_version >= "10.14":
+                #os.environ['MACOSX_DEPLOYMENT_TARGET'] = "10.9"
+                #print("Assuming that we cannot build for {0} on {1}, resetting target to {2}".format(osx_target, osx_version, os.environ['MACOSX_DEPLOYMENT_TARGET']))
+            #if osx_compiler >= "10":
+            #    os.environ['MACOSX_DEPLOYMENT_TARGET'] = "10.9"
+            #    print("Assuming that we cannot build for {0} using clang/gcc {1}, resetting target to {2}".format(osx_target, osx_compiler, os.environ['MACOSX_DEPLOYMENT_TARGET']))

teresabtb avatar Feb 20 '21 07:02 teresabtb

As you can see, this is all a bit of a mess, and we have figured this all out by experimentation. Thank you for doing that experimentation for us!

ibell avatar Feb 20 '21 14:02 ibell

One final question (I hope), can you please confirm that you couldn't use the binary wheels that we have previously built? I think that is the (unfortunate) case.

ibell avatar Feb 23 '21 00:02 ibell

The wheels we see (at https://pypi.org/project/CoolProp/#files) are for intel x86_64 processor, but I am using Apple Silicon ARM in its native form, so the wheels aren't recognized.

teresabtb avatar Mar 07 '21 06:03 teresabtb

The wheels we see (at https://pypi.org/project/CoolProp/#files) are for intel x86_64 processor, but I am using Apple Silicon ARM in its native form, so the wheels aren't recognized.

Hi, I just meet the same question as you. Have you solved the problem?

sjtupchu avatar Jul 30 '21 07:07 sjtupchu

The wheels we see (at https://pypi.org/project/CoolProp/#files) are for intel x86_64 processor, but I am using Apple Silicon ARM in its native form, so the wheels aren't recognized.

Hi, I just meet the same question as you. Have you solved the problem?

Succeed with manual installation. Thanks!

sjtupchu avatar Jul 30 '21 16:07 sjtupchu

I'm seeing a similar problem attempting to install via poetry in a virtual environment. Would be great to see a fix in a PyPI release so I can install in a poetry environment via pyproject.toml.

nealkruis avatar Jul 26 '22 21:07 nealkruis

I back-ported binary wheels for 6.4.1 for all platforms a while back. Can you please put together a PR that adds what you need and we can consider whether it makes sense? There are way too many environment managers to actively support them all.

ibell avatar Jul 26 '22 22:07 ibell