masashi-y / depccg

A* CCG Parser with a Supertag and Dependency Factored Model
MIT License
91 stars 28 forks source link

error while installing #37

Open mithunpaul08 opened 1 year ago

mithunpaul08 commented 1 year ago

Is there a particular version of Cython we should use? I get the following error (interestingly on both an osx and a linux machine)- wait , won't this work on a conda environment?

Collecting depccg
  Downloading depccg-2.0.3.2.tar.gz (3.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.5/3.5 MB 54.0 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [2 lines of output]
      Could not import Cython, which is required to build depccg extension modules.
      Please install cython and numpy prior to installing depccg.
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
(qnlp) which cython
~/miniconda3/envs/qnlp/bin/cython
(qnlp) cython --version
Cython version 0.29.35
mithunpaul08 commented 1 year ago

update. when i try python setup.py build_ext this is the specific error in depccg which is failing to install

depccg/parsing.pyx:44:42: unknown type in template argument
building 'depccg.morpha' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/depccg
gcc -pthread -B /nas/home/mithun/miniconda3/envs/qnlp/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -Ic -I/nas/home/mithun/miniconda3/envs/qnlp/include/python3.8 -c depccg/morpha.cpp -o build/temp.linux-x86_64-cpython-38/depccg/morpha.o -O3 -Wall -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/depccg
g++ -pthread -B /nas/home/mithun/miniconda3/envs/qnlp/compiler_compat -Wl,--sysroot=/ -pthread -shared -B /nas/home/mithun/miniconda3/envs/qnlp/compiler_compat -L/nas/home/mithun/miniconda3/envs/qnlp/lib -Wl,-rpath=/nas/home/mithun/miniconda3/envs/qnlp/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-cpython-38/depccg/morpha.o -o build/lib.linux-x86_64-cpython-38/depccg/morpha.cpython-38-x86_64-linux-gnu.so c/morpha.o
building 'depccg._parsing' extension
gcc -pthread -B /nas/home/mithun/miniconda3/envs/qnlp/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/nas/home/mithun/miniconda3/envs/qnlp/lib/python3.8/site-packages/numpy/core/include -I. -Idepccg -I/nas/home/mithun/miniconda3/envs/qnlp/include/python3.8 -c depccg/parsing.cpp -o build/temp.linux-x86_64-cpython-38/depccg/parsing.o -O3 -Wall -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
depccg/parsing.cpp:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
 #error Do not use this file, it is the result of a failed Cython compilation.
filemon11 commented 11 months ago

I get this error too with Cython 0.29.16 which was confirmed to work here https://github.com/masashi-y/depccg/issues/27 I really can't wrap my head around this...

masashi-y commented 11 months ago

Hi all. Sorry for being late to reply. Now I want to try as much to solve this issue. I used Python 3.10.0 and Cython 3.0.1 and noticed it caused compile error in the Cython side, and made a patch. Could you try installing depccg from the source?

$ git clone https://github.com/masashi-y/depccg
$ cd depccg
$ pip install numpy cython
$ python setup.py build_ext
nikhilkhatri commented 8 months ago

Hi @masashi-y, Installing the latest version from source worked for me!

Would it be possible to release a new version to PyPI with your patch?