Search code examples
pythonparsingpipnlpspacy

Not able to install spacy==2.3.5 version


I tried to install spacy==2.3.5 for a resume analyser program. Encountered with a pip subprocess to install build dependencies did not run successfully error.

Using Python 3.12.3

Also it gives a E053 config file error when running the program regarding pyresparser: "OSError: [E053] Could not read config file from C:\Smart_Resume_Analyser_App-master.venv\Lib\site-packages\pyresparser\config.cfg"

`(.venv) PS C:\Smart_Resume_Analyser_App-master> pip install spacy==2.3.5

    Getting requirements to build wheel did not run successfully.
    exit code: 1

    [267 lines of output]

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        len_t* widths
        int i
        int nr_layer
        int batch_size

        __init__(len_t* widths, int nr_layer, int batch_size) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:140:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            this._nr_feat = <len_t*>calloc(batch_size, sizeof(len_t))
            this._is_valid = <int*>calloc(batch_size * widths[nr_layer-1], sizeof(int))
            this._costs = <weight_t*>calloc(batch_size * widths[nr_layer-1], sizeof(weight_t))
            this.signatures = <uint64_t*>calloc(batch_size, sizeof(uint64_t))

        __dealloc__() nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:157:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            free(this._nr_feat)
            free(this._is_valid)
            free(this._costs)
            free(this.signatures)

        void reset() nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:172:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            for i in range(this.i):
                free(this._feats[i])
                this._feats[i] = NULL
            this.i = 0

        int nr_in() nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:189:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            this.i = 0

        int nr_in() nogil:
            return this.widths[0]

        int nr_out() nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:192:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return this.widths[0]

        int nr_out() nogil:
            return this.widths[this.nr_layer - 1]

        int push_back(const FeatureC* feats, int nr_feat,
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:195:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                for i in range(this.nr_out()):
                    this.is_valid(this.i)[i] = 1
            this.i += 1
            return this.i >= this.batch_size

        FeatureC* features(int i) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:226:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return this.i >= this.batch_size

        FeatureC* features(int i) nogil:
            return this._feats[i]

        int nr_feat(int i) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:229:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return this._feats[i]

        int nr_feat(int i) nogil:
            return this._nr_feat[i]

        weight_t* fwd(int i, int j) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:232:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return this._nr_feat[i]

        weight_t* fwd(int i, int j) nogil:
            return this._fwd[i] + (j * this.widths[i])

        weight_t* bwd(int i, int j) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:235:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return this._fwd[i] + (j * this.widths[i])

        weight_t* bwd(int i, int j) nogil:
            return this._bwd[i] + (j * this.widths[i])

        weight_t* scores(int i) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:238:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return this._bwd[i] + (j * this.widths[i])

        weight_t* scores(int i) nogil:
            return this.fwd(this.nr_layer-1, i)

        weight_t* losses(int i) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:241:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return this.fwd(this.nr_layer-1, i)

        weight_t* losses(int i) nogil:
            return this.bwd(this.nr_layer-1, i)

        weight_t* costs(int i) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:244:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return this.bwd(this.nr_layer-1, i)

        weight_t* costs(int i) nogil:
            return this._costs + (i * this.nr_out())

        int* is_valid(int i) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:247:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return this._costs + (i * this.nr_out())

        int* is_valid(int i) nogil:
            return this._is_valid + (i * this.nr_out())

        int guess(int i) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:250:4: function definition in pxd file must be declared 'cdef inline'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return this._is_valid + (i * this.nr_out())

        int guess(int i) nogil:
            return VecVec.arg_max_if_true(this.scores(i), this.is_valid(i), this.nr_out())

        int best(int i) nogil:
        ^
    ------------------------------------------------------------

    thinc\structs.pxd:253:4: function definition in pxd file must be declared 'cdef inline'
    warning: thinc\linalg.pxd:14:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
    warning: thinc\linalg.pxd:90:8: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
    warning: thinc\linalg.pxd:174:8: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
    Compiling thinc/linalg.pyx because it changed.
    Compiling thinc/structs.pyx because it changed.
    Compiling thinc/typedefs.pyx because it changed.
    Compiling thinc/linear/avgtron.pyx because it changed.
    Compiling thinc/linear/features.pyx because it changed.
    Compiling thinc/linear/serialize.pyx because it changed.
    Compiling thinc/linear/sparse.pyx because it changed.
    Compiling thinc/linear/linear.pyx because it changed.
    Compiling thinc/neural/optimizers.pyx because it changed.
    Compiling thinc/neural/ops.pyx because it changed.
    Compiling thinc/neural/_aligned_alloc.pyx because it changed.
    Compiling thinc/extra/eg.pyx because it changed.
    Compiling thinc/extra/mb.pyx because it changed.
    Compiling thinc/extra/search.pyx because it changed.
    Compiling thinc/extra/cache.pyx because it changed.
    [ 1/15] Cythonizing thinc/extra/cache.pyx
    [ 2/15] Cythonizing thinc/extra/eg.pyx
    Traceback (most recent call last):
      File "C:\Smart_Resume_Analyser_App-master\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
        main()
      File "C:\Smart_Resume_Analyser_App-master\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Smart_Resume_Analyser_App-master\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel      
        return hook(config_settings)
               ^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\vasud\AppData\Local\Temp\pip-build-env-iv7ops9s\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
        return self._get_build_requires(config_settings, requirements=['wheel'])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\vasud\AppData\Local\Temp\pip-build-env-iv7ops9s\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
        self.run_setup()
      File "C:\Users\vasud\AppData\Local\Temp\pip-build-env-iv7ops9s\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
        exec(code, locals())
      File "<string>", line 258, in <module>
      File "<string>", line 195, in setup_package
      File "C:\Users\vasud\AppData\Local\Temp\pip-build-env-iv7ops9s\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 1154, in cythonize
        cythonize_one(*args)
      File "C:\Users\vasud\AppData\Local\Temp\pip-build-env-iv7ops9s\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 1321, in cythonize_one
        raise CompileError(None, pyx_file)
    Cython.Compiler.Errors.CompileError: thinc/extra/eg.pyx
    [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.
  [end of output]

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

× pip subprocess to install build dependencies 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. `


Solution

  • try:

    pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz
    

    or

    pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.0/en_core_web_sm-2.3.0.tar.gz