community
cancel
Showing results for 
Search instead for 
Did you mean: 

Dev Space

Customize & extend the power of Alteryx. SDKs, APIs, custom tools, and more!
SOLVED

Error Installing implicit python package

Highlighted

I have installed C++ Build tools, I can import implicit package on jupyter notebook but not within Alteryx.

Please help me with this

 

from ayx import Alteryx
Alteryx.installPackages('implicit')

 

Installing... 
(this may take a minute depending on the package size, dependencies, and other factors)
Collecting implicit
  Using cached https://files.pythonhosted.org/packages/2e/d3/162237c5b41bef34faf5fce513535bc84808113dd3b2497c243722...
Requirement already satisfied: numpy in c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages (from implicit)
Requirement already satisfied: scipy>=0.16 in c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages (from implicit)
Requirement already satisfied: tqdm in c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages (from implicit)
Building wheels for collected packages: implicit
  Running setup.py bdist_wheel for implicit: started
  Running setup.py bdist_wheel for implicit: 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\\Divya\\AppData\\Local\\Temp\\pip-build-xw_r4hk7\\implicit\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\Divya\AppData\Local\Temp\tmpoykds8fopip-wheel- --python-tag cp36:
  WARNING:root:The nvcc binary could not be located in your $PATH. Either add it to your path, or set $CUDAHOME to enable CUDA extensions
  Failed to find CUDA toolkit. Building without GPU acceleration.
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\implicit
  copying implicit\als.py -> build\lib.win-amd64-3.6\implicit
  copying implicit\approximate_als.py -> build\lib.win-amd64-3.6\implicit
  copying implicit\nearest_neighbours.py -> build\lib.win-amd64-3.6\implicit
  copying implicit\recommender_base.py -> build\lib.win-amd64-3.6\implicit
  copying implicit\utils.py -> build\lib.win-amd64-3.6\implicit
  copying implicit\__init__.py -> build\lib.win-amd64-3.6\implicit
  creating build\lib.win-amd64-3.6\implicit\cuda
  copying implicit\cuda\__init__.py -> build\lib.win-amd64-3.6\implicit\cuda
  creating build\lib.win-amd64-3.6\implicit\datasets
  copying implicit\datasets\lastfm.py -> build\lib.win-amd64-3.6\implicit\datasets
  copying implicit\datasets\million_song_dataset.py -> build\lib.win-amd64-3.6\implicit\datasets
  copying implicit\datasets\movielens.py -> build\lib.win-amd64-3.6\implicit\datasets
  copying implicit\datasets\reddit.py -> build\lib.win-amd64-3.6\implicit\datasets
  copying implicit\datasets\sketchfab.py -> build\lib.win-amd64-3.6\implicit\datasets
  copying implicit\datasets\_download.py -> build\lib.win-amd64-3.6\implicit\datasets
  copying implicit\datasets\__init__.py -> build\lib.win-amd64-3.6\implicit\datasets
  running build_ext
  building 'implicit._als' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
  
  ----------------------------------------
  Failed building wheel for implicit
  Running setup.py clean for implicit
