Python Spacy says it is loaded, but I cannot use it.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I am trying to install spacy, but I cannot access it by name.
I have used...
from ayx import Alteryx
from ayx import Package
Alteryx.installPackages(package="pandas",install_type="install --user --no-warn-script-location")
Alteryx.installPackages(package="spacy",install_type="install --user --no-warn-script-location")
then
!python -m spacy download en_core_web_sm
...and this returns...
[+] Download and installation successful
You can now load the package via spacy.load('en_core_web_sm')
...but when I try to use spacy, in this line...
nlp = spacy.load('en_core_web_sm')
...I get an error message about not being able to resolve the name spacy...
3
4 # Load the pre-trained model for English language
----> 5 nlp = spacy.load('en_core_web_sm')
6
7 # Define the text you want to extract named entities from
NameError: name 'spacy' is not defined
Can anyone tell me what I am doing wrong, please? I get positive feedback about the library being loaded, but cannot access it.
Solved! Go to Solution.
- Labels:
- Python
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You only need to install once.
Once it's installed you can import it,
import spacy
And then start using it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Darn, I am not a python person, just trying to kludge up a solution, and I missed this bit. Many thanks @PhilipMannering
