IBM / LNN

A `Neural = Symbolic` framework for sound and complete weighted real-value logic
https://IBM.github.io/LNN/
Apache License 2.0
228 stars 438 forks source link

pycddlib cannot be installed on MacOS Monterey M1 #34

Closed ubayram closed 2 years ago

ubayram commented 2 years ago

The pycddlib installation problem cannot be resolved with the commands provided at the ReadMe unfortunately. I've done some digging at the github page of pycddlib and it seems like the currently available version (2.1.6) isn't compatible with MacOS. It seems like they experimented with new versions that are compatible (2.1.7a0) but aren't available to install yet. I've inferred all these information from the page https://github.com/mcmtroffaes/pycddlib/actions

So, how can we work around this issue and be able to install & test LNN regardless?

Currently running the code brew install gmp; env "CFLAGS=-I/usr/local/include -L/usr/local/lib" pip install pycddlib returns the following error:

`Collecting pycddlib Using cached pycddlib-2.1.6.tar.gz (159 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: pycddlib Building wheel for pycddlib (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [18 lines of output] running bdist_wheel running build running build_ext cythoning cdd.pyx to cdd.c building 'cdd' extension creating build creating build/temp.macosx-10.9-x86_64-3.9 creating build/temp.macosx-10.9-x86_64-3.9/cddlib creating build/temp.macosx-10.9-x86_64-3.9/cddlib/lib-src clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/ub/opt/anaconda3/envs/lnn/include -arch x86_64 -I/Users/ub/opt/anaconda3/envs/lnn/include -fPIC -O2 -isystem /Users/ub/opt/anaconda3/envs/lnn/include -arch x86_64 -I/usr/local/include -L/usr/local/lib -DGMPRATIONAL -Icddlib/lib-src -I/Users/ub/opt/anaconda3/envs/lnn/include/python3.9 -c cdd.c -o build/temp.macosx-10.9-x86_64-3.9/cdd.o clang: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument] In file included from cdd.c:749: In file included from cddlib/lib-src/cdd.h:17: cddlib/lib-src/cddmp.h:30:11: fatal error: 'gmp.h' file not found

include "gmp.h"

            ^~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pycddlib Running setup.py clean for pycddlib Failed to build pycddlib Installing collected packages: pycddlib Running setup.py install for pycddlib ... error error: subprocess-exited-with-error

× Running setup.py install for pycddlib did not run successfully. │ exit code: 1 ╰─> [18 lines of output] running install running build running build_ext skipping 'cdd.c' Cython extension (up-to-date) building 'cdd' extension creating build creating build/temp.macosx-10.9-x86_64-3.9 creating build/temp.macosx-10.9-x86_64-3.9/cddlib creating build/temp.macosx-10.9-x86_64-3.9/cddlib/lib-src clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/ub/opt/anaconda3/envs/lnn/include -arch x86_64 -I/Users/ub/opt/anaconda3/envs/lnn/include -fPIC -O2 -isystem /Users/ub/opt/anaconda3/envs/lnn/include -arch x86_64 -I/usr/local/include -L/usr/local/lib -DGMPRATIONAL -Icddlib/lib-src -I/Users/ub/opt/anaconda3/envs/lnn/include/python3.9 -c cdd.c -o build/temp.macosx-10.9-x86_64-3.9/cdd.o clang: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument] In file included from cdd.c:749: In file included from cddlib/lib-src/cdd.h:17: cddlib/lib-src/cddmp.h:30:11: fatal error: 'gmp.h' file not found

include "gmp.h"

            ^~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure

× Encountered error while trying to install package. ╰─> pycddlib

note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.`

sodoherty-ai commented 2 years ago

Same issue. gmp is installed via brew without fault. gmp version 6.2.1_1

I think it might have something to do with folders. Location of gmp.h for me is here: /opt/homebrew/include/gmp.h

sodoherty-ai commented 2 years ago

This worked for me.

env "CFLAGS=-I/opt/homebrew/include -L/opt/homebrew/lib" pip install pycddlib

ubayram commented 2 years ago

This worked for me.

env "CFLAGS=-I/opt/homebrew/include -L/opt/homebrew/lib" pip install pycddlib

It worked!!! Thank you!!!