-
Notifications
You must be signed in to change notification settings - Fork 16
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
No module named spacy. Try: pip install -U spacy #9
Comments
Hi! Can your system access Spacy in Python? Like for example the Python code in https://github.com/d99kris/spacy-cpp#example-usage If yes, I suspect there could be some mismatch between for which Python version Spacy is installed for, and which Python version you are building spacy-cpp for. By default spacy-cpp's CMakeLists.txt uses Python v3.x, so spacy needs to be installed for Python 3 (e.g. using
to
and rebuild (maybe delete If still no success, perhaps you can share more system details such as version of OS, Python, CMake, C++ Compiler. Thanks! |
I believe the above steps should help resolving the issue, so I will proceed to close this issue. Feel free to re-open it for follow-up questions. Thanks! |
I'm getting the same error after building the header only example. I'm running
EDIT: I can successfully reproduce the Python example usage: >>> import spacy
>>> nlp = spacy.load("en_core_web_sm")
>>> doc = nlp(u"This is a sentence.")
>>> for token in doc:
... print(token.text + " [" + token.pos_ + "]")
...
This [PRON]
is [AUX]
a [DET]
sentence [NOUN]
. [PUNCT] EDIT2: Some more info - Cmake: -- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonLibs: /usr/local/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib (found suitable version "3.11.0", minimum required is "3")
-- Found PythonInterp: /Users/ruby/venv11_2/bin/python3 (found suitable version "3.11.1", minimum required is "3")
-- Build tests: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/ruby/Downloads/test/cmake-add-subdirectory-hdr/build Make: [ 7%] Building CXX object CMakeFiles/exprog1.dir/src/exprog1.cpp.o
In file included from /Users/ruby/Downloads/test/cmake-add-subdirectory-hdr/src/exprog1.cpp:5:
In file included from /Users/ruby/Downloads/test/cmake-add-subdirectory-hdr/spacy-cpp/src/spacy/spacy:12:
In file included from /Users/ruby/Downloads/test/cmake-add-subdirectory-hdr/spacy-cpp/src/spacy/attrs.h:72:
In file included from /Users/ruby/Downloads/test/cmake-add-subdirectory-hdr/spacy-cpp/src/spacy/attrs.cpp:13:
In file included from /Users/ruby/Downloads/test/cmake-add-subdirectory-hdr/spacy-cpp/src/spacy/python.h:210:
/Users/ruby/Downloads/test/cmake-add-subdirectory-hdr/spacy-cpp/src/spacy/python.cpp:42:5: warning: 'PySys_SetArgv' is deprecated [-Wdeprecated-declarations]
PySys_SetArgv(0, m_argv.get());
^
/usr/local/Frameworks/Python.framework/Versions/3.11/include/python3.11/sysmodule.h:13:1: note: 'PySys_SetArgv' has been explicitly marked deprecated here
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
^
/usr/local/Frameworks/Python.framework/Versions/3.11/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
1 warning generated.
[ 15%] Linking CXX executable exprog1
[ 15%] Built target exprog1
[ 23%] Building CXX object spacy-cpp/CMakeFiles/spacy.dir/src/spacy/attrs.cpp.o
[ 30%] Building CXX object spacy-cpp/CMakeFiles/spacy.dir/src/spacy/nlp.cpp.o
[ 38%] Building CXX object spacy-cpp/CMakeFiles/spacy.dir/src/spacy/python.cpp.o
/Users/ruby/Downloads/test/cmake-add-subdirectory-hdr/spacy-cpp/src/spacy/python.cpp:42:5: warning: 'PySys_SetArgv' is deprecated [-Wdeprecated-declarations]
PySys_SetArgv(0, m_argv.get());
^
/usr/local/Frameworks/Python.framework/Versions/3.11/include/python3.11/sysmodule.h:13:1: note: 'PySys_SetArgv' has been explicitly marked deprecated here
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **);
^
/usr/local/Frameworks/Python.framework/Versions/3.11/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
1 warning generated.
[ 46%] Building CXX object spacy-cpp/CMakeFiles/spacy.dir/src/spacy/span.cpp.o
[ 53%] Building CXX object spacy-cpp/CMakeFiles/spacy.dir/src/spacy/doc.cpp.o
[ 61%] Building CXX object spacy-cpp/CMakeFiles/spacy.dir/src/spacy/pyobjectptr.cpp.o
[ 69%] Building CXX object spacy-cpp/CMakeFiles/spacy.dir/src/spacy/spacy.cpp.o
[ 76%] Building CXX object spacy-cpp/CMakeFiles/spacy.dir/src/spacy/stringstore.cpp.o
[ 84%] Building CXX object spacy-cpp/CMakeFiles/spacy.dir/src/spacy/token.cpp.o
[ 92%] Building CXX object spacy-cpp/CMakeFiles/spacy.dir/src/spacy/vocab.cpp.o
[100%] Linking CXX shared library libspacy.dylib
[100%] Built target spacy
|
I got this when I want to instantiate a Spacy object. But I'm sure I have installed spacy and I can run
python -m spacy
correctly. Cloud you please provide some possible reasons for this situation?The text was updated successfully, but these errors were encountered: