Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Python Spacy says it is loaded, but I cannot use it.

Hiblet
10 - Fireball

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.

 

 

 

 

2 REPLIES 2
PhilipMannering
16 - Nebula
16 - Nebula

You only need to install once.

 

Once it's installed you can import it,

 

import spacy

And then start using it.

 

Hiblet
10 - Fireball

Darn, I am not a python person, just trying to kludge up a solution, and I missed this bit.  Many thanks @PhilipMannering 

Labels