invalid_argument: Attempted to construct a ThreadCount with a value (1) that falls outside the interval [0, 0]
Hi, I am trying to load my python bindings but I keep getting these errors, is there something wrong with what I am doing?
(bw_cpp_env_080524_raw) dhcp-123-144:bayeswave-cpp sophie$ python
Python 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:11:10) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from bayeswavecpp_bindings import autoload_cppyy
(Re-)building pre-compiled headers (options: -O2 -march=native); this may take a minute ...
ERROR in cling::CIFactory::createCI(): cannot extract standard library include paths!
Invoking:
LC_ALL=C clang-14 -O2 -DNDEBUG -xc++ -E -v /dev/null 2>&1 | sed -n -e '/^.*include/,${' -e '/^ \/.*++/p' -e '}'
Results was:
With exit code 0
In file included from input_line_3:38:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/cassert:19:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__assert:13:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__assertion_handler:13:
/Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__config:48:8: warning: "Libc++ only supports Clang 16 and later" [-W#warnings]
# warning "Libc++ only supports Clang 16 and later"
^
In file included from input_line_3:38:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/cassert:19:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__assert:13:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__assertion_handler:14:
/Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__verbose_abort:20:1: error: expected identifier or '{'
_LIBCPP_BEGIN_NAMESPACE_STD
^
/Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__config:884:81: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD'
# define _LIBCPP_BEGIN_NAMESPACE_STD namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT std { \
^
In file included from input_line_3:38:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/cassert:19:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__assert:13:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__assertion_handler:14:
/Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__verbose_abort:20:1: error: C++ requires a type specifier for all declarations
/Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__config:884:81: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD'
# define _LIBCPP_BEGIN_NAMESPACE_STD namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT std { \
^
In file included from input_line_3:38:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/cassert:19:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__assert:13:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__assertion_handler:14:
/Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__verbose_abort:20:1: error: expected expression
/Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__config:885:32: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD'
inline namespace _LIBCPP_ABI_NAMESPACE {
^
In file included from input_line_3:38:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/cassert:19:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__assert:13:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__assertion_handler:14:
/Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/bin/../include/c++/v1/__verbose_abort:51:26: error: expected ';' after top level declarator
_LIBCPP_END_NAMESPACE_STD
^
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/bayeswavecpp_bindings/__init__.py", line 17, in <module>
from .autoload_cppyy import *
File "/Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/bayeswavecpp_bindings/autoload_cppyy.py", line 2, in <module>
load_cppyy.load_library_for_cppyy('/Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/build')
File "/Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/bayeswavecpp_bindings/load_cppyy.py", line 45, in load_library_for_cppyy
cppyy.load_library('libbayeswavecpp')
File "/Users/sophie/mambaforge/envs/bw_cpp_env_080524_raw/lib/python3.12/site-packages/cppyy/__init__.py", line 281, in load_library
sc = gSystem.Load(name)
^^^^^^^^^^^^^^^^^^
cppyy.gbl.std.invalid_argument: int CppyyLegacy::TSystem::Load(const char* module, const char* entry = "", CppyyLegacy::Bool_t system = kFALSE) =>
invalid_argument: Attempted to construct a ThreadCount with a value (1) that falls outside the interval [0, 0] of the machine's allowed thread counts; to construct a ThreadCount, provide a value within that interval
Mismatch between installed compiler (clang-14) and installed standard lib (it states warning "Libc++ only supports Clang 16 and later"). Note that cppyy still uses clang-13; work is underway on 17.
Not sure how you both got a newer version of libc++ but an older version of clang in the same environment? And in particular the output of the command above (LC_ALL=C clang-14 -O2 -DNDEBUG -xc++ -E -v /dev/null 2>&1 | sed -n -e '/^.*include/,${' -e '/^ \/.*++/p' -e '}') indicates that clang-14 can't find any headers suitable for its own use?
Hm ok, it seems that that dependency is not in the conda version. I made the env with this .yaml file:
channels:
- conda-forge
dependencies:
- c-compiler
- cxx-compiler
- cppyy
- clang
- clang-tools
- catch2
- cmake
- doxygen
- make
- h5py
- llvm-openmp
- ezdag
- eigen
- autodiff
- pkg-config
- fftw * nompi*
- gsl
- gwpy
- liblal
- liblalframe
- liblalinference
- liblalsimulation
- lalsimulation
- pandas
- pytables
- python
- python-clang
- rapidjson
- matplotlib
- numpy
- scipy
- bilby
name: bayeswave-cpp
Is there a way (or a recommendation) of how I should specify the clang (and python clang?) versions?
Also, when I try to specify an older version of clang like so:
channels:
- conda-forge
dependencies:
- c-compiler
- cxx-compiler
- clang <= 14
- clang-tools <= 14
- cppyy
- catch2
- cmake
- doxygen
- make
- h5py
- llvm-openmp
- ezdag
- eigen
- autodiff
- pkg-config
- fftw * nompi*
- gsl
- gwpy
- liblal
- liblalframe
- liblalinference
- liblalsimulation
- lalsimulation
- pandas
- pytables
- python
- python-clang <= 14
- rapidjson
- matplotlib
- numpy
- scipy
- bilby
name: bayeswave-cpp
I get compiler errors saying:
(bw_cpp_env_080624_clangleq14) Sophies-MacBook-Pro-4:bayeswave-cpp sophie$ cmake --build build --target main create_data -j8
-- GIT_PROJECT_REMOTE_ORIGIN_URL is [email protected]:sophie.hourihane/bayeswave-cpp.git
-- CMAKE_CURRENT_LIST_DIR : /Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/src
[ 0%] Built target version
[ 1%] Building CXX object src/CMakeFiles/bayeswavecpp.dir/builders/injection_data_builder.cpp.o
[ 1%] Building CXX object src/CMakeFiles/bayeswavecpp.dir/builders/cached_data_builder.cpp.o
[ 3%] Building CXX object src/CMakeFiles/bayeswavecpp.dir/builders/lal_data_builder.cpp.o
[ 5%] Building CXX object src/CMakeFiles/bayeswavecpp.dir/builders/run_builder.cpp.o
[ 5%] Building CXX object src/CMakeFiles/bayeswavecpp.dir/builders/state_injector.cpp.o
[ 6%] Building CXX object src/CMakeFiles/bayeswavecpp.dir/chains/chain_collection_updaters.cpp.o
[ 8%] Building CXX object src/CMakeFiles/bayeswavecpp.dir/chains/chain_swappers.cpp.o
[ 8%] Building CXX object src/CMakeFiles/bayeswavecpp.dir/chains/chain_collection.cpp.o
In file included from /Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/src/builders/run_builder.cpp:23:
In file included from /Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/src/builders/run_builder.hpp:26:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/memory:921:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__assert:13:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__assertion_handler:13:
/Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__config:48:8: warning: "Libc++ only supports Clang 16 and later" [-W#warnings]
# warning "Libc++ only supports Clang 16 and later"
^
In file included from /Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/src/builders/state_injector.cpp:23:
In file included from /Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/src/builders/state_injector.hpp:26:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/filesystem:536:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__assert:13:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__assertion_handler:13:
/Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__config:48:8: warning: "Libc++ only supports Clang 16 and later" [-W#warnings]
# warning "Libc++ only supports Clang 16 and later"
^
In file included from /Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/src/builders/run_builder.cpp:23:
In file included from /Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/src/builders/run_builder.hpp:26:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/memory:921:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__assert:13:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__assertion_handler:14:
/Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__verbose_abort:20:1: error: expected identifier or '{'
_LIBCPP_BEGIN_NAMESPACE_STD
^
/Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__config:884:81: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD'
# define _LIBCPP_BEGIN_NAMESPACE_STD namespace _LIBCPP_TYPE_VISIBILITY_DEFAULT std { \
^
In file included from /Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/src/builders/state_injector.cpp:23:
In file included from /Users/sophie/src/BayesWave_Cpp/bayeswave-cpp/src/builders/state_injector.hpp:26:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/filesystem:536:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__assert:13:
In file included from /Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__assertion_handler:14:
/Users/sophie/mambaforge/envs/bw_cpp_env_080624_clangleq14/bin/../include/c++/v1/__verbose_abort:20:1: error: expected identifier or '{'
_LIBCPP_BEGIN_NAMESPACE_STD
^
...
Also, when I try to install cppyy with nothing else in my environment, the specs that you described are not respected and clang 16 etc are installed
(base) Sophies-MacBook-Pro-4:~ sophie$ mamba create -n bw_cpp_env_082724 cppyy
__ __ __ __
/ \ / \ / \ / \
/ \/ \/ \/ \
███████████████/ /██/ /██/ /██/ /████████████████████████
/ / \ / \ / \ / \ \____
/ / \_/ \_/ \_/ \ o \__,
/ _/ \_____/ `
|/
███╗ ███╗ █████╗ ███╗ ███╗██████╗ █████╗
████╗ ████║██╔══██╗████╗ ████║██╔══██╗██╔══██╗
██╔████╔██║███████║██╔████╔██║██████╔╝███████║
██║╚██╔╝██║██╔══██║██║╚██╔╝██║██╔══██╗██╔══██║
██║ ╚═╝ ██║██║ ██║██║ ╚═╝ ██║██████╔╝██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝
mamba (1.4.1) supported by @QuantStack
GitHub: https://github.com/mamba-org/mamba
Twitter: https://twitter.com/QuantStack
█████████████████████████████████████████████████████████████
Looking for: ['cppyy']
warning libmamba Could not parse state file: Could not load cache state: [json.exception.type_error.302] type must be string, but is null
warning libmamba Could not parse state file: Could not load cache state: [json.exception.type_error.302] type must be string, but is null
warning libmamba Could not parse state file: Could not load cache state: [json.exception.type_error.302] type must be string, but is null
warning libmamba Could not parse state file: Could not load cache state: [json.exception.type_error.302] type must be string, but is null
warning libmamba Could not parse state file: Could not load cache state: [json.exception.type_error.302] type must be string, but is null
warning libmamba Could not parse state file: Could not load cache state: [json.exception.type_error.302] type must be string, but is null
pkgs/main/noarch 874.9kB @ 1.5MB/s 0.9s
pkgs/r/osx-64 820.9kB @ 1.3MB/s 1.0s
pkgs/r/noarch 2.3MB @ 2.0MB/s 1.6s
pkgs/main/osx-64 6.9MB @ 2.8MB/s 3.3s
conda-forge/noarch 18.7MB @ 3.1MB/s 6.6s
conda-forge/osx-64 38.6MB @ 4.1MB/s 12.5s
Transaction
Prefix: /Users/sophie/mambaforge/envs/bw_cpp_env_082724
Updating specs:
- cppyy
Package Version Build Channel Size
────────────────────────────────────────────────────────────────────────────────────────
Install:
────────────────────────────────────────────────────────────────────────────────────────
+ bzip2 1.0.8 h6c40b1e_6 pkgs/main/osx-64 155kB
+ c-compiler 1.7.0 h282daa2_1 conda-forge/osx-64 Cached
+ ca-certificates 2024.7.2 hecd8cb5_0 pkgs/main/osx-64 Cached
+ cctools 986 h40f6528_3 conda-forge/osx-64 Cached
+ cctools_osx-64 986 h303a5ab_3 conda-forge/osx-64 Cached
+ clang 16.0.6 default_h179603d_11 conda-forge/osx-64 Cached
+ clang-16 16.0.6 default_h0c94c6a_11 conda-forge/osx-64 Cached
+ clang_impl_osx-64 16.0.6 h8787910_19 conda-forge/osx-64 18kB
+ clang_osx-64 16.0.6 hb91bd55_19 conda-forge/osx-64 21kB
+ clangxx 16.0.6 default_h179603d_11 conda-forge/osx-64 Cached
+ clangxx_impl_osx-64 16.0.6 h6d92fbe_19 conda-forge/osx-64 18kB
+ clangxx_osx-64 16.0.6 hb91bd55_19 conda-forge/osx-64 19kB
+ compiler-rt 16.0.6 ha38d28d_2 conda-forge/osx-64 Cached
+ compiler-rt_osx-64 16.0.6 ha38d28d_2 conda-forge/noarch Cached
+ cppyy 3.1.2 py312h3204919_2 conda-forge/osx-64 Cached
+ cppyy-backend 1.15.2 py312h9230928_1 conda-forge/osx-64 Cached
+ cppyy-cling 6.30.0 py312h99981ff_3 conda-forge/osx-64 119MB
+ cpycppyy 1.12.16 py312h9230928_1 conda-forge/osx-64 Cached
+ cxx-compiler 1.7.0 h7728843_1 conda-forge/osx-64 Cached
+ icu 75.1 h120a0e1_0 conda-forge/osx-64 Cached
+ ld64 711 ha02d983_3 conda-forge/osx-64 Cached
+ ld64_osx-64 711 h04ffbf3_3 conda-forge/osx-64 Cached
+ libclang-cpp16 16.0.6 default_h0c94c6a_11 conda-forge/osx-64 Cached
+ libcxx 18.1.8 hd876a4e_6 conda-forge/osx-64 1MB
+ libexpat 2.6.2 h73e2aa4_0 conda-forge/osx-64 Cached
+ libffi 3.4.4 hecd8cb5_1 pkgs/main/osx-64 132kB
+ libiconv 1.17 hd75f5a5_2 conda-forge/osx-64 Cached
+ libllvm16 16.0.6 hbedff68_3 conda-forge/osx-64 Cached
+ libsqlite 3.46.0 h1b8f9f3_0 conda-forge/osx-64 Cached
+ libxml2 2.12.7 heaf3512_4 conda-forge/osx-64 Cached
+ libzlib 1.3.1 h87427d6_1 conda-forge/osx-64 Cached
+ llvm-openmp 14.0.6 h0dcd299_0 pkgs/main/osx-64 Cached
+ llvm-tools 16.0.6 hbedff68_3 conda-forge/osx-64 Cached
+ ncurses 6.5 hf036a51_1 conda-forge/osx-64 822kB
+ openssl 3.3.1 hd23fc13_3 conda-forge/osx-64 3MB
+ pip 24.2 py312hecd8cb5_0 pkgs/main/osx-64 3MB
+ python 3.12.5 h37a9e06_0_cpython conda-forge/osx-64 12MB
+ python_abi 3.12 5_cp312 conda-forge/osx-64 6kB
+ readline 8.2 hca72f7f_0 pkgs/main/osx-64 Cached
+ setuptools 72.1.0 py312hecd8cb5_0 pkgs/main/osx-64 3MB
+ sigtool 0.1.3 h88f4db0_0 conda-forge/osx-64 Cached
+ tapi 1100.0.11 h1527ee5_1 pkgs/main/osx-64 186kB
+ tk 8.6.13 h1abcd95_1 conda-forge/osx-64 Cached
+ tzdata 2024a h04d1e81_0 pkgs/main/noarch Cached
+ wheel 0.43.0 py312hecd8cb5_0 pkgs/main/osx-64 143kB
+ xz 5.4.6 h6c40b1e_1 pkgs/main/osx-64 380kB
+ zstd 1.5.6 h915ae27_0 conda-forge/osx-64 Cached
Summary:
Install: 47 packages
Total download: 143MB
Yes, it's a conda thing on Mac. The pip install should not suffer from it. Looks like this is being fixed, though: https://github.com/conda-forge/cppyy-cling-feedstock/pull/62 However, what is really needed is an upgrade of LLVM to have full support on Mac again. I'm working on LLVM16 (upstream has this released in production) and soon on LLVM18 (upstream claims they are almost done porting to that version). I was hoping to wait for the latter, but this Mac problem is forcing the issue.
I have the same issue. If I install the latest version of CPPYY on macOS (cppyy=3.1.2 cppyy-cling=6.30.0), clang-16 gets installed along with it. When attempting to import any code, I get an error cling cannot extract standard library include paths from clang-14 which is not installed.