explosion / explosion/spaCy

Calling Spacy from Matlab throws errors

Open
#13,535 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
33.9k
Forks
4.7k
Avg merge
3m
Merged PRs (30d)
1

Description

spaCy version 3.7.5

Location C:\Users\cse_s\AppData\Local\Programs\Python\Python312\Lib\site-packages\spacy

Platform Windows-11

Python version 3.12.3

Pipelines en_core_web_lg (3.7.1)

I want to call the Spacy code using Matlab. The Spacy code is as follows which work well using Pycharm IDE.

```
import spacy
nlp = spacy.load("en_core_web_lg")
doc = nlp("This is a sentence.")
```
However, the Matlab code throws errors

```
Error using numpy_ops>init thinc.backends.numpy_ops
Python Error: ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from
PyObject

Error in cupy_ops> (line 16)

Error in __init__> (line 17)

Error in api> (line 1)

Error in compat> (line 39)

Error in errors> (line 3)

Error in __init__> (line 6)

Error in test_spacy> (line 1)

Error in _call_with_frames_removed (line 228)

Error in exec_module (line 850)

Error in _load_unlocked (line 680)

Error in _find_and_load_unlocked (line 986)

Error in _find_and_load (line 1007)

Error in _gcd_import (line 1030)

Error in __init__>import_module (line 127)
```

The Matlab code is

```
pyenv;
py.importlib.import_module('test_spacy');
path_add = fileparts(which('test_spacy.py'));
if count(py.sys.path, path_add) == 0
insert(py.sys.path, int64(0), path_add);
end
```

test_spacy is the python file name that I have. How can I solve this issue?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.