NicolasHug / Surprise

A Python scikit for building and analyzing recommender systems
http://surpriselib.com
BSD 3-Clause "New" or "Revised" License
6.41k stars 1.02k forks source link

Problem installing Surprise package on Python #115

Closed Jun-Sheng closed 6 years ago

Jun-Sheng commented 6 years ago

Description

Hi, i am running into a problem installing Surprise package on Python. Python version 3.6.3, Spyder 3.2.4

Steps/Code to Reproduce

pip install numpy = ok, pip install scikit-surprise = fails!

Expected Results

Actual Results

This is the logs produced when i ran "pip install scikit-surprise"

Collecting scikit-surprise
  Using cached scikit-surprise-1.0.4.tar.gz
Requirement already satisfied: numpy>=1.11.2 in ./anaconda3/lib/python3.6/site-packages (from scikit-surprise)
Requirement already satisfied: six>=1.10.0 in ./anaconda3/lib/python3.6/site-packages (from scikit-surprise)
Building wheels for collected packages: scikit-surprise
  Running setup.py bdist_wheel for scikit-surprise ... error
  Complete output from command /Users/vinceollie/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/m1/8w11dgh52hvc7n6415sgcq9r0000gn/T/pip-build-g9pdkhik/scikit-surprise/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 /var/folders/m1/8w11dgh52hvc7n6415sgcq9r0000gn/T/tmpo54yf9cppip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.6
  creating build/lib.macosx-10.7-x86_64-3.6/surprise
  copying surprise/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
  copying surprise/dump.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
  copying surprise/dataset.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
  copying surprise/evaluate.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
  copying surprise/accuracy.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
  copying surprise/__main__.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
  creating build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/algo_base.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/knns.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/predictions.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/random_pred.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/baseline_only.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  running egg_info
  writing scikit_surprise.egg-info/PKG-INFO
  writing dependency_links to scikit_surprise.egg-info/dependency_links.txt
  writing entry points to scikit_surprise.egg-info/entry_points.txt
  writing requirements to scikit_surprise.egg-info/requires.txt
  writing top-level names to scikit_surprise.egg-info/top_level.txt
  reading manifest file 'scikit_surprise.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'scikit_surprise.egg-info/SOURCES.txt'
  copying surprise/similarities.c -> build/lib.macosx-10.7-x86_64-3.6/surprise
  copying surprise/similarities.pyx -> build/lib.macosx-10.7-x86_64-3.6/surprise
  copying surprise/prediction_algorithms/co_clustering.c -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/co_clustering.pyx -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/matrix_factorization.c -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/matrix_factorization.pyx -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/optimize_baselines.c -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/optimize_baselines.pyx -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/slope_one.c -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  copying surprise/prediction_algorithms/slope_one.pyx -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
  running build_ext
  building 'surprise.similarities' extension
  creating build/temp.macosx-10.7-x86_64-3.6
  creating build/temp.macosx-10.7-x86_64-3.6/surprise
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/<Users>/anaconda3/include -arch x86_64 -I/Users/<Users>/anaconda3/include -arch x86_64 -I/Users/<Users>/anaconda3/lib/python3.6/site-packages/numpy/core/include -I/Users/<Users>/anaconda3/include/python3.6m -c surprise/similarities.c -o build/temp.macosx-10.7-x86_64-3.6/surprise/similarities.o
  xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  **_Failed building wheel for scikit-surprise_**
  Running setup.py clean for scikit-surprise
