I am attempting to install the package PyPDF2 and get the below error.
I have anaconda installed on my machine with the package installed in another environment.
Can I run a pip install command from ?
c:\\program files\\alteryx\\bin\\miniconda3\\pythontool_venv\\scripts\\python.exe', '-m', 'pip', 'install', 'PyPDF2'
# List all non-standard packages to be imported by your
# script here (only missing packages will be installed)
from ayx import Package
Package.installPackages(['PyPDF2'])
Installing... (this may take a minute depending on the package size, dependencies, and other factors) Collecting PyPDF2 Downloading https://files.pythonhosted.org/packages/b4/01/68fcc0d43daf4c6bdbc6b33cc3f77bda531c86b174cac56ef0ffdb... (77kB) Installing collected packages: PyPDF2 Running setup.py install for PyPDF2: started Running setup.py install for PyPDF2: finished with status 'error' Complete output from command "c:\program files\alteryx\bin\miniconda3\pythontool_venv\scripts\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\pta67589\\AppData\\Local\\Temp\\6\\pip-build-7g46na7v\\PyPDF2\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\pta67589\AppData\Local\Temp\6\pip-960hoi9i-record\install-record.txt --single-version-externally-managed --compile --install-headers "c:\program files\alteryx\bin\miniconda3\pythontool_venv\include\site\python3.6\PyPDF2": running install running build running build_py creating build creating build\lib creating build\lib\PyPDF2 copying PyPDF2\filters.py -> build\lib\PyPDF2 copying PyPDF2\generic.py -> build\lib\PyPDF2 copying PyPDF2\merger.py -> build\lib\PyPDF2 copying PyPDF2\pagerange.py -> build\lib\PyPDF2 copying PyPDF2\pdf.py -> build\lib\PyPDF2 copying PyPDF2\utils.py -> build\lib\PyPDF2 copying PyPDF2\xmp.py -> build\lib\PyPDF2 copying PyPDF2\_version.py -> build\lib\PyPDF2 copying PyPDF2\__init__.py -> build\lib\PyPDF2 running install_lib creating c:\program files\alteryx\bin\miniconda3\pythontool_venv\Lib\site-packages\PyPDF2 error: could not create 'c:\program files\alteryx\bin\miniconda3\pythontool_venv\Lib\site-packages\PyPDF2': Access is denied ---------------------------------------- Command ""c:\program files\alteryx\bin\miniconda3\pythontool_venv\scripts\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\pta67589\\AppData\\Local\\Temp\\6\\pip-build-7g46na7v\\PyPDF2\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\pta67589\AppData\Local\Temp\6\pip-960hoi9i-record\install-record.txt --single-version-externally-managed --compile --install-headers "c:\program files\alteryx\bin\miniconda3\pythontool_venv\include\site\python3.6\PyPDF2"" failed with error code 1 in C:\Users\pta67589\AppData\Local\Temp\6\pip-build-7g46na7v\PyPDF2\
--------------------------------------------------------------------------- CalledProcessError Traceback (most recent call last) <ipython-input-1-74d64a4e6a9a> in <module> 2 # script here (only missing packages will be installed) 3 from ayx import Package ----> 4 Package.installPackages(['PyPDF2']) c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\Package.py in installPackages(package, install_type, debug) 86 result = subprocess.check_output( 87 [sys.executable, "-m", "pip"] + pip_args_list, ---> 88 stderr = subprocess.STDOUT 89 ) 90 # print the output C:\Program Files\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 C:\Program Files\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:\\program files\\alteryx\\bin\\miniconda3\\pythontool_venv\\scripts\\python.exe', '-m', 'pip', 'install', 'PyPDF2']' returned non-zero exit status 1.
I've encountered something similar before.
Usually, it's just much easier to resolve by using command line tools to install packages outside of Alteryx.
You'll navigate to the same conda path that Alteryx is using and install the same way you would any other conda package.
It may be necessary to run the command line as admin.
Here's a link I found useful for this:
https://stackoverflow.com/questions/22106380/how-do-i-install-pypdf2-module-using-windows
We have been devising some custom solutions that install python packages for virtual environments. If you are trying to install a python package for the Python Tool, there's a trick you can use to install packages without using Designer. Below is a script I wrote for installing packages in the Python Tool (we use this for managing Python packages for Alteryx Server).
"C:\Program Files\Alteryx\bin\Miniconda3\condabin\conda.bat" activate JupyterTool_vEnv & pip install PyPDF2 & deactivate
NOTE: This targets the default Administrator Designer Install path (Program Files\Alteryx). To install packages on a default User install, replace "C:\Progam\Files\Alteryx" with "C:\Users\{user_name}\AppData\Local"
NOTE: If you are using an Admin Designer Install, you will need to open command prompt as an Admin.
What this does:
Activates the Python Tool's virtual environment, pip installs PyPDF2, then deactivates the environment.
Hope this helps!