pypa / packaging-problems

An issue tracker for the problems in packaging
150 stars 34 forks source link

Trouble with a installing package and Error: subprocess-exited-with-error #770

Open Nandhu-Sai-Datta opened 4 months ago

Nandhu-Sai-Datta commented 4 months ago

OS version

Windows 11

Python version

python 3.12

Pip version

pip 24.0 from C:\Users\nandh\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip (python 3.12)

Guide link

No response

Problem description

pip install spacy==2.3.5

Error message

~\Downloads\Compressed\resume-20240617T112457Z-001\resume
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
Collecting https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz
  Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz (12.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.0/12.0 MB 2.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting spacy<2.4.0,>=2.3.0 (from en_core_web_sm==2.3.1)
  Using cached spacy-2.3.9.tar.gz (1.0 MB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [300 lines of output]
      Collecting setuptools
        Using cached setuptools-70.0.0-py3-none-any.whl.metadata (5.9 kB)
      Collecting cython<3.0,>=0.25
        Using cached Cython-0.29.37-py2.py3-none-any.whl.metadata (3.1 kB)
      Collecting cymem<2.1.0,>=2.0.2
        Using cached cymem-2.0.8-cp312-cp312-win_amd64.whl.metadata (8.6 kB)
      Collecting preshed<3.1.0,>=3.0.2
        Using cached preshed-3.0.9-cp312-cp312-win_amd64.whl.metadata (2.2 kB)
      Collecting murmurhash<1.1.0,>=0.28.0
        Using cached murmurhash-1.0.10-cp312-cp312-win_amd64.whl.metadata (2.0 kB)
      Collecting thinc<7.5.0,>=7.4.1
        Using cached thinc-7.4.6.tar.gz (1.3 MB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'error'
        error: subprocess-exited-with-error

        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:\Users\nandh\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
            main()
          File "C:\Users\nandh\AppData\Local\Programs\Python\Python312\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:\Users\nandh\AppData\Local\Programs\Python\Python312\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\nandh\AppData\Local\Temp\pip-build-env-9bei2cqq\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\nandh\AppData\Local\Temp\pip-build-env-9bei2cqq\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
            self.run_setup()
          File "C:\Users\nandh\AppData\Local\Temp\pip-build-env-9bei2cqq\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\nandh\AppData\Local\Temp\pip-build-env-9bei2cqq\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 1154, in cythonize
            cythonize_one(*args)
          File "C:\Users\nandh\AppData\Local\Temp\pip-build-env-9bei2cqq\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.
merwok commented 4 months ago

The errors look like this:

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

so the code should be changed, or the cython version used by the project changed.

henryiii commented 4 months ago

Why are you pinning such an old version? 3.7.5 is the current version. It's likely that doesn't work with Cython 3, and newer versions are more likely to support it. If you need to install old versions of things you could try uv instead of pip, as it has a uv pip install spacy --exclude-newer 2020-12-11; also you should not use Python 3.12 with a package that came out 4 years before ago. 3.8 or 3.9 if you do actually require the old spacy version.