ntucllab / libact

Pool-based active learning in Python
http://libact.readthedocs.org/
BSD 2-Clause "Simplified" License
778 stars 174 forks source link

Can't install libact correctly on Ubuntu16.04 #156

Closed serend1p1ty closed 5 years ago

serend1p1ty commented 5 years ago

Hello, I am sorry to disturb you. Some strange errors occurred when I tried to install libact. I promise what I have done is exactly same as what the README docs instructs. My steps are following:

  1. pip install -r requirements.txt
  2. sudo apt-get install build-essential gfortran libatlas-base-dev liblapacke-dev python3-dev
  3. python setup.py build

Then I met some errors like this.

ppnman@ubuntu:~/Desktop/libact$ python3 setup.py build
Platform Detection: Linux. Link to liblapacke...
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/libact
copying libact/__init__.py -> build/lib.linux-x86_64-3.5/libact
creating build/lib.linux-x86_64-3.5/libact/base
copying libact/base/interfaces.py -> build/lib.linux-x86_64-3.5/libact/base
copying libact/base/__init__.py -> build/lib.linux-x86_64-3.5/libact/base
copying libact/base/dataset.py -> build/lib.linux-x86_64-3.5/libact/base
creating build/lib.linux-x86_64-3.5/libact/models
copying libact/models/__init__.py -> build/lib.linux-x86_64-3.5/libact/models
copying libact/models/logistic_regression.py -> build/lib.linux-x86_64-3.5/libact/models
copying libact/models/sklearn_adapter.py -> build/lib.linux-x86_64-3.5/libact/models
copying libact/models/perceptron.py -> build/lib.linux-x86_64-3.5/libact/models
copying libact/models/svm.py -> build/lib.linux-x86_64-3.5/libact/models
creating build/lib.linux-x86_64-3.5/libact/models/multilabel
copying libact/models/multilabel/__init__.py -> build/lib.linux-x86_64-3.5/libact/models/multilabel
copying libact/models/multilabel/binary_relevance.py -> build/lib.linux-x86_64-3.5/libact/models/multilabel
copying libact/models/multilabel/dummy_clf.py -> build/lib.linux-x86_64-3.5/libact/models/multilabel
creating build/lib.linux-x86_64-3.5/libact/labelers
copying libact/labelers/interactive_labeler.py -> build/lib.linux-x86_64-3.5/libact/labelers
copying libact/labelers/__init__.py -> build/lib.linux-x86_64-3.5/libact/labelers
copying libact/labelers/ideal_labeler.py -> build/lib.linux-x86_64-3.5/libact/labelers
creating build/lib.linux-x86_64-3.5/libact/query_strategies
copying libact/query_strategies/active_learning_by_learning.py -> build/lib.linux-x86_64-3.5/libact/query_strategies
copying libact/query_strategies/variance_reduction.py -> build/lib.linux-x86_64-3.5/libact/query_strategies
copying libact/query_strategies/__init__.py -> build/lib.linux-x86_64-3.5/libact/query_strategies
copying libact/query_strategies/uncertainty_sampling.py -> build/lib.linux-x86_64-3.5/libact/query_strategies
copying libact/query_strategies/random_sampling.py -> build/lib.linux-x86_64-3.5/libact/query_strategies
copying libact/query_strategies/hintsvm.py -> build/lib.linux-x86_64-3.5/libact/query_strategies
copying libact/query_strategies/quire.py -> build/lib.linux-x86_64-3.5/libact/query_strategies
copying libact/query_strategies/query_by_committee.py -> build/lib.linux-x86_64-3.5/libact/query_strategies
copying libact/query_strategies/density_weighted_uncertainty_sampling.py -> build/lib.linux-x86_64-3.5/libact/query_strategies
creating build/lib.linux-x86_64-3.5/libact/query_strategies/multilabel
copying libact/query_strategies/multilabel/binary_minimization.py -> build/lib.linux-x86_64-3.5/libact/query_strategies/multilabel
copying libact/query_strategies/multilabel/multilabel_with_auxiliary_learner.py -> build/lib.linux-x86_64-3.5/libact/query_strategies/multilabel
copying libact/query_strategies/multilabel/__init__.py -> build/lib.linux-x86_64-3.5/libact/query_strategies/multilabel
copying libact/query_strategies/multilabel/maximum_margin_reduction.py -> build/lib.linux-x86_64-3.5/libact/query_strategies/multilabel
copying libact/query_strategies/multilabel/adaptive_active_learning.py -> build/lib.linux-x86_64-3.5/libact/query_strategies/multilabel
creating build/lib.linux-x86_64-3.5/libact/query_strategies/multiclass
copying libact/query_strategies/multiclass/hierarchical_sampling.py -> build/lib.linux-x86_64-3.5/libact/query_strategies/multiclass
copying libact/query_strategies/multiclass/__init__.py -> build/lib.linux-x86_64-3.5/libact/query_strategies/multiclass
copying libact/query_strategies/multiclass/expected_error_reduction.py -> build/lib.linux-x86_64-3.5/libact/query_strategies/multiclass
copying libact/query_strategies/multiclass/mdsp.py -> build/lib.linux-x86_64-3.5/libact/query_strategies/multiclass
copying libact/query_strategies/multiclass/active_learning_with_cost_embedding.py -> build/lib.linux-x86_64-3.5/libact/query_strategies/multiclass
creating build/lib.linux-x86_64-3.5/libact/utils
copying libact/utils/__init__.py -> build/lib.linux-x86_64-3.5/libact/utils
running build_ext
building 'libact.query_strategies._variance_reduction' extension
Warning: Can't read registry to find the necessary compiler setting
Make sure that Python modules winreg, win32api or win32con are installed.
C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/libact
creating build/temp.linux-x86_64-3.5/libact/query_strategies
creating build/temp.linux-x86_64-3.5/libact/query_strategies/src
creating build/temp.linux-x86_64-3.5/libact/query_strategies/src/variance_reduction
compile options: '-I/home/ppnman/.local/lib/python3.5/site-packages/numpy/core/include -I/usr/include/lapacke -I/usr/include/python3.5m -c'
extra options: '-std=c11'
x86_64-linux-gnu-gcc: libact/query_strategies/src/variance_reduction/variance_reduction.c
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/libact/query_strategies/src/variance_reduction/variance_reduction.o -o build/lib.linux-x86_64-3.5/libact/query_strategies/_variance_reduction.cpython-35m-x86_64-linux-gnu.so -llapacke -llapack -lblas
/usr/bin/ld: cannot find -llapacke -llapack -lblas
collect2: error: ld returned 1 exit status
error: Command "x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/libact/query_strategies/src/variance_reduction/variance_reduction.o -o build/lib.linux-x86_64-3.5/libact/query_strategies/_variance_reduction.cpython-35m-x86_64-linux-gnu.so -llapacke -llapack -lblas" failed with exit status 1

