Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error installing neuralcoref during docker build: Variables cannot be declared with 'cpdef'. Use 'cdef' instead. #5

Closed
agolo-alan-hogue opened this issue Oct 30, 2023 · 3 comments

Comments

@agolo-alan-hogue
Copy link

agolo-alan-hogue commented Oct 30, 2023

Hello,

I am trying to build the docker container for Elevant. I have cloned the repo and run docker build -t elevant ..

This is on MacOS.

The output is below.


[+] Building 83.3s (11/28)                                                                                                                                            docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                                  0.0s
 => => transferring dockerfile: 1.54kB                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                     0.0s
 => => transferring context: 259B                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                                                                                                                       1.9s
 => [internal] load build context                                                                                                                                                     0.1s
 => => transferring context: 1.95MB                                                                                                                                                   0.0s
 => [ 1/24] FROM docker.io/library/ubuntu:20.04@sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2                                                               3.7s
 => => resolve docker.io/library/ubuntu:20.04@sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2                                                                 0.0s
 => => sha256:a80d11b67ef30474bcccab048020ee25aee659c4caaca70794867deba5d392b6 424B / 424B                                                                                            0.0s
 => => sha256:0341906bdafc976cd73b05ea0e3df2e4884c6b6816197a2ffbd2367061c19acf 2.32kB / 2.32kB                                                                                        0.0s
 => => sha256:915eebb74587f0e5d3919cb77720c143be9a85a8d2d5cd44675d84c8c3a2b74a 25.97MB / 25.97MB                                                                                      2.8s
 => => sha256:ed4a42283d9943135ed87d4ee34e542f7f5ad9ecf2f244870e23122f703f91c2 1.13kB / 1.13kB                                                                                        0.0s
 => => extracting sha256:915eebb74587f0e5d3919cb77720c143be9a85a8d2d5cd44675d84c8c3a2b74a                                                                                             0.7s
 => [ 2/24] WORKDIR /home/                                                                                                                                                            0.1s
 => [ 3/24] RUN apt-get update                                                                                                                                                        7.6s
 => [ 4/24] RUN apt-get install -y python3 python3-pip git wget vim curl python3-gdbm                                                                                                45.0s
 => [ 5/24] RUN git clone https://github.com/huggingface/neuralcoref.git                                                                                                             13.2s
 => [ 6/24] RUN python3 -m pip install -r neuralcoref/requirements.txt                                                                                                               10.7s
 => ERROR [ 7/24] RUN python3 -m pip install -e neuralcoref                                                                                                                           1.1s
------
 > [ 7/24] RUN python3 -m pip install -e neuralcoref:
0.654 Obtaining file:///home/neuralcoref
1.082     ERROR: Command errored out with exit status 1:
1.082      command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/neuralcoref/setup.py'"'"'; __file__='"'"'/home/neuralcoref/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
1.082          cwd: /home/neuralcoref/
1.082     Complete output (39 lines):
1.082     /usr/local/lib/python3.8/dist-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/neuralcoref/neuralcoref/neuralcoref.pxd
1.082       tree = Parsing.p_module(s, pxd, full_module_name)
1.082
1.082     Error compiling Cython file:
1.082     ------------------------------------------------------------
1.082     ...
1.082         int length
1.082
1.082
1.082     cdef class Vocab:
1.082         cdef Pool mem
1.082         cpdef readonly StringStore strings
1.082               ^
1.082     ------------------------------------------------------------
1.082
1.082     /usr/local/lib/python3.8/dist-packages/spacy/vocab.pxd:29:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.
1.082     Processing neuralcoref.pyx
1.082     Traceback (most recent call last):
1.082       File "/home/neuralcoref/bin/cythonize.py", line 168, in <module>
1.082         run(args.root)
1.082       File "/home/neuralcoref/bin/cythonize.py", line 157, in run
1.082         process(base, filename, db)
1.082       File "/home/neuralcoref/bin/cythonize.py", line 123, in process
1.082         preserve_cwd(base, process_pyx, root + ".pyx", root + ".cpp")
1.082       File "/home/neuralcoref/bin/cythonize.py", line 86, in preserve_cwd
1.082         func(*args)
1.082       File "/home/neuralcoref/bin/cythonize.py", line 62, in process_pyx
1.082         raise Exception("Cython failed")
1.082     Exception: Cython failed
1.082     Traceback (most recent call last):
1.082       File "<string>", line 1, in <module>
1.082       File "/home/neuralcoref/setup.py", line 239, in <module>
1.082         setup_package()
1.082       File "/home/neuralcoref/setup.py", line 174, in setup_package
1.082         generate_cython(root, 'neuralcoref')
1.082       File "/home/neuralcoref/setup.py", line 163, in generate_cython
1.082         raise RuntimeError('Running cythonize failed')
1.082     RuntimeError: Running cythonize failed
1.082     Cythonizing sources
1.082     ----------------------------------------
1.083 ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
------
Dockerfile:8
--------------------
   6 |     RUN git clone https://github.com/huggingface/neuralcoref.git
   7 |     RUN python3 -m pip install -r neuralcoref/requirements.txt
   8 | >>> RUN python3 -m pip install -e neuralcoref
   9 |     COPY requirements.txt requirements.txt
  10 |     RUN python3 -m pip install -r requirements.txt
--------------------
ERROR: failed to solve: process "/bin/sh -c python3 -m pip install -e neuralcoref" did not complete successfully: exit code: 1```
@agolo-alan-hogue
Copy link
Author

It looks like this is related to this issue: huggingface/neuralcoref#357

@agolo-alan-hogue
Copy link
Author

It appears that neuralcoref is old (last release 2019) and won't work with more recent versions of Python. Is neuralcoref even necessary if you aren't using coref?

@flackbash
Copy link
Member

Sorry for the late reply! I will look into it, but in the meantime you can simply remove the instructions for installing neuralcoref from the Dockerfile (should be just lines 6, 7 and 8). As you wrote, neuralcoref is not necessary if you're not planning on using coreference resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants