mcmtroffaes / pycddlib

A Python wrapper for Komei Fukuda's cddlib.
http://packages.python.org/pycddlib/
GNU General Public License v2.0
61 stars 9 forks source link

pip install pycddlib failed #61

Closed S-kewen closed 1 year ago

S-kewen commented 1 year ago

Hi, first of all thank you very much for your contribution.

I recently tried to install pycddlib in ubuntu, but I found that the official website document does not include conda install, I tried using conda install -c conda-forge gmp && conda install -c anaconda gmp, but it still fails.

So, I would like to ask if it is possible to use the conda command instead of the following command: apt-get install libgmp-dev python3-dev

here is the errormsg (I guess it's caused by missing libgmp-dev): `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 ╰─> [17 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.linux-x86_64-cpython-37 creating build/temp.linux-x86_64-cpython-37/cddlib creating build/temp.linux-x86_64-cpython-37/cddlib/lib-src gcc -pthread -B /home/skewen/anaconda3/envs/pointinet/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DGMPRATIONAL -Icddlib/lib-src -I/home/skewen/anaconda3/envs/pointinet/include/python3.7m -c cdd.c -o build/temp.linux-x86_64-cpython-37/cdd.o In file included from cddlib/lib-src/cdd.h:17, from cdd.c:749: cddlib/lib-src/cddmp.h:30:11: fatal error: gmp.h: No such file or directory

include "gmp.h"

             ^~~~~~~
  compilation terminated.
  error: command '/usr/bin/gcc' 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 ╰─> [19 lines of output] running install /home/skewen/anaconda3/envs/pointinet/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. setuptools.SetuptoolsDeprecationWarning, running build running build_ext skipping 'cdd.c' Cython extension (up-to-date) building 'cdd' extension creating build creating build/temp.linux-x86_64-cpython-37 creating build/temp.linux-x86_64-cpython-37/cddlib creating build/temp.linux-x86_64-cpython-37/cddlib/lib-src gcc -pthread -B /home/skewen/anaconda3/envs/pointinet/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DGMPRATIONAL -Icddlib/lib-src -I/home/skewen/anaconda3/envs/pointinet/include/python3.7m -c cdd.c -o build/temp.linux-x86_64-cpython-37/cdd.o In file included from cddlib/lib-src/cdd.h:17, from cdd.c:749: cddlib/lib-src/cddmp.h:30:11: fatal error: gmp.h: No such file or directory

include "gmp.h"

             ^~~~~~~
  compilation terminated.
  error: command '/usr/bin/gcc' 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.`

S-kewen commented 1 year ago

I tried to execute the following command successfully in python 3.9.13: conda install -c conda-forge gmp && pip install pycddlib

But this method doesn't work in python 3.7.13. QAQ!!

mcmtroffaes commented 1 year ago

It appears that the python install command is not finding the gmp headers installed by conda. I wish I could help, however I don't know much about conda. A quick search showed this on stackoverflow (different package but same problem):

https://stackoverflow.com/questions/43625797/how-should-conda-handle-header-files

It appears that conda install gcc to ensure conda uses its own gcc compiler rather than the system one somehow solved this for the poster: I guess because the conda installed gcc will find headers of packages installed by conda. If you manage to make it work, do let me know. Good luck!

S-kewen commented 1 year ago

It appears that the python install command is not finding the gmp headers installed by conda. I wish I could help, however I don't know much about conda. A quick search showed this on stackoverflow (different package but same problem):

https://stackoverflow.com/questions/43625797/how-should-conda-handle-header-files

It appears that conda install gcc to ensure conda uses its own gcc compiler rather than the system one somehow solved this for the poster: I guess because the conda installed gcc will find headers of packages installed by conda. If you manage to make it work, do let me know. Good luck!

Thanks for your quick reply, but I found that my above method works fine in python3.9.13.

So i think have any version compatibility issues between gmp and python and pycddlib?

mcmtroffaes commented 1 year ago

I don't think so, since it works on Python 3.7 outside of conda, therefore the problem seems conda specific. Can you ask for help with the conda community?