Open a-mannion opened 4 years ago
/home/mrim/manniona/anaconda3/compiler_compat/ld: cannot find -lpthread /home/mrim/manniona/anaconda3/compiler_compat/ld: cannot find -lc
You seem to be missing libpthread and libc. Try installing them using your Linux distro's package manager.
I've the exact same error and I've no luck with installing these two packages on ubuntu:
Any other packages needed to be installed?
@jk does compilation still not work with those libs installed? Which ubuntu version? Which python version?
@jk does compilation still not work with those libs installed?
@IronFarm Sadly yes, I doesn't work
Which ubuntu version? Which python version?
Ubuntu: 18.04 Python (/usr/bin/python) 2.7.17 and (/opt/conda/bin/python3) 3.7.6
I'm building a Docker Image here, so you can take a look: https://gist.github.com/jk/dbdd67adb4e703f7f6d89587bbcee73a
@jk your anaconda installation is python 3.7 so some of the glove-python files need to be re-compiled.
# Download glove
RUN curl -o glove_python.zip -OL https://github.com/maciejkula/glove-python/archive/master.zip
RUN unzip glove_python.zip
# Re-compile cython code
WORKDIR /glove-python-master
RUN /opt/conda/envs/wiki/bin/cythonize -X language_level=3 -f -i glove/corpus_cython.pyx
RUN /opt/conda/envs/wiki/bin/cythonize -X language_level=3 -f -i glove/glove_cython.pyx
RUN /opt/conda/envs/wiki/bin/cythonize -X language_level=3 -f -i glove/metrics/accuracy_cython.pyx
# Install glove-python
RUN /opt/conda/envs/wiki/bin/pip install .
@IronFarm I really appreciate your quick response. It now works, thanks a lot.
A short remark, if someone else also wants to use this:
I've updated the gist: https://gist.github.com/jk/dbdd67adb4e703f7f6d89587bbcee73a#file-dockerfile-L40-L50
RUN cd /tmp \
&& curl -o glove_python.zip -OL https://github.com/maciejkula/glove-python/archive/master.zip \
&& unzip glove_python.zip \
&& rm -f glove_python.zip \
&& cd glove-python-master \
&& /opt/conda/envs/wiki/bin/cythonize -X language_level=3 -f -i glove/corpus_cython.pyx \
&& /opt/conda/envs/wiki/bin/cythonize -X language_level=3 -f -i glove/glove_cython.pyx \
&& /opt/conda/envs/wiki/bin/cythonize -X language_level=3 -f -i glove/metrics/accuracy_cython.pyx \
&& /opt/conda/envs/wiki/bin/pip install . \
&& cd .. \
&& rm -rf glove-python-master
Better write it like that. It only adds one layer to the docker image and saves some disk space, when removing unnecessary files within the same layer (files can't be removed in following layers).
Glad to have helped and thanks for the mini-docker tutorial in return 😄
I'm trying to install in an Anaconda environment using
anaconda3/bin/pip install glove-python
I installed gcc and Cython viaconda install -c anaconda
and also tried following the steps set out in issue #96 [https://github.com/maciejkula/glove-python/issues/96#issuecomment-499840851]. In this case, runningpython3 setup.py install
ormake
returns the following:`running install running bdist_egg running egg_info writing glove_python.egg-info/PKG-INFO writing dependency_links to glove_python.egg-info/dependency_links.txt writing requirements to glove_python.egg-info/requires.txt writing top-level names to glove_python.egg-info/top_level.txt reading manifest file 'glove_python.egg-info/SOURCES.txt' writing manifest file 'glove_python.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py running build_ext building 'glove.glove_cython' extension gcc -pthread -B /home/mrim/manniona/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/mrim/manniona/anaconda3/include/python3.7m -c glove/glove_cython.c -o build/temp.linux-x86_64-3.7/glove/glove_cython.o -fopenmp -ffast-math -march=native glove/glove_cython.c: In function ‘__pyx_pf_5glove_12glove_cython_fit_vectors._omp_fn.0’: glove/glove_cython.c:2447:29: warning: ‘__pyx_v_word_b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pragma omp for lastprivate(pyx_v_count) lastprivate(pyx_v_entry_weight) lastprivate(pyx_v_gradient) lastprivate(pyx_v_i) firstprivate(pyx_v_j) lastprivate(pyx_v_j) lastprivate(pyx_v_learning_rate) lastprivate(pyx_v_loss) lastprivate(pyx_v_prediction) lastprivate(__pyx_v_shuffle_index) lastprivate(pyx_v_word_a) lastprivate(__pyx_v_word_b) schedule(dynamic)
glove/glove_cython.c:2333:7: note: ‘__pyx_v_word_b’ was declared here int pyx_v_word_b; ^ glove/glove_cython.c:2447:29: warning: ‘pyx_v_word_a’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pragma omp for lastprivate(pyx_v_count) lastprivate(pyx_v_entry_weight) lastprivate(pyx_v_gradient) lastprivate(pyx_v_i) firstprivate(pyx_v_j) lastprivate(pyx_v_j) lastprivate(pyx_v_learning_rate) lastprivate(pyx_v_loss) lastprivate(pyx_v_prediction) lastprivate(__pyx_v_shuffle_index) lastprivate(pyx_v_word_a) lastprivate(__pyx_v_word_b) schedule(dynamic)
glove/glove_cython.c:2332:7: note: ‘__pyx_v_word_a’ was declared here int pyx_v_word_a; ^ glove/glove_cython.c:2447:29: warning: ‘pyx_v_shuffle_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pragma omp for lastprivate(pyx_v_count) lastprivate(pyx_v_entry_weight) lastprivate(pyx_v_gradient) lastprivate(pyx_v_i) firstprivate(pyx_v_j) lastprivate(pyx_v_j) lastprivate(pyx_v_learning_rate) lastprivate(pyx_v_loss) lastprivate(pyx_v_prediction) lastprivate(__pyx_v_shuffle_index) lastprivate(pyx_v_word_a) lastprivate(__pyx_v_word_b) schedule(dynamic)
glove/glove_cython.c:2342:7: note: ‘__pyx_v_shuffle_index’ was declared here int pyx_v_shuffle_index; ^ glove/glove_cython.c:2447:29: warning: ‘pyx_v_prediction’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pragma omp for lastprivate(pyx_v_count) lastprivate(pyx_v_entry_weight) lastprivate(pyx_v_gradient) lastprivate(pyx_v_i) firstprivate(pyx_v_j) lastprivate(pyx_v_j) lastprivate(pyx_v_learning_rate) lastprivate(pyx_v_loss) lastprivate(pyx_v_prediction) lastprivate(__pyx_v_shuffle_index) lastprivate(pyx_v_word_a) lastprivate(__pyx_v_word_b) schedule(dynamic)
glove/glove_cython.c:2337:10: note: ‘pyx_v_prediction’ was declared here double pyx_v_prediction; ^ glove/glove_cython.c:2447:29: warning: ‘__pyx_v_loss’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pragma omp for lastprivate(pyx_v_count) lastprivate(pyx_v_entry_weight) lastprivate(pyx_v_gradient) lastprivate(pyx_v_i) firstprivate(pyx_v_j) lastprivate(pyx_v_j) lastprivate(pyx_v_learning_rate) lastprivate(pyx_v_loss) lastprivate(pyx_v_prediction) lastprivate(__pyx_v_shuffle_index) lastprivate(pyx_v_word_a) lastprivate(__pyx_v_word_b) schedule(dynamic)
glove/glove_cython.c:2339:10: note: ‘pyx_v_loss’ was declared here double pyx_v_loss; ^ glove/glove_cython.c:2447:29: warning: ‘__pyx_v_learning_rate’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pragma omp for lastprivate(pyx_v_count) lastprivate(pyx_v_entry_weight) lastprivate(pyx_v_gradient) lastprivate(pyx_v_i) firstprivate(pyx_v_j) lastprivate(pyx_v_j) lastprivate(pyx_v_learning_rate) lastprivate(pyx_v_loss) lastprivate(pyx_v_prediction) lastprivate(__pyx_v_shuffle_index) lastprivate(pyx_v_word_a) lastprivate(__pyx_v_word_b) schedule(dynamic)
glove/glove_cython.c:2335:10: note: ‘__pyx_v_learning_rate’ was declared here double pyx_v_learning_rate; ^ glove/glove_cython.c:2447:29: warning: ‘pyx_v_i’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pragma omp for lastprivate(pyx_v_count) lastprivate(pyx_v_entry_weight) lastprivate(pyx_v_gradient) lastprivate(pyx_v_i) firstprivate(pyx_v_j) lastprivate(pyx_v_j) lastprivate(pyx_v_learning_rate) lastprivate(pyx_v_loss) lastprivate(pyx_v_prediction) lastprivate(__pyx_v_shuffle_index) lastprivate(pyx_v_word_a) lastprivate(__pyx_v_word_b) schedule(dynamic)
glove/glove_cython.c:2340:7: note: ‘pyx_v_i’ was declared here int pyx_v_i; ^ glove/glove_cython.c:2447:29: warning: ‘__pyx_v_gradient’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pragma omp for lastprivate(pyx_v_count) lastprivate(pyx_v_entry_weight) lastprivate(pyx_v_gradient) lastprivate(pyx_v_i) firstprivate(pyx_v_j) lastprivate(pyx_v_j) lastprivate(pyx_v_learning_rate) lastprivate(pyx_v_loss) lastprivate(pyx_v_prediction) lastprivate(__pyx_v_shuffle_index) lastprivate(pyx_v_word_a) lastprivate(__pyx_v_word_b) schedule(dynamic)
glove/glove_cython.c:2336:10: note: ‘pyx_v_gradient’ was declared here double pyx_v_gradient; ^ glove/glove_cython.c:2447:29: warning: ‘__pyx_v_entry_weight’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pragma omp for lastprivate(pyx_v_count) lastprivate(pyx_v_entry_weight) lastprivate(pyx_v_gradient) lastprivate(pyx_v_i) firstprivate(pyx_v_j) lastprivate(pyx_v_j) lastprivate(pyx_v_learning_rate) lastprivate(pyx_v_loss) lastprivate(pyx_v_prediction) lastprivate(__pyx_v_shuffle_index) lastprivate(pyx_v_word_a) lastprivate(__pyx_v_word_b) schedule(dynamic)
glove/glove_cython.c:2338:10: note: ‘__pyx_v_entry_weight’ was declared here double pyx_v_entry_weight; ^ glove/glove_cython.c:2447:29: warning: ‘pyx_v_count’ may be used uninitialized in this function [-Wmaybe-uninitialized]
pragma omp for lastprivate(pyx_v_count) lastprivate(pyx_v_entry_weight) lastprivate(pyx_v_gradient) lastprivate(pyx_v_i) firstprivate(pyx_v_j) lastprivate(pyx_v_j) lastprivate(pyx_v_learning_rate) lastprivate(pyx_v_loss) lastprivate(pyx_v_prediction) lastprivate(__pyx_v_shuffle_index) lastprivate(pyx_v_word_a) lastprivate(__pyx_v_word_b) schedule(dynamic)
glove/glove_cython.c:2334:10: note: ‘pyx_v_count’ was declared here double pyx_v_count; ^ gcc -pthread -shared -B /home/mrim/manniona/anaconda3/compiler_compat -L/home/mrim/manniona/anaconda3/lib -Wl,-rpath=/home/mrim/manniona/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/glove/glove_cython.o -o build/lib.linux-x86_64-3.7/glove/glove_cython.cpython-37m-x86_64-linux-gnu.so -fopenmp /home/mrim/manniona/anaconda3/compiler_compat/ld: cannot find -lpthread /home/mrim/manniona/anaconda3/compiler_compat/ld: cannot find -lc collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1`
And I still get the following error from
anaconda3/bin/pip install glove-python
:`Collecting glove-python Using cached https://files.pythonhosted.org/packages/3e/79/7e7e548dd9dcb741935d031117f4bed133276c2a047aadad42f1552d1771/glove_python-0.1.0.tar.gz Requirement already satisfied: numpy in ./anaconda3/lib/python3.7/site-packages (from glove-python) (1.17.2) Requirement already satisfied: scipy in ./anaconda3/lib/python3.7/site-packages (from glove-python) (1.3.1) Building wheels for collected packages: glove-python Building wheel for glove-python (setup.py) ... error ERROR: Command errored out with exit status 1: command: /home/mrim/manniona/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xqc8h49a/glove-python/setup.py'"'"'; file='"'"'/tmp/pip-install-xqc8h49a/glove-python/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 /tmp/pip-wheel-fskh814v --python-tag cp37 cwd: /tmp/pip-install-xqc8h49a/glove-python/ Complete output (82 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/glove copying glove/corpus.py -> build/lib.linux-x86_64-3.7/glove copying glove/init.py -> build/lib.linux-x86_64-3.7/glove copying glove/glove.py -> build/lib.linux-x86_64-3.7/glove running build_ext building 'glove.glove_cython' extension creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/glove gcc -pthread -B /home/mrim/manniona/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/mrim/manniona/anaconda3/include/python3.7m -c glove/glove_cython.c -o build/temp.linux-x86_64-3.7/glove/glove_cython.o -fopenmp -ffast-math -march=native glove/glove_cython.c: In function ‘Pyx_ExceptionSave’: glove/glove_cython.c:16753:19: error: ‘PyThreadState’ has no member named ‘exc_type’ type = tstate->exc_type; ^ glove/glove_cython.c:16754:20: error: ‘PyThreadState’ has no member named ‘exc_value’ value = tstate->exc_value; ^ glove/glove_cython.c:16755:17: error: ‘PyThreadState’ has no member named ‘exc_traceback’ *tb = tstate->exc_traceback; ^ glove/glove_cython.c: In function ‘__Pyx_ExceptionReset’: glove/glove_cython.c:16767:22: error: ‘PyThreadState’ has no member named ‘exc_type’ tmp_type = tstate->exc_type; ^ glove/glove_cython.c:16768:23: error: ‘PyThreadState’ has no member named ‘exc_value’ tmp_value = tstate->exc_value; ^ glove/glove_cython.c:16769:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tmp_tb = tstate->exc_traceback; ^ glove/glove_cython.c:16770:11: error: ‘PyThreadState’ has no member named ‘exc_type’ tstate->exc_type = type; ^ glove/glove_cython.c:16771:11: error: ‘PyThreadState’ has no member named ‘exc_value’ tstate->exc_value = value; ^ glove/glove_cython.c:16772:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tstate->exc_traceback = tb; ^ glove/glove_cython.c: In function ‘Pyx_GetException’: glove/glove_cython.c:16815:22: error: ‘PyThreadState’ has no member named ‘exc_type’ tmp_type = tstate->exc_type; ^ glove/glove_cython.c:16816:23: error: ‘PyThreadState’ has no member named ‘exc_value’ tmp_value = tstate->exc_value; ^ glove/glove_cython.c:16817:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tmp_tb = tstate->exc_traceback; ^ glove/glove_cython.c:16818:11: error: ‘PyThreadState’ has no member named ‘exc_type’ tstate->exc_type = local_type; ^ glove/glove_cython.c:16819:11: error: ‘PyThreadState’ has no member named ‘exc_value’ tstate->exc_value = local_value; ^ glove/glove_cython.c:16820:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tstate->exc_traceback = local_tb; ^ glove/glove_cython.c: In function ‘__Pyx_ExceptionSwap’: glove/glove_cython.c:16842:22: error: ‘PyThreadState’ has no member named ‘exc_type’ tmp_type = tstate->exc_type; ^ glove/glove_cython.c:16843:23: error: ‘PyThreadState’ has no member named ‘exc_value’ tmp_value = tstate->exc_value; ^ glove/glove_cython.c:16844:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tmp_tb = tstate->exc_traceback; ^ glove/glove_cython.c:16845:11: error: ‘PyThreadState’ has no member named ‘exc_type’ tstate->exc_type = type; ^ glove/glove_cython.c:16846:11: error: ‘PyThreadState’ has no member named ‘exc_value’ tstate->exc_value = value; ^ glove/glove_cython.c:16847:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tstate->exc_traceback = *tb; ^ error: command 'gcc' failed with exit status 1
ERROR: Failed building wheel for glove-python Running setup.py clean for glove-python ERROR: Command errored out with exit status 1: command: /home/mrim/manniona/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xqc8h49a/glove-python/setup.py'"'"'; file='"'"'/tmp/pip-install-xqc8h49a/glove-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' clean --all cwd: /tmp/pip-install-xqc8h49a/glove-python Complete output (6 lines): usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help
error: option --all not recognized
ERROR: Failed cleaning build dir for glove-python Failed to build glove-python Installing collected packages: glove-python Running setup.py install for glove-python ... error ERROR: Command errored out with exit status 1: command: /home/mrim/manniona/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xqc8h49a/glove-python/setup.py'"'"'; file='"'"'/tmp/pip-install-xqc8h49a/glove-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-orwjmsvp/install-record.txt --single-version-externally-managed --compile cwd: /tmp/pip-install-xqc8h49a/glove-python/ Complete output (74 lines): running install running build running build_py running build_ext building 'glove.glove_cython' extension gcc -pthread -B /home/mrim/manniona/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/mrim/manniona/anaconda3/include/python3.7m -c glove/glove_cython.c -o build/temp.linux-x86_64-3.7/glove/glove_cython.o -fopenmp -ffast-math -march=native glove/glove_cython.c: In function ‘Pyx_ExceptionSave’: glove/glove_cython.c:16753:19: error: ‘PyThreadState’ has no member named ‘exc_type’ type = tstate->exc_type; ^ glove/glove_cython.c:16754:20: error: ‘PyThreadState’ has no member named ‘exc_value’ value = tstate->exc_value; ^ glove/glove_cython.c:16755:17: error: ‘PyThreadState’ has no member named ‘exc_traceback’ *tb = tstate->exc_traceback; ^ glove/glove_cython.c: In function ‘__Pyx_ExceptionReset’: glove/glove_cython.c:16767:22: error: ‘PyThreadState’ has no member named ‘exc_type’ tmp_type = tstate->exc_type; ^ glove/glove_cython.c:16768:23: error: ‘PyThreadState’ has no member named ‘exc_value’ tmp_value = tstate->exc_value; ^ glove/glove_cython.c:16769:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tmp_tb = tstate->exc_traceback; ^ glove/glove_cython.c:16770:11: error: ‘PyThreadState’ has no member named ‘exc_type’ tstate->exc_type = type; ^ glove/glove_cython.c:16771:11: error: ‘PyThreadState’ has no member named ‘exc_value’ tstate->exc_value = value; ^ glove/glove_cython.c:16772:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tstate->exc_traceback = tb; ^ glove/glove_cython.c: In function ‘Pyx_GetException’: glove/glove_cython.c:16815:22: error: ‘PyThreadState’ has no member named ‘exc_type’ tmp_type = tstate->exc_type; ^ glove/glove_cython.c:16816:23: error: ‘PyThreadState’ has no member named ‘exc_value’ tmp_value = tstate->exc_value; ^ glove/glove_cython.c:16817:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tmp_tb = tstate->exc_traceback; ^ glove/glove_cython.c:16818:11: error: ‘PyThreadState’ has no member named ‘exc_type’ tstate->exc_type = local_type; ^ glove/glove_cython.c:16819:11: error: ‘PyThreadState’ has no member named ‘exc_value’ tstate->exc_value = local_value; ^ glove/glove_cython.c:16820:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tstate->exc_traceback = local_tb; ^ glove/glove_cython.c: In function ‘__Pyx_ExceptionSwap’: glove/glove_cython.c:16842:22: error: ‘PyThreadState’ has no member named ‘exc_type’ tmp_type = tstate->exc_type; ^ glove/glove_cython.c:16843:23: error: ‘PyThreadState’ has no member named ‘exc_value’ tmp_value = tstate->exc_value; ^ glove/glove_cython.c:16844:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tmp_tb = tstate->exc_traceback; ^ glove/glove_cython.c:16845:11: error: ‘PyThreadState’ has no member named ‘exc_type’ tstate->exc_type = type; ^ glove/glove_cython.c:16846:11: error: ‘PyThreadState’ has no member named ‘exc_value’ tstate->exc_value = value; ^ glove/glove_cython.c:16847:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’ tstate->exc_traceback = *tb; ^ error: command 'gcc' failed with exit status 1
ERROR: Command errored out with exit status 1: /home/mrim/manniona/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xqc8h49a/glove-python/setup.py'"'"'; file='"'"'/tmp/pip-install-xqc8h49a/glove-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-orwjmsvp/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.`