lab-cosmo / librascal

A scalable and versatile library to generate representations for atomic-scale learning
https://lab-cosmo.github.io/librascal/
GNU Lesser General Public License v2.1
80 stars 17 forks source link

Compilation issue: no python binding #419

Closed frssp closed 1 year ago

frssp commented 1 year ago

I excuted mkdir build && cd build && cmake .. && make on my ubuntu 20.04. I successfully compiled librascal (at least the log said 100%), but failed to copy bindings. In bindings/ directory, there is no _rascal.* but _rascalNone.

[ 41%] Built target rascal
[ 48%] Built target forwarding_of_property_requests
[ 54%] Built target json_structure
[ 61%] Built target alanine_chain
[ 67%] Built target spherical_expansion_example
[ 74%] Built target structure_manager_iteration
[ 80%] Built target spherical_invariants_example
[ 96%] Built target _rascal
[100%] Copying python bindings and libraries
Error copying file "/home/ht/Downloads/librascal/build_/bindings/_rascal.*" to "/home/ht/Downloads/librascal/build_/rascal/lib/".
make[2]: *** [bindings/CMakeFiles/copy_python_bindings.dir/build.make:73: bindings/CMakeFiles/copy_python_bindings] Error 1
make[1]: *** [CMakeFiles/Makefile2:1045: bindings/CMakeFiles/copy_python_bindings.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
$ tree bindings -L 1
bindings
├── CMakeFiles
├── cmake_install.cmake
├── CTestTestfile.cmake
├── Makefile
└── _rascalNone

1 directory, 4 files
Luthaf commented 1 year ago

That's quite weird. Which OS are you using, and which version of Python? Also, are you using a custom pybind11, or the default one? (if you don't know, you can also share the full cmake configure/build log here)

frssp commented 1 year ago

It is because of Python11. Seems like It has something to do with C API. I can build librascal with python3.9, and it works perfectly so far.

https://docs.python.org/3.11/whatsnew/3.11.html

The PyFrameObject structure members have been removed from the public C API.

While the documentation notes that the PyFrameObject fields are subject to change at any time, they have been stable for a long time and were used in several popular extensions.

In Python 3.11, the frame struct was reorganized to allow performance optimizations. Some fields were removed entirely, as they were details of the old implementation.