david-cortes / stochQN

(Python, Tensorflow, R, C, C++) Stochastic, limited-memory quasi-Newton optimizers (adaQN, SQN, oLBFGS)
BSD 2-Clause "Simplified" License
12 stars 7 forks source link

Not able to install stochqn #2

Closed Ricbrag closed 4 years ago

Ricbrag commented 4 years ago

After downloading and unzipping the repository I moved to the stochQN-master directory and executed the command: pip install stochqn

Then I got the following errors:

(base) bash-4.2$ pip install stochqn
Collecting stochqn
  Using cached stochqn-0.2.8.tar.gz (34 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: cython in /home/student/ricardo/anaconda3/lib/python3.7/site-packages (from stochqn) (0.29.12)
Requirement already satisfied: scikit-learn in /home/student/ricardo/anaconda3/lib/python3.7/site-packages (from stochqn) (0.21.2)
Requirement already satisfied: scipy in /home/student/ricardo/anaconda3/lib/python3.7/site-packages (from stochqn) (1.3.0)
Requirement already satisfied: numpy in /home/student/ricardo/anaconda3/lib/python3.7/site-packages (from stochqn) (1.16.4)
Requirement already satisfied: findblas in /home/student/ricardo/anaconda3/lib/python3.7/site-packages (from stochqn) (0.1.15)
Requirement already satisfied: joblib>=0.11 in /home/student/ricardo/anaconda3/lib/python3.7/site-packages (from scikit-learn->stochqn) (0.13.2)
Building wheels for collected packages: stochqn
  Building wheel for stochqn (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/student/ricardo/anaconda3/bin/python /home/student/ricardo/anaconda3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp2scxx9ou
       cwd: /tmp/pip-install-5e7zgkyt/stochqn
  Complete output (73 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/stochqn
  copying stochqn/__init__.py -> build/lib.linux-x86_64-3.7/stochqn
  copying stochqn/_logistic.py -> build/lib.linux-x86_64-3.7/stochqn
  copying stochqn/_optimizers.py -> build/lib.linux-x86_64-3.7/stochqn
  copying stochqn/tf.py -> build/lib.linux-x86_64-3.7/stochqn
  running build_ext
  /home/student/ricardo/anaconda3/compiler_compat/ld: /tmp/tmpqkv31uo0/tmp/tmpqkv31uo0/source.o: in function `main':
  /tmp/tmpqkv31uo0/source.c:6: undefined reference to `cblas_ddot'
  collect2: error: ld returned 1 exit status
  /home/student/ricardo/anaconda3/compiler_compat/ld: /tmp/tmpndsl1q18/tmp/tmpndsl1q18/source.o: in function `main':
  /tmp/tmpndsl1q18/source.c:6: undefined reference to `cblas_ddot'
  collect2: error: ld returned 1 exit status
  Installation: Using BLAS library found in:
  /home/student/ricardo/anaconda3/lib/libmkl_rt.so

  cythoning stochqn/wrapper_double.pyx to stochqn/wrapper_double.c
  cythoning stochqn/wrapper_float.pyx to stochqn/wrapper_float.c
  building 'stochqn._wrapper_double' extension
  C compiler: gcc -pthread -B /home/student/ricardo/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC

  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/stochqn
  creating build/temp.linux-x86_64-3.7/src
  compile options: '-DUSE_DOUBLE -D_FOR_PYTON -DHAS_MKL -DNO_CBLAS_HEADER -I/tmp/pip-build-env-pi5xgh6u/overlay/lib/python3.7/site-packages/numpy/core/include -Iinclude -I/tmp/pip-build-env-pi5xgh6u/overlay/lib/python3.7/site-packages/findblas/ -I/home/student/ricardo/anaconda3/include/python3.7m -c'
  extra options: '-O2 -fopenmp -march=native -std=c99'
  gcc: stochqn/wrapper_double.c
  gcc: src/stochqn.c
  stochqn/wrapper_double.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
   #error Do not use this file, it is the result of a failed Cython compilation.
:x
    ^
  /tmp/pip-build-env-pi5xgh6u/overlay/lib/python3.7/site-packages/findblas/distutils.py:131: UserWarning: No CBLAS headers were found - function propotypes might be unreliable.
    warnings.warn(warning_msg)
  /tmp/pip-build-env-pi5xgh6u/overlay/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-5e7zgkyt/stochqn/stochqn/wrapper_double.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np

  ctypedef double real_t
  ctypedef np.float64_t np_real_t
  np_real_t_obj = np.float64
  include "pywrapper.pxi"
  ^
  ------------------------------------------------------------

  stochqn/wrapper_double.pyx:7:0: 'pywrapper.pxi' not found

  /tmp/pip-build-env-pi5xgh6u/overlay/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-5e7zgkyt/stochqn/stochqn/wrapper_float.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cimport numpy as np

  ctypedef float real_t
  ctypedef np.float32_t np_real_t
  np_real_t_obj = np.float32
  include "pywrapper.pxi"
  ^
  ------------------------------------------------------------

  stochqn/wrapper_float.pyx:7:0: 'pywrapper.pxi' not found

  error: Command "gcc -pthread -B /home/student/ricardo/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_DOUBLE -D_FOR_PYTON -DHAS_MKL -DNO_CBLAS_HEADER -I/tmp/pip-build-env-pi5xgh6u/overlay/lib/python3.7/site-packages/numpy/core/include -Iinclude -I/tmp/pip-build-env-pi5xgh6u/overlay/lib/python3.7/site-packages/findblas/ -I/home/student/ricardo/anaconda3/include/python3.7m -c stochqn/wrapper_double.c -o build/temp.linux-x86_64-3.7/stochqn/wrapper_double.o -O2 -fopenmp -march=native -std=c99" failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for stochqn
Failed to build stochqn
ERROR: Could not build wheels for stochqn which use PEP 517 and cannot be installed directly

Doing: python setup.py build_ext --inplace --force I got the following messages:

(base) bash-4.2$ python setup.py build_ext --inplace --force
running build_ext
/home/student/ricardo/anaconda3/compiler_compat/ld: cannot find -lcblas
collect2: error: ld returned 1 exit status
/home/student/ricardo/anaconda3/compiler_compat/ld: cannot find -lcblas
collect2: error: ld returned 1 exit status
Installation: Using BLAS library found in:
/home/student/ricardo/anaconda3/lib/libmkl_rt.so

/home/student/ricardo/anaconda3/lib/python3.7/site-packages/findblas/distutils.py:131: UserWarning: No CBLAS headers were found - function propotypes might be unreliable.
  warnings.warn(warning_msg)
cythoning stochqn/wrapper_double.pyx to stochqn/wrapper_double.c
/home/student/ricardo/anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/student/ricardo/stochQN-master/stochqn/wrapper_double.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
building 'stochqn._wrapper_double' extension
C compiler: gcc -pthread -B /home/student/ricardo/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC

creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/stochqn
creating build/temp.linux-x86_64-3.7/src
compile options: '-DUSE_DOUBLE -D_FOR_PYTON -DHAS_MKL -DNO_CBLAS_HEADER -I/home/student/ricardo/anaconda3/lib/python3.7/site-packages/numpy/core/include -Iinclude -I/home/student/ricardo/anaconda3/lib/python3.7/site-packages/findblas/ -I/home/student/ricardo/anaconda3/include/python3.7m -c'
extra options: '-O2 -fopenmp -march=native -std=c99'
gcc: stochqn/wrapper_double.c
gcc: src/stochqn.c
In file included from /home/student/ricardo/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:0,
                 from /home/student/ricardo/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                 from /home/student/ricardo/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from stochqn/wrapper_double.c:598:
/home/student/ricardo/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it with " \
  ^
gcc -pthread -shared -B /home/student/ricardo/anaconda3/compiler_compat -L/home/student/ricardo/anaconda3/lib -Wl,-rpath=/home/student/ricardo/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/stochqn/wrapper_double.o build/temp.linux-x86_64-3.7/src/stochqn.o -o /home/student/ricardo/stochQN-master/stochqn/_wrapper_double.cpython-37m-x86_64-linux-gnu.so -fopenmp -L/home/student/ricardo/anaconda3/lib -l:libmkl_rt.so -Wl,-rpath=/home/student/ricardo/anaconda3/lib
cythoning stochqn/wrapper_float.pyx to stochqn/wrapper_float.c
/home/student/ricardo/anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/student/ricardo/stochQN-master/stochqn/wrapper_float.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
building 'stochqn._wrapper_float' extension
C compiler: gcc -pthread -B /home/student/ricardo/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC

compile options: '-DUSE_FLOAT -D_FOR_PYTON -DHAS_MKL -DNO_CBLAS_HEADER -I/home/student/ricardo/anaconda3/lib/python3.7/site-packages/numpy/core/include -Iinclude -I/home/student/ricardo/anaconda3/lib/python3.7/site-packages/findblas/ -I/home/student/ricardo/anaconda3/include/python3.7m -c'
extra options: '-O2 -fopenmp -march=native -std=c99'
gcc: src/stochqn.c
gcc: stochqn/wrapper_float.c
In file included from /home/student/ricardo/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:0,
                 from /home/student/ricardo/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                 from /home/student/ricardo/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from stochqn/wrapper_float.c:598:
/home/student/ricardo/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it with " \
  ^
gcc -pthread -shared -B /home/student/ricardo/anaconda3/compiler_compat -L/home/student/ricardo/anaconda3/lib -Wl,-rpath=/home/student/ricardo/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/stochqn/wrapper_float.o build/temp.linux-x86_64-3.7/src/stochqn.o -o /home/student/ricardo/stochQN-master/stochqn/_wrapper_float.cpython-37m-x86_64-linux-gnu.so -fopenmp -L/home/student/ricardo/anaconda3/lib -l:libmkl_rt.so -Wl,-rpath=/home/student/ricardo/anaconda3/lib
david-cortes commented 4 years ago

Thanks for the bug report. Turns out I forgot to include the newly-added .pxi file to the source package, which I've added now. Please try again (use pip install --no-cache stochqn) and reopen the issue if you still get errors.