I'm not a windows user typically, but I need to build exe's from my python code so I'd like to use py2exe to do this. I have an XP system where I installed python 2.6.6. I downloaded the py2exe-0.6.9 source, but when I attempted to install (via "python setup.py install"), I got the error "Unable to find vcvarsall.bat". I googled and came across this post where a respondent suggested installing a customized version of the MinGW GCC binaries available here. I did so, and now when I attempt to install py2exe I get a new error. Here is the output:
C:\Documents and Settings\Administrator\Desktop\py2exe-0.6.9>python setup.py install
C:\Documents and Settings\Administrator\Desktop\py2exe-0.6.9\py2exe\build_exe.py:16: DeprecationWarning: the sets module is deprecated
import sets
running install
running build
running build_py
running build_ext
building '_memimporter' extension
creating build\temp.win32-2.6
creating build\temp.win32-2.6\Release
creating build\temp.win32-2.6\Release\source
c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DPYTHONDLL=\"PYTHON26.DLL\" -DPYTHONCOM=\"pythoncom26.dll\" -IC:\Python26\include -IC:\Python26\PC -c source/MemoryModule.c -o build\temp.win32-2.6\Release\source\memorymodule.o
source/MemoryModule.c:30: warning: ignoring #pragma warning
source/MemoryModule.c: In function 'BuildImportTable':
source/MemoryModule.c:364: warning: pointer targets in passing argument 1 of 'MyLoadLibrary' differ in signedness
source/MemoryModule.c: In function 'GetNameTable':
source/MemoryModule.c:610: warning: passing argument 4 of 'qsort' from incompatible pointer type
source/MemoryModule.c: In function 'MemoryGetProcAddress':
source/MemoryModule.c:637: warning: passing argument 5 of 'bsearch' from incompatible pointer type
c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DPYTHONDLL=\"PYTHON26.DLL\" -DPYTHONCOM=\"pythoncom26.dll\" -IC:\Python26\include -IC:\Python26\PC -c source/_memimporter_module.c -o build\temp.win32-2.6\Release\source\_memimporter_module.o
In file included from source/_memimporter.c:8,
from source/_memimporter_module.c:2:
source/Python-version.h:13: error: redefinition of typedef 'Py_ssize_t'
C:\Python26\include/pyport.h:115: error: previous declaration of 'Py_ssize_t' was here
error: command 'gcc' failed with exit status 1
http://bugs.python.org/issue1485576 might be a bug you may want to re-open, providing your testcase to support it.
Related
I am currently using a mac version 11.6.1 with Big Sur on it. I have the latest version of python (3.9) on it, however I need to use 3.6 for a project at work. I attempted to use pyenv to install this version but ran into a number of issues with pyenv. So, I next went to https://www.python.org/downloads/release/python-3615/ and downloaded this version. In my terminal I ran the following commands.
$ cd Downloads
$ cd python-3.6.15
$ ./configure
$ make
Here I ran into this error.
./Modules/getpath.c:528:49: warning: incompatible pointer types passing 'unsigned long *' to parameter of type 'uint32_t *' (aka 'unsigned int *') [-Wincompatible-pointer-types]
else if(0 == _NSGetExecutablePath(execpath, &nsexeclength) && execpath[0] == SEP) {
^~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/mach-o/dyld.h:98:54: note: passing argument to parameter 'bufsize' here
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
^
1 warning generated.
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o
./Modules/posixmodule.c:8210:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = sendfile(in, out, offset, &sbytes, &sf, flags);
^
./Modules/posixmodule.c:10432:5: warning: code will never be executed [-Wunreachable-code]
Py_FatalError("abort() called from Python code didn't abort!");
^~~~~~~~~~~~~
1 warning and 1 error generated.
make: *** [Modules/posixmodule.o] Error 1
I am banging my head against the wall here with the errors from pyenv and now this. My attempt here was to run a virtual environment with virtualenv and point it at the 3.6 version of python, however, as you can see I can't seem to install python correctly. Any assistance here would be appreciated.
Since I was asked about the error with pyenv I'll include that here too.
BUILD FAILED (OS X 11.6.1 using python-build 2.2.0-5-g54889eb8)
Inspect or clean up the working tree at /var/folders/77/93y4tp5x557ff0h_3f76bh5c0000gn/T/python-build.20211104075648.30324
Results logged to /var/folders/77/93y4tp5x557ff0h_3f76bh5c0000gn/T/python-build.20211104075648.30324.log
Last 10 log lines:
checking for --with-cxx-main=<compiler>... no
checking for clang++... no
configure:
By default, distutils will build C++ extension modules with "clang++".
If this is not intended, then set CXX on the configure command line.
checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** No targets specified and no makefile found. Stop.
with penv try this:
# get latest pyenv version
brew unlink pyenv
brew install pyenv --HEAD
CFLAGS=-Wno-implicit-function-declaration pyenv install 3.6.15
I've been trying to install this Python library for the entire day. It's called leven, and you can find it here: https://pypi.python.org/pypi/leven/.
It was written in C++, and I am getting errors when trying to build and install it. To build and install I run from the command line: python setup.py install. It runs part of it until it fails when running the command
C:\Program Files (x86)\CodeBlocks\MinGW\bin\g++.exe -mdll -static --entry _DllMain#12 --output-lib build\temp.win32-2.7\Release\leven\lib_levenshtein.a --def build\temp.win32-2.7\Release\leven\_levenshtein.def -s build\temp.win32-2.7\Release\leven\_levenshtein.o -LC:\Python27\libs -LC:\Python27\PCbuild -lpython27 -lmsvcr90 -o build\lib.win32-2.7\leven\_levenshtein.pyd
g++: error: unrecognized command line option '--output-lib'
g++: error: build\temp.win32-2.7\Release\leven\lib_levenshtein.a: No such file or directory
error: command 'C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin\\g++.exe' failed with exit status 1
And the entire thing, when I run python setup.py install is:
C:\Python27\Lib\site-packages>python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to leven.egg-info\requires.txt
writing leven.egg-info\PKG-INFO
writing top-level names to leven.egg-info\top_level.txt
writing dependency_links to leven.egg-info\dependency_links.txt
reading manifest file 'leven.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'leven.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
running build_ext
building 'leven._levenshtein' extension
C:\Program Files (x86)\CodeBlocks\MinGW\bin\gcc.exe -mdll -O -Wall -Ileven -IC:\Python27\include -IC:\Python27\PC -c leven/_levenshtein.cpp -o build\temp.win32-2.7\Release\leven\_levenshtein.o
leven/_levenshtein.cpp: In function 'void __Pyx_RaiseArgtupleInvalid(const char*, int, Py_ssize_t, Py_ssize_t, Py_ssize_t)':
leven/_levenshtein.cpp:1400:59: warning: unknown conversion type character 'z' in format [-Wformat]
leven/_levenshtein.cpp:1400:59: warning: format '%s' expects argument of type 'char*', but argument 5 has type 'Py_ssize_t {aka int}' [-Wformat]
leven/_levenshtein.cpp:1400:59: warning: unknown conversion type character 'z' in format [-Wformat]
leven/_levenshtein.cpp:1400:59: warning: too many arguments for format [-Wformat-extra-args]
writing build\temp.win32-2.7\Release\leven\_levenshtein.def
C:\Program Files (x86)\CodeBlocks\MinGW\bin\g++.exe -mdll -static --entry _DllMain#12 --output-lib build\temp.win32-2.7\Release\leven\lib_levenshtein.a --def build\temp.win32-2.7\Release\leven\_levenshtein.def -s build\temp.win32-2.7\Release\leven\_levenshtein.o -LC:\Python27\libs -LC:\Python27\PCbuild -lpython27 -lmsvcr90 -o build\lib.win32-2.7\leven\_levenshtein.pyd
g++: error: unrecognized command line option '--output-lib'
g++: error: build\temp.win32-2.7\Release\leven\lib_levenshtein.a: No such file or directory
error: command 'C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin\\g++.exe' failed with exit status 1
The answer to this problem was to replace "--output-lib name" for "-out-implib=name".
I'm running into a different problem now. I need to change that --output-lib to -implib=name in the cygwinccompiler.py, so it runs when I call python setup.py install of that package, but I keep getting an extra whitespace in between implib= and name, I think this is the reason the program stops working. Any ideas for that issue?
I'm trying to install a python wrapper over constraint programming library Gecode called python-gecode
https://pypi.python.org/pypi/gecode-python/
No matter how I install it I get same error "No such file or directory". Here is setup script output:
running install
running build
running build_py
running build_ext
building 'gecode._gecode' extension
C:\MinGW32-xy\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DDISJUNCTOR "-IC:\Program Files\Gecode\include" -IC:\Python27\include -IC:\Python27\PC -c _gecode.cc -o build\temp.win32-2.7\Release\_gecode.o
_gecode.cc:5:24: fatal error: 4.2.1: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1"
But the _gecode.cc is there in the folder. I don't really understand what's the problem. I tried installing with pip, easy_install, manual install and everytime I get this error.
Any ideas what's causing it?
Thanks!
Gecode-Python supports only up to version 4.0.0 of Gecode, so use that version instead of 4.2.1.
I'm trying to install pydasm, but met an error, don't know how to continue.
The version of python is 2.7, and the OS is WinXP.
python setup.py build_ext --compiler=mingw32
running build_ext
building 'pydasm' extension
creating build
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python27\include -IC:\Pytho
n27\include -IC:\Python27\PC -c ../libdasm.c -o build\temp.win32-2.7\Release\..\
libdasm.o
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
It seems that -mno-cygwin is no longer supported in latest MinGW, but python 2.7 disutils module is still using it. How to solve it?
I'm trying to get Django/Python to work with MySQL, so I'm installing Mysql for Python adapter.
At one point, I discovered that I needed to use the MinGW compiler, so I installed that.
I encountered many annoying problems, and I managed to get past them. This one, however, is especially torturing.
The error occurs when I attempt to execute the following command in command line for Windows:
setup.py install build --compiler=mingw32
Here is the error:
> running install<br> running build<br> running build_py<br> copying
> MySQLdb\release.py -> build\lib.win32-2.7\MySQLdb<br> running
> build_ext<br> building '_mysql' extension<br> gcc.exe -mno-cygwin
> -mdll -O -Wall -Dversion_info=(1,2,3,'final',0) -D__version_
> _=1.2.3 -IC:\Server\MySQL\include -IC:\Python27\include -IC:\Python27\PC -c _mys ql.c -o build\temp.win32-2.7\Release\_mysql.o /Z1<br>
> **gcc: /Z1: No such file or directory<br> gcc: CreateProcess: No such file or directory<br> error: command 'gcc' failed with exit status 1**
Can any of you guys help me out?
This error is caused by /Zl parameter, as they are special parameters used only by VC. We could delete them on setup_window.py.
Since you're talking about MinGW, I'm assuming you're building on Windows. You probably need to add the directory where mingw's gcc binary resides to your PATH.
Assuming it's C:\MinGW32, then you'd do something like:
set PATH=C:\MinGW32\bin;%PATH%
You'd do that before you ran python setup.py install build --compiler=mingw32
Using compiled binaries for windows machine helps. you can get it here http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/