The following is the error message. error: Command "x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/libact/query_strategies/src/variance_reduction/variance_reduction.o -o build/lib.linux-x86_64-3.5/libact/query_strategies/_variance_reduction.cpython-35m-x86_64-linux-gnu.so -llapacke -llapack -lblas" failed with exit status 1

I haven't found solution in issues, can anyone help me? I will be very grateful!

serend1p1ty commented 5 years ago

Finally, I solve the problem. The solution is so strange: run the command x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/libact/query_strategies/src/variance_reduction/variance_reduction.o -o build/lib.linux-x86_64-3.5/libact/query_strategies/_variance_reduction.cpython-35m-x86_64-linux-gnu.so -llapacke -llapack -lblas in terminal, then run python3 setup.py build again. I guess there is some errors in setup.py.

pbruneau commented 5 years ago

If I may addup to this closed issue, Here is a 1-line fix to this issue: 0f6f38ee7eab44774f13cd2ce1d14bf8c203207b In a rush I just quickly forked and updated, if the repo owner wants I may issue a proper PR.

hsuantien commented 5 years ago

If I may addup to this closed issue, Here is a 1-line fix to this issue: 0f6f38e In a rush I just quickly forked and updated, if the repo owner wants I may issue a proper PR.

PR is very welcomed, please!! Thanks.

hsuantien commented 1 month ago

In the latest setup.py the issue has been fixed. Thanks.