Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation errors using Python 3.6 #24

Open
jdchoi77 opened this issue Nov 2, 2017 · 7 comments
Open

Installation errors using Python 3.6 #24

jdchoi77 opened this issue Nov 2, 2017 · 7 comments

Comments

@jdchoi77
Copy link

jdchoi77 commented Nov 2, 2017

When I tried to install pyfasttext using Python 3.6 on mac and I got a long error message; the followings show the last part of the message:

#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
    #warning "Using deprecated NumPy API, disable it by " \
     ^
    src/pyfasttext.cpp:611:10: fatal error: 'random' file not found
    #include <random>
             ^
    1 warning and 1 error generated.
    error: command '/usr/bin/clang' failed with exit status 1
    
    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/tj/1t7l0fv12j58y38pp7vxhg1h0000gn/T/pip-build-_sl6i23f/pyfasttext/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/tj/1t7l0fv12j58y38pp7vxhg1h0000gn/T/pip-6pwc52pz-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/tj/1t7l0fv12j58y38pp7vxhg1h0000gn/T/pip-build-_sl6i23f/pyfasttext/

It seems like the error is caused by importing random (also give the warning for using the depreciated numpy API). Any hint? Thanks!

@GeorgesAlkhouri
Copy link

The pre installed gcc on Mac OS did not work for me too.
So first you need a more up-to-date gcc compiler.

You can install one with brew:

brew install gcc

after that you have to tell pip which compiler to use by setting a flag:

CC=/usr/local/bin/gcc-7 pip install --no-cache pyfasttext

The path /usr/local/bin/gcc-7 may has to be adjusted.

@ageitgey
Copy link

The solution from @GeorgesAlkhouri almost worked for me, but I also had to specify the C++ compiler path.

This worked:

brew install gcc
# and if needed, 'brew upgrade gcc' to get gcc-7.2

CXX=/usr/local/bin/g++-7 CC=/usr/local/bin/g++-7 pip3 install --no-cache pyfasttext

@aditiprakash
Copy link

aditiprakash commented Dec 11, 2017

Had errors with cysignals

$ pip install cysignals
Collecting cysignals
Using cached cysignals-1.6.5.tar.bz2
Building wheels for collected packages: cysignals
Running setup.py bdist_wheel for cysignals ... error
Complete output from command /home/et/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-16kxaadc/cysignals/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/tmpto7xm3lcpip-wheel- --python-tag cp36:
/tmp/pip-build-16kxaadc/cysignals/setup.py:195: ResourceWarning: unclosed file <_io.TextIOWrapper name='VERSION' mode='r' encoding='UTF-8'>
version=open("VERSION").read().strip(),
/tmp/pip-build-16kxaadc/cysignals/setup.py:199: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'>
long_description=open('README.rst').read(),
/home/et/anaconda3/lib/python3.6/importlib/_bootstrap_external.py:426: ImportWarning: Not importing directory /home/et/anaconda3/lib/python3.6/site-packages/virtualenvwrapper: missing init
_warnings.warn(msg.format(portions[0]), ImportWarning)
running bdist_wheel
running build
make: 'configure' is up to date.
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for library containing pari_init... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking execinfo.h usability... yes
checking execinfo.h presence... yes
checking for execinfo.h... yes
checking sys/prctl.h usability... yes
checking sys/prctl.h presence... yes
checking for sys/prctl.h... yes
checking for backtrace... yes
checking whether PARI_SIGINT_block is declared... no
checking for emms instruction... yes
configure: creating ./config.status
config.status: creating build/src/config.h
config.status: creating build/src/cysignals/debug.h
config.status: executing build/src/cysignals/init.pxd commands
generating build/lib.linux-x86_64-3.6/cysignals/init.pxd
Compiling src/cysignals/signals.pyx because it changed.
Compiling src/cysignals/pysignals.pyx because it changed.
Compiling src/cysignals/alarm.pyx because it changed.
Compiling src/cysignals/pselect.pyx because it changed.
Compiling src/cysignals/tests.pyx because it changed.
[1/5] Cythonizing src/cysignals/alarm.pyx
[2/5] Cythonizing src/cysignals/pselect.pyx
[3/5] Cythonizing src/cysignals/pysignals.pyx
[4/5] Cythonizing src/cysignals/signals.pyx
[5/5] Cythonizing src/cysignals/tests.pyx
running build_py
copying src/cysignals/init.py -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/memory.pxi -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/signals.pxi -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/pysignals.pxd -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/memory.pxd -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/signals.pxd -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/pxi_warning.h -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/macros.h -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/struct_signals.h -> build/lib.linux-x86_64-3.6/cysignals
copying build/src/cysignals/signals.h -> build/lib.linux-x86_64-3.6/cysignals
copying build/src/cysignals/debug.h -> build/lib.linux-x86_64-3.6/cysignals
running build_ext
building 'cysignals.signals' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/build
creating build/temp.linux-x86_64-3.6/build/src
creating build/temp.linux-x86_64-3.6/build/src/cysignals
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc/cysignals -Ibuild/src -Ibuild/src/cysignals -I/home/et/anaconda3/include/python3.6m -c build/src/cysignals/signals.c -o build/temp.linux-x86_64-3.6/build/src/cysignals/signals.o
In file included from /home/et/anaconda3/include/python3.6m/Python.h:50:0,
from build/src/cysignals/signals.c:34:
/home/et/anaconda3/include/python3.6m/pyport.h:686:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
In file included from build/src/cysignals/signals.c:558:0:
build/src/cysignals/implementation.c:60:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
error: command 'gcc' failed with exit status 1


