GCC issue while using cython - python

I am trying to execute a file as shown on this website,
http://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html
I have saved my file with .pyx extension, made the setup.py file and ran python setup.py build_ext --inplace command. So earlier I was getting error: command 'gcc' failed: No such file or directory and then I installed the package as suggested here Error: command 'gcc' failed: No such file or directory I added the C:\users\name\mingw\bin in my environment variable as suggested MinGW: "gcc is not recognized as an internal or external command".
Still, when I am typing gcc on cmd it is showing 'gcc' is not recognized as an internal or external command,operable program or batch file.
So, I am confused. I also went into mingw\bin and then I run python setup.py build_ext --inplace but then I get command 'gcc.exe' failed with exit status 1.
I am stuck on this. Please help as this is my first time to use Cython.

Related

Where is an .o file stored when using setup.py install?

Generally, where is the x.o file stored when x.cpp and x.h are compiled?
Specifically, how to fix the error
megatron/fused_kernels/scaled_upper_triang_masked_softmax.o: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1
when running python ./megatron/fused_kernels/setup.py install?
The .o file is included in the .exe/.out file if you don't compile the .cpp file with the -c compiler flag. But if you use the -c compiler flag, it is stored in the same directory as the .cpp file.

pyd modules build failed with ld.exe complaining [def_file].def:1: syntax error

I am using anaconda py3.6, with conda's mingw32.
I set mingw32 as the compiler, also modified cygwinccompiler.py as suggested in Building minimal cython file with python 3.3 (Anaconda) under windows 7 .
Now I still can't build any binary pyd module, they all failed at the linking step with similar error.
C:\ProgramData\Anaconda3\Scripts\gcc.bat -shared -s build\temp.win32-3.6\Release\cymysql\packet.o build\temp.win32-3.6\Release\cymysql\packet.cp36-win32.def -LC:\ProgramData\Anaconda3\libs -LC:\ProgramData\Anaconda3\PCbuild\win32 -lpython36 -lmsvcr140 -o build\lib.win32-3.6\cymysql\packet.cp36-win32.pyd c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe: build\temp.win32-3.6\Release\cymysql\packet.cp36-win32.def:1: syntax error
c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe:build\temp.win32-3.6\Release\cymysql\packet.cp36-win32.def: file format not recognized; treating as linker script
c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe:build\temp.win32-3.6\Release\cymysql\packet.cp36-win32.def:1: syntax error
collect2.exe: error: ld returned 1 exit status error: command 'C:\\ProgramData\\Anaconda3\\Scripts\\gcc.bat' failed with exit status 1
another example:
(base) D:\pymssql-build\pymssql>gcc -shared -s build\temp.win32-3.6\Release\_mssql.o build\temp.win32-3.6\Release\_mssql.cp36-win32.def -LC:\ProgramData\Anaconda3\Library\mingw-w64\lib -LC:\ProgramData\Anaconda3\Library\lib -LD:\pymssql-build\pymssql\freetds\ming_32\lib-nossl -LC:\ProgramData\Anaconda3\libs -LC:\ProgramData\Anaconda3\PCbuild\win32 -llibiconv -liconv -lsybdb -lws2_32 -lwsock32 -lkernel32 -lpython36 -lmsvcr140 -o build\lib.win32-3.6\_mssql.cp36-win32.pyd
c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe: build\temp.win32-3.6\Release\_mssql.cp36-win32.def:1: syntax error
c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe:build\temp.win32-3.6\Release\_mssql.cp36-win32.def: file format not recognized; treating as linker script
c:/programdata/anaconda3/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/bin/ld.exe:build\temp.win32-3.6\Release\_mssql.cp36-win32.def:1: syntax error
collect2.exe: error: ld returned 1 exit status
While the def files looks just fine to me:
LIBRARY _mssql.cp36-win32.pyd
EXPORTS
PyInit__mssql
_mssql.o size: 507kb

install glove_python on windows

I tried to install glove_python package (https://github.com/maciejkula/glove-python) and I keep getting the same error like this question.
I tried using the mingw32 compiler, and I got the following error.
glove/glove_cython.c:262:17: fatal error: omp.h: No such file or directory
compilation terminated.
error: command 'C:\\Anaconda2\\Scripts\\gcc.bat' failed with exit status 1
I even tried using TDM but again I'm getting the following error.
gcc: error: libgomp.spec: No such file or directory
error: command 'c:\\TDM-GCC-64\\bin\\gcc.exe' failed with exit status 1

I am trying to import mysqldb for django. 'my_config.h ' no such file or directory is the error that i am getting

Initially i got that error called vcvarsall.bat not found.To resolve that i installed Microsoft visual studio 14 .After that the error i got is
C:\Users\...\Desktop\mysqlclient-1.3.7>python setup.py install
running install
running bdist_egg
running egg_info
writing top-level names to mysqlclient.egg-info\top_level.txt
writing mysqlclient.egg-info\PKG-INFO
writing dependency_links to mysqlclient.egg-info\dependency_links.txt
reading manifest file 'mysqlclient.egg-info\SOURCES.txt'
. ..
...
_mysql.c
_mysql.c(29): fatal error C1083: Cannot open include file: 'my_config.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\
cl.exe' failed with exit status 2
I have no clue how to proceed. I am using Windows 8 and Python 3.5 .
mysqlclient uses a library from MySQL.
For Windows, install a libmysqlclient here: https://dev.mysql.com/downloads/connector/c/
Then try reopening your cmd.

Error installing bcrypt with pip on Cygwin: cant find ffi.h (libffi is installed)

Similar to this question, I'm having trouble installing bcrypt under Cygwin, and receiving this error:
Downloading/unpacking bcrypt
Downloading bcrypt-1.0.2.tar.gz (40kB): 40kB downloaded
Running setup.py (path:/tmp/pip_build_Chris/bcrypt/setup.py) egg_info for package bcrypt
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
...
distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
Complete output from command python setup.py egg_info:
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
The libffi-devel package is installed, and I've also tried using the --global-option='-I/lib/libffi-3.0.13/include' argument to tell pip exactly where the ffi.h file is on my system.
I was able to build/install this implementation from source under Cygwin: https://bitbucket.org/alexandrul/py-bcrypt/overview
I met the same problem.
Fixed the problem by:
cp /usr/lib/libffi-3.0.13/include/*.h /usr/include

Categories