Failed to build implicit
Installing collected packages: implicit
  Running setup.py install for implicit: started
    Running setup.py install for implicit: 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\\Divya\\AppData\\Local\\Temp\\pip-build-xw_r4hk7\\implicit\\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\Divya\AppData\Local\Temp\pip-8mnexm25-record\install-record.txt --single-version-externally-managed --compile --install-headers "c:\program files\alteryx\bin\miniconda3\pythontool_venv\include\site\python3.6\implicit":
    WARNING:root:The nvcc binary could not be located in your $PATH. Either add it to your path, or set $CUDAHOME to enable CUDA extensions
    Failed to find CUDA toolkit. Building without GPU acceleration.
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\implicit
    copying implicit\als.py -> build\lib.win-amd64-3.6\implicit
    copying implicit\approximate_als.py -> build\lib.win-amd64-3.6\implicit
    copying implicit\nearest_neighbours.py -> build\lib.win-amd64-3.6\implicit
    copying implicit\recommender_base.py -> build\lib.win-amd64-3.6\implicit
    copying implicit\utils.py -> build\lib.win-amd64-3.6\implicit
    copying implicit\__init__.py -> build\lib.win-amd64-3.6\implicit
    creating build\lib.win-amd64-3.6\implicit\cuda
    copying implicit\cuda\__init__.py -> build\lib.win-amd64-3.6\implicit\cuda
    creating build\lib.win-amd64-3.6\implicit\datasets
    copying implicit\datasets\lastfm.py -> build\lib.win-amd64-3.6\implicit\datasets
    copying implicit\datasets\million_song_dataset.py -> build\lib.win-amd64-3.6\implicit\datasets
    copying implicit\datasets\movielens.py -> build\lib.win-amd64-3.6\implicit\datasets
    copying implicit\datasets\reddit.py -> build\lib.win-amd64-3.6\implicit\datasets
    copying implicit\datasets\sketchfab.py -> build\lib.win-amd64-3.6\implicit\datasets
    copying implicit\datasets\_download.py -> build\lib.win-amd64-3.6\implicit\datasets
    copying implicit\datasets\__init__.py -> build\lib.win-amd64-3.6\implicit\datasets
    running build_ext
    building 'implicit._als' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    
    ----------------------------------------
Command ""c:\program files\alteryx\bin\miniconda3\pythontool_venv\scripts\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\Divya\\AppData\\Local\\Temp\\pip-build-xw_r4hk7\\implicit\\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\Divya\AppData\Local\Temp\pip-8mnexm25-record\install-record.txt --single-version-externally-managed --compile --install-headers "c:\program files\alteryx\bin\miniconda3\pythontool_venv\include\site\python3.6\implicit"" failed with error code 1 in C:\Users\Divya\AppData\Local\Temp\pip-build-xw_r4hk7\implicit\
You are using pip version 9.0.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

 
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
<ipython-input-1-e318d900b809> in <module>
      1 from ayx import Alteryx
----> 2 Alteryx.installPackages('implicit')
      3 

c:\program files\alteryx\bin\miniconda3\pythontool_venv\lib\site-packages\ayx\export.py in installPackage(package, install_type, debug, **kwargs)
     96     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.
     97     '''
---> 98     __installPackages__(package, install_type=install_type, debug=debug, **kwargs)
     99 
    100 # these are the same function.

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', 'implicit']' returned non-zero exit status 1.
Community Content Engineer
Community Content Engineer

Hi @divyashree,

 

The Alteryx Python tool runs a Python virtual environment separate from what you have installed on your computer. Based on these error messages, It looks like this installation is failing because the Microsoft Visual C++ Build Tools are not being recognized by your virtual environment.

 

It looks like a user was encountering a similar issue in this thread.

 

Can you also please confirm you have an Environment Variable set up for Microsoft Visual Studio on your machine? I was able to successfully install implicit from the Python tool in Alteryx (running Alteryx as an administrator). When I checked my Environment Variables, I did see a system variable pointing to Microsoft Visual Studio:

2019-03-21_8-21-14.png

 

If you do not have a system variable for your installation of the C++ Build tools, can you please add one that points to the installation location on your machine, and try installing the implicit package from the Python tool once again, making sure to run Alteryx Designer as an administrator (Right-click Designer Icon > Run as an Administrator).

 

Please let me know if this works, or what error messages you see if it does not.

 

Thanks!

 

Sydney

Thank you very much Sydney.

You were right in pointing out, I didn't have my PATH variable set.

Once i set it i got an error : command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158

I resolved it using a stackoverflow fix

  1. Add this to your PATH environment variables:

    C:\Program Files (x86)\Windows Kits\10\bin\x64

  2. Copy these files rc.exe & rcdll.dll from C:\Program Files (x86)\Windows Kits\8.1\bin\x86to C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin

Thank you for the support.