Hi,
When I try to install Spacy in the Python tool with Alteryx.installPackage('spacy') I get a CalledProcessError.
I'm running Alteryx as administrator since I saw that mentioned in a thread on installing NLTK. However, it's not solving my problem. How do I go about installing SpaCy in the Python tool?
--------------------------------------------------------------------------- CalledProcessError Traceback (most recent call last) <ipython-input-5-996d7f70005a> in <module>() 1 from ayx import Alteryx 2 ----> 3 Alteryx.installPackage('spacy') c:\users\x\appdata\local\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\export.py in installPackage(package, *args, **kwargs) 33 This function will install a package or list of packages into the virtual environment used by the Python tool. If using an admin installation of Alteryx, you must run Alteryx as administrator in order to use this function and install packages. 34 ''' ---> 35 __installPackages__(package, *args, **kwargs) 36 37 # these are the same function. c:\users\x\appdata\local\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\Package.py in installPackages(package, install_type) 64 result = subprocess.check_output( 65 [sys.executable, "-m", "pip"] + pip_args_list, ---> 66 stderr = subprocess.STDOUT 67 ) 68 # print the output ~\AppData\Local\Alteryx\bin\Miniconda3\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs) 334 335 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, --> 336 **kwargs).stdout 337 338 ~\AppData\Local\Alteryx\bin\Miniconda3\lib\subprocess.py in run(input, timeout, check, *popenargs, **kwargs) 416 if check and retcode: 417 raise CalledProcessError(retcode, process.args, --> 418 output=stdout, stderr=stderr) 419 return CompletedProcess(process.args, retcode, stdout, stderr) 420 CalledProcessError: Command '['c:\\users\\x\\appdata\\local\\alteryx\\bin\\miniconda3\\pythontool_venv\\scripts\\python.exe', '-m', 'pip', 'install', 'spacy']' returned non-zero exit status 1.
Solved! Go to Solution.
If you are having trouble installing a Python library using the tool, you can use Elevated Command Prompt.
cd "C:\Program Files\Alteryx\bin\Miniconda3\PythonTool_venv\Scripts" activate pythontool_venv pip install SpaCy
When I try that I get the error Microsoft Visual C++ 14.0 is required even though it is already installed on my laptop. I have Spacy installed with conda on my laptop, but this is a whole folder. Can I just copy it to \PythonTool_venv\Scripts?
Alteryx will not use conda environments and just copy/pasting a folder will probably cause problems. I would try uninstalling and reinstalling Microsoft Visual C++ then reinstalling with pip. My Visual C++ is from my installation of Microsoft Visual Studio 2017. I don't know if that's different from what you have. Also, be sure that you're running Command Prompt as administrator. I ran into an error installing when I ran it non-elevated.
The command prompt installs everything in the anaconda folder instead of C:\Users\x\AppData\Local\Alteryx\bin\Miniconda3\PythonTool_venv\Scripts
Ok fixed the problem. I had to run
pip install -U setuptools
After this together with running command as admin worked like a charm!
Did you activate the environment? In order to use pip to install to a venv, that specific environment must be active. Otherwise it will install to the lowest level Python environment it can find.
Hi,
I was able to install SpaCy successfully. Running the following command,
nlp = spacy.load('en')
throws an error. The following is the error message,
[E050] Can't find model 'en'. It doesn't seem to be a shortcut link,
a Python package or a valid path to a data directory.
I downloaded the spacy ("en") model and it showed this,
Requirement already satisfied: en_core_web_sm==2.0.0
from https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0....
in c:\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages Linking successful c:\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\en_core_web_sm --> c:\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\spacy\data\en You can now load the model via spacy.load('en')
Though it shows the model can loaded, i'm unable to load the model. Can anyone suggest a solution?
This is resolved. I used the following command,
nlp = spacy.load('en_core_web_sm')
Neither load option seems to work for me. Any suggestions?