Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during installation of BanditPAM - Unsupported compiler -- at least C++11 support is needed! #150

Closed
sterlingalic opened this issue Nov 24, 2021 · 10 comments

Comments

@sterlingalic
Copy link

I ran the command pip3 install banditpam, but ran into the following error:

File "/private/var/folders/k2/_w3zmb555fj_k1x7mtg_q6400000gn/T/pip-install-is81nqkv/banditpam_04dfedfe2ee2481a932e35a91a31d0fe/setup.py", line 239, in build_extensions opts.append(cpp_flag(self.compiler)) File "/private/var/folders/k2/_w3zmb555fj_k1x7mtg_q6400000gn/T/pip-install-is81nqkv/banditpam_04dfedfe2ee2481a932e35a91a31d0fe/setup.py", line 88, in cpp_flag raise RuntimeError("Unsupported compiler -- at least C++11 support is needed!") RuntimeError: Unsupported compiler -- at least C++11 support is needed!

Any thoughts on how to proceed? Tried following some of the suggestions from here but with no luck.

@motiwari
Copy link
Owner

Hi @sterlingalic , thank you for the bug report! A few questions:

  • What OS are you on? If you're on Linux, what is your output for screenfetch -n?
  • What is your output for pip3 -V?
  • What is your output for gcc --version?
  • Are your CC or CXX environment variables set?
  • Could you paste the full output when you open a Python REPL, e.g.
>>> python3
Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:50:38)
[Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.

At first glance, it looks like your gcc doesn't support C++11, so the error is being thrown from here. It could also be that your compiler only supports C++20 and not C++17? But it's hard to tell without more information.

While not best practice, and you will want to make sure these libraries won't break things, installing the following libraries with this command may help:

sudo apt install -y build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

@sterlingalic
Copy link
Author

Thanks for the quick response!

Running on: Mac OS X

pip version: pip 21.3.1 from /Users/sterlingalic/Desktop/cs131new/CS131_release/fall_2021/.env/lib/python3.8/site-packages/pip (python 3.8)

gcc version:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Python REPL output: >>> python3
Python 3.8.5 (default, Sep 4 2020, 02:22:02)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.

Looks like neither of my CC or CXX variables are set and that my clang version is >11 outside of Python but not when it's used in Python. Should I manually set them to something or install some separate kind of compiler for Python?

@motiwari
Copy link
Owner

This is interesting: it looks like your pip isn't from anaconda, rather it's from something else -- perhaps virtualenv?

If you echo $CONDA_PREFIX you should be able to use the pip3 in that directory, e.g., $CONDA_PREFIX/bin/pip3 and install banditpam successfully.

(It does look like you're using Anaconda CPython compiled with clang (from your REPL output), but your pip may be using gcc under the hood; do you have another python3 executable in /Users/sterlingalic/Desktop/cs131new/CS131_release/fall_2021/.env/ somewhere?)

On Mac OS X, the gcc (which is really Apple clang) doesn't support OpenMP, which makes this package much slower. For this reason, we suggest everyone use Anaconda python compiled with clang

@sterlingalic
Copy link
Author

Oh yes, I should've mentioned that I originally tried running this from a virtual environment, but it also wasn't working on my machine either. I ran/path_to_anaconda/bin/pip3 install banditpam on both the virtual environment and my machine environment and am still getting the same error message. This the same info from outside of the virtual environment:

pip version:
pip 21.3.1 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

gcc version:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Python REPL output: >>> python3
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

@motiwari
Copy link
Owner

motiwari commented Nov 24, 2021

Just to confirm: your output from this was inside the virtual environment, whereas your output from this is from your system python?

I'm a bit confused because in the latter, it doesn't look like you're using Anaconda python? And in the former, it looks like you were using Anaconda python but inside a virtualenv?

Could you try creating a new Anaconda environment, activating it, ensuring your pip and python point to the Anaconda binaries, and then try to install the project?

@deepaks2112
Copy link

deepaks2112 commented Nov 26, 2021

Can you run pip3 install banditpam and paste the complete logs here?

I faced a similar issue. On inspecting I found out that while checking for flags ["-std=c++17", "-std=c++14", "-std=c++11"], this method invocation compiler.compile([fname], extra_postargs=[flagname]) was picking up the compiler from a location where nothing was installed for me.

Please capture complete logs for pip3 install banditpam before trying this.

To install I simply installed llvm from homebrew using brew install llvm. I got the hint to install LLVM from this assert statement - assert(compiler_check() == 'clang', "Need to install LLVM clang!").

@sterlingalic
Copy link
Author

What do you mean by the "logs" and how do I access them (or if you have any links to any tutorials on how to access them)? Attached a file of the installation std out and std error below.

banditpam_installation_output.txt

@deepaks2112
Copy link

deepaks2112 commented Dec 1, 2021

unable to execute '/usr/local/opt/llvm/bin/clang': No such file or directory

I found this in the attached logs and when you install LLVM there will be a binary installed at this exact location. Do let us know if installing LLVM solved it for you?

@sterlingalic
Copy link
Author

That did the trick! Thanks Deepak and Mo!

@motiwari
Copy link
Owner

motiwari commented Dec 1, 2021

Great! I've added these instructions to the MacOS installation guide.

Thanks for the help, @deepaks2112 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants