Closed smmaurer closed 4 years ago
Same issue here. My local solution was:
llvm
(brew install llvm
)pip
setting env values with env CXX=/usr/local/opt/llvm@9/bin/clang++ CC=/usr/local/opt/llvm@9/bin/clang
I think enforcing CC
on setup.py
can be limiting to those who want to specify its own clang binaries. openmp
is not supported on default MacOS clang
.
@martjanz Thanks, this is a good point. On my machine it looks like the CC
environment variable is empty by default, so we could use the following flow:
which clang
== /usr/bin/clang
which clang
!= /usr/bin/clang
, and CC
is empty
clang
from condaCC
to that one (which is what L73 is doing currently)otherwise
CC
as whatever they've set it toThis would give people the flexibility to use whatever compiler they want, if they set the environment variable before running setup.py
. But it would keep things simple if they're using the conda toolchain. What do you think?
Also, do you know if setting CXX
is actually necessary? I didn't seem to need it with conda's clang.
More to-dos:
CC
setup.py
explaining which compiler and flags are being used, which should help with diagnosing installation problemsHello,
Thank you, I've suceeded to install with your helpful information (I followed @martjanz 's method). In my case I also needed to modify following line as follows:
https://github.com/UDST/pandana/blob/master/setup.py#L65
# os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.14'
Adding to this thread..
I needed to install an older version of Pandana on my Mac that's running Catalina, and had a lot of trouble. The pip binaries for Pandana 0.3 won't install, and the build scripts don't work either.
We should probably look into this a little more, and put out a maintenance update for Pandana 0.3 as well. A lot of people still use it.
What eventually worked for me was to add these arguments to the MacOS build logic in setup.py#L87 of v0.3, mirroring updates that we made in v0.4:
os.environ['CC'] = 'clang --sysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
extra_compile_args += ['-D NO_TR1_MEMORY', '-stdlib=libc++']
extra_link_args += ['-stdlib=libc++']
This StackOverflow answer explains why the sysroot
has to be changed for Catalina: https://stackoverflow.com/questions/58278260/cant-compile-a-c-program-on-a-mac-after-upgrading-to-catalina-10-15/58278392#58278392
I still don't feel like I have a complete understanding of what's going on, like why the older binaries don't work anymore. And @cvanoli reported similar problems in MacOS 10.14 Mojave recently, so these changes may not be tied strictly to the OS version.
PR #137 resolves this in the dev build of Pandana, to be released on pip/conda soon.
I feel like it's probably not worth going back and patching earlier versions so they can compile in MacOS 10.15 Catalina. But I'll leave this issue open and we can revisit if needed.
PR #137 resolves this in the dev build of Pandana, to be released on pip/conda soon.
I feel like it's probably not worth going back and patching earlier versions so they can compile in MacOS 10.15 Catalina. But I'll leave this issue open and we can revisit if needed.
@smmaurer is there any update to when it will be released on pip/conda? Or advice on how to install the package on MacOS 10.15 without the technical capabilities to compile locally?
Hi @zippau, this should be released next week!
But I think only pip install
and installations from the GitHub source code were affected by this -- conda install
should work fine in MacOS 10.15 even without the fix.
Here are some tips for installing Pandana in MacOS 10.15 Catalina.
Existing installation instructions: http://udst.github.io/pandana/installation.html
Conda
conda install pandana
worked for me.Pip / local compilation
You need to reinstall Command Line Tools, even if you had them before updating to Catalina:
xcode-select --install
Single-threaded (using built-in compiler)
This is failing for me. The conditional in setup.py#L72 is always evaluating to True because of whitespace in the string from the OS, so the
-fopenmp
flag is added when it shouldn't be.The fix is to use
os.popen('which clang').read().strip()
. This lets single-threaded installation succeed on my machine.Multi-threaded (using Conda toolchain)
The C++ header files are in a new location in Catalina. We don't have to install them separately any more, but we do have to make sure the compilation toolchain can see them.
What eventually worked for me was to replace
'clang'
in setup.py#L73 with the following:'clang --sysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
Fixes for next release
--sysroot
argument in setup.py#L73