Failed building wheel for cysignals
Running setup.py clean for cysignals
Failed to build cysignals
Installing collected packages: cysignals
Running setup.py install for cysignals ... error
Complete output from command /home/et/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-16kxaadc/cysignals/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-56s6_g5p-record/install-record.txt --single-version-externally-managed --compile:
/tmp/pip-build-16kxaadc/cysignals/setup.py:195: ResourceWarning: unclosed file <_io.TextIOWrapper name='VERSION' mode='r' encoding='UTF-8'>
version=open("VERSION").read().strip(),
/tmp/pip-build-16kxaadc/cysignals/setup.py:199: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'>
long_description=open('README.rst').read(),
/home/et/anaconda3/lib/python3.6/importlib/_bootstrap_external.py:426: ImportWarning: Not importing directory /home/et/anaconda3/lib/python3.6/site-packages/virtualenvwrapper: missing init
_warnings.warn(msg.format(portions[0]), ImportWarning)
running install
running build
generating build/lib.linux-x86_64-3.6/cysignals/init.pxd
running build_py
copying src/cysignals/init.py -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/memory.pxi -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/signals.pxi -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/pysignals.pxd -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/memory.pxd -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/signals.pxd -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/pxi_warning.h -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/macros.h -> build/lib.linux-x86_64-3.6/cysignals
copying src/cysignals/struct_signals.h -> build/lib.linux-x86_64-3.6/cysignals
copying build/src/cysignals/signals.h -> build/lib.linux-x86_64-3.6/cysignals
copying build/src/cysignals/debug.h -> build/lib.linux-x86_64-3.6/cysignals
running build_ext
building 'cysignals.signals' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/build
creating build/temp.linux-x86_64-3.6/build/src
creating build/temp.linux-x86_64-3.6/build/src/cysignals
gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc/cysignals -Ibuild/src -Ibuild/src/cysignals -I/home/et/anaconda3/include/python3.6m -c build/src/cysignals/signals.c -o build/temp.linux-x86_64-3.6/build/src/cysignals/signals.o
In file included from /home/et/anaconda3/include/python3.6m/Python.h:50:0,
from build/src/cysignals/signals.c:34:
/home/et/anaconda3/include/python3.6m/pyport.h:686:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
In file included from build/src/cysignals/signals.c:558:0:
build/src/cysignals/implementation.c:60:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
error: command 'gcc' failed with exit status 1

----------------------------------------

Command "/home/et/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-16kxaadc/cysignals/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-56s6_g5p-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-16kxaadc/cysignals/

Similar errors with fasttext package as well - https://github.com/salestock/fastText.py/issues/161

@bung87
Copy link

bung87 commented Jan 26, 2018

CC=/usr/local/Cellar/gcc/7.3.0/bin/g++-7 pip install --no-cache pyfasttext
show error

FATAL:/opt/local/bin/../libexec/as/x86_64/as: I don't understand 'm' flag!
error: command '/usr/local/Cellar/gcc/7.3.0/bin/g++-7' failed with exit status 1

@nazariyv
Copy link

Georges solution worked for me. But I spent way too much time before stumbling on this...

@hungtr97
Copy link

hungtr97 commented May 2, 2019

I have error install pyfasttext, pls help me.
Python 3.7.3
Cython 0.29.7
g++ 4.2.1
MacOS Mojave 10.14.3

error: command 'gcc' failed with exit status 1

This is the error output: https://anotepad.com/notes/xsqqnw

@Kungreye
Copy link

@hungtr97

use clang instead of gcc or g++:

CXX=/usr/bin/clang CC=/usr/bin/clang pip install --no-cache pyfasttext

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants