build error on MacOS 11.2 Big Sur
Description
Trying to pip install CoolProp package on macOS Big Sur, but getting error message about MACOSX_DEPLOYMENT_TARGET
Steps to Reproduce
-
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.
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.
Perhaps @jowr has some idea?
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
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?
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.
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']))
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!
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.
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.
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?
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!
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.
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.