Failed to build scikit-surprise
Installing collected packages: scikit-surprise
  Running setup.py install for scikit-surprise ... error
    Complete output from command /Users/vinceollie/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/m1/8w11dgh52hvc7n6415sgcq9r0000gn/T/pip-build-g9pdkhik/scikit-surprise/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/m1/8w11dgh52hvc7n6415sgcq9r0000gn/T/pip-baeyt14b-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.6
    creating build/lib.macosx-10.7-x86_64-3.6/surprise
    copying surprise/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
    copying surprise/dump.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
    copying surprise/dataset.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
    copying surprise/evaluate.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
    copying surprise/accuracy.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
    copying surprise/__main__.py -> build/lib.macosx-10.7-x86_64-3.6/surprise
    creating build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/algo_base.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/knns.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/predictions.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/random_pred.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/baseline_only.py -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    running egg_info
    writing scikit_surprise.egg-info/PKG-INFO
    writing dependency_links to scikit_surprise.egg-info/dependency_links.txt
    writing entry points to scikit_surprise.egg-info/entry_points.txt
    writing requirements to scikit_surprise.egg-info/requires.txt
    writing top-level names to scikit_surprise.egg-info/top_level.txt
    reading manifest file 'scikit_surprise.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'scikit_surprise.egg-info/SOURCES.txt'
    copying surprise/similarities.c -> build/lib.macosx-10.7-x86_64-3.6/surprise
    copying surprise/similarities.pyx -> build/lib.macosx-10.7-x86_64-3.6/surprise
    copying surprise/prediction_algorithms/co_clustering.c -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/co_clustering.pyx -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/matrix_factorization.c -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/matrix_factorization.pyx -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/optimize_baselines.c -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/optimize_baselines.pyx -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/slope_one.c -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    copying surprise/prediction_algorithms/slope_one.pyx -> build/lib.macosx-10.7-x86_64-3.6/surprise/prediction_algorithms
    running build_ext
    building 'surprise.similarities' extension
    creating build/temp.macosx-10.7-x86_64-3.6
    creating build/temp.macosx-10.7-x86_64-3.6/surprise
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/<Users>/anaconda3/include -arch x86_64 -I/Users/<Users>/anaconda3/include -arch x86_64 -I/Users/<Users>/anaconda3/lib/python3.6/site-packages/numpy/core/include -I/Users/<Users>/anaconda3/include/python3.6m -c surprise/similarities.c -o build/temp.macosx-10.7-x86_64-3.6/surprise/similarities.o
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
**_Command "/Users/<username>/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/m1/8w11dgh52hvc7n6415sgcq9r0000gn/T/pip-build-g9pdkhik/scikit-surprise/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/m1/8w11dgh52hvc7n6415sgcq9r0000gn/T/pip-baeyt14b-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/m1/8w11dgh52hvc7n6415sgcq9r0000gn/T/pip-build-g9pdkhik/scikit-surprise/_**

Versions

import platform; print(platform.platform()) Darwin-17.2.0-x86_64-i386-64bit

import sys; print("Python", sys.version) Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 6 2017, 12:04:38) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]

import surprise; print("surprise", surprise.version) Traceback (most recent call last):

File "", line 1, in import surprise; print("surprise", surprise.version)

ModuleNotFoundError: No module named 'surprise'

NicolasHug commented 6 years ago

Hi, It looks like you don't have a C compiler. You need to install gcc.

Jun-Sheng commented 6 years ago

Hi @NicolasHug,

You are spot on! It installed successfully after installing C complier. Thanks!

Link to installing gcc --> https://www.mkyong.com/mac/how-to-install-gcc-compiler-on-mac-os-x/

Collecting scikit-surprise Using cached scikit-surprise-1.0.4.tar.gz Requirement already satisfied: numpy>=1.11.2 in ./anaconda3/lib/python3.6/site-packages (from scikit-surprise) Requirement already satisfied: six>=1.10.0 in ./anaconda3/lib/python3.6/site-packages (from scikit-surprise) Building wheels for collected packages: scikit-surprise Running setup.py bdist_wheel for scikit-surprise ... done Stored in directory: /Users//Library/Caches/pip/wheels/72/f4/52/a74e2689f98bed7029e2b3da4ade72024ba0f1975a990e283c Successfully built scikit-surprise Installing collected packages: scikit-surprise Successfully installed scikit-surprise-1.0.4