I've been struggling all morning to get PIL installed on Cygwin. The errors I get are not consistent with common errors I find using Google. Perhaps a linux guru can see an obvious problem in this output:
$ python setup.py install
running install
running build
running build_py
running build_ext
building '_imaging' extension
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DHAVE_LIBZ -I/usr/include/freetype2 -IlibImaging -I/usr/include -I/usr/include/python2.5 -c _imaging.c -o build/temp.cygwin-1.7.2-i686-2.5/_imaging.o
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/syslimits.h:7,
from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/limits.h:11,
from /usr/include/python2.5/Python.h:18,
from _imaging.c:75:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/limits.h:122:61: limits.h: No such file or directory
In file included from _imaging.c:75:
/usr/include/python2.5/Python.h:32:19: stdio.h: No such file or directory
/usr/include/python2.5/Python.h:34:5: #error "Python.h requires that stdio.h define NULL."
/usr/include/python2.5/Python.h:37:20: string.h: No such file or directory
/usr/include/python2.5/Python.h:39:19: errno.h: No such file or directory
/usr/include/python2.5/Python.h:41:20: stdlib.h: No such file or directory
/usr/include/python2.5/Python.h:43:20: unistd.h: No such file or directory
/usr/include/python2.5/Python.h:55:20: assert.h: No such file or directory
In file included from /usr/include/python2.5/Python.h:57,
from _imaging.c:75:
/usr/include/python2.5/pyport.h:7:20: stdint.h: No such file or directory
In file included from /usr/include/python2.5/Python.h:57,
from _imaging.c:75:
/usr/include/python2.5/pyport.h:89: error: parse error before "Py_uintptr_t"
/usr/include/python2.5/pyport.h:89: warning: type defaults to `int' in declaration of `Py_uintptr_t'
/usr/include/python2.5/pyport.h:89: warning: data definition has no type or storage class
/usr/include/python2.5/pyport.h:90: error: parse error before "Py_intptr_t"
/usr/include/python2.5/pyport.h:90: warning: type defaults to `int' in declaration of `Py_intptr_t'
... more lines like this
Looks like you need to install GNU libC, because
syslimits.h; limits.h; errno.h; stdlib.h; assert.h etc. all belong to it.
For windows you get binary installers; incase you don't want to build PIL under CYGWIN, you can choose from one of these, http://www.pythonware.com/products/pil/#Downloads
You may download a fresh cygwin binary and install imaging libraries in Python section. That will make PIL available for using with cygwin python 2.7.
Related
When I try to install python-pcl(PCL is the point cloud library for presentation like laser radar data. I followed the instruction on https://github.com/strawlab/python-pcl ,and I have already copied travis/pcl-2d-1.8.pc file to /usr/local/lib/pkgconfig folder) in my computer. I typed AppledeMacBook-Pro-3:python-pcl-0.3.0rc1 apple$ python setup.py install in my terminal.Then I encountered a problem below:
running install
running bdist_egg
running egg_info
writing requirements to python_pcl.egg-info/requires.txt
writing python_pcl.egg-info/PKG-INFO
writing top-level names to python_pcl.egg-info/top_level.txt
writing dependency_links to python_pcl.egg-info/dependency_links.txt
reading manifest file 'python_pcl.egg-info/SOURCES.txt'
writing manifest file 'python_pcl.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-x86_64/egg
running install_lib
running build_py
running build_ext
skipping 'pcl/_pcl_180.cpp' Cython extension (up-to-date)
building 'pcl._pcl' extension
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/apple/miniconda3/include -I/Users/apple/miniconda3/include -DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET=1 -I/Users/apple/miniconda3/pkgs/python-3.5.4-h8f450c2_22/lib/python3.5/site-packages/numpy/core/include -I/usr/local/include/pcl-1.8 -I/usr/local/Cellar/openni/1.5.7.10/include/ni -I/usr/local/include/pcl-1.8 -I/usr/local/Cellar/flann/1.9.1_6/include -I/usr/local/include/pcl-1.8 -I/opt/local/include/eigen3 -I/usr/include/ni -I/usr/include/vtk-5.8 -I/usr/local/include/vtk-8.0 -I/usr/local/Cellar/vtk/8.0.1/include -I/Users/apple/miniconda3/pkgs/python-3.5.4-h8f450c2_22/include/python3.5m -c pcl/_pcl_180.cpp -o build/temp.macosx-10.6-x86_64-3.5/pcl/_pcl_180.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the
command line to use the libc++ standard library instead
[-Wstdlibcxx-not-found]
pcl/_pcl_180.cpp:447:10: fatal error: 'vector' file not found
#include <vector>
^~~~~~~~
Somebody says it has something to do with my Cython version. But I have already switched Cython to version 0.25.2, still not working. Does anyone have the same problem? Many thanks. By the way, my python version is 3.5.4 and my Mac Version is macOS Mojave 10.14.1
This is a special issue with current MacOS-installations. You could tweak setup.py and add, as the warning suggest, -std=libc++ to the compile-options, i.e.
from distutils.core import setup
from Cython.Build import cythonize
... some stuff
#passing `-stdlib=libc++` to compiler and linker:
ext_modules = [Extension(...,
language='c++',
extra_compile_args=["-stdlib=libc++"], # + anything else you need
extra_link_args= ["-stdlib=libc++"] # + anything else you need]
... some more stuff
I have also added -stdlib=libc++ to the linker options, because it will be probably the next problem you will run into.
More background: In the MacOS world, for long time, there where two different implementations of c++'s standard library: -libstdc++ associated with gcc and libc++ associated with clang. At the beginning-libstdc++ was also used per default with clang-compiler. However, this is no longer the case - it is not even installed now and that is the reason why the headers cannot be found. I'm not sure why your clang-version doesn't take libc++ per default - so you have to pass it manually to compiler/linker.
Im trying to crate a cryptosystem on the raspbian OS. Chose python and pycrypto because the OS comes with python 3.2.3 pre-installed. Moved the "pycrypto-2.6.1.tar.gz" to the folder where python files are located and extracted there. Suposed to build using the command "python setup.py build" and then install.
But during the build phase, keep getting the error:
"pi#raspberrypi /usr/lib/python3.2/pycrypto-2.6.1 $ python setup.py buildrunning build
running build_py
running build_ext
running build_configure
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash._MD2' extension
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-armv6l-2.7/src/MD2.o
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
"
Not able to figure out whether I am supposed to change the pathing. Could somebody give an insight in to this?
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
The libgmp-dev package provides the necessary files to support building the optimized module here:
apt-get install libgmp-dev
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
compilation terminated.
If you search for fatal error: Python.h: No such file or directory, the very first Google result is for this StackOverflow question, which tells you that you need to install the python-dev package:
apt-get install python-dev
In general, if you are building software from source you will need the corresponding -dev package for any required libraries; these packages provide header files (foo.h) and the unversioned shared libraries necessary for linking.
I am trying to get cython to realize I have a c compiler in MinGW 32-bit and I've tried everything I can find on the web but it's still not working. I am running Windows 7 Professional 64-bit. Here is what I have tried:
(1) I have Python 2.7 and I just installed MinGW with options gcc and g++ and some other options
(2) I edited the PATH environmental variable so it includes
C:\MinGW\bin;C:\MinGW\MSYS\1.0\local\bin;C:\MinGW\MSYS\1.0\bin
(3) I told Python to use MinGW as the default compiler by creating a file named
C:\Python27\Lib\distutils\distutils.cfg, containing
[build]
compiler = mingw32
(I do have MinGW32 by the way)
(4) I removed all instances of -mno-cygwin from the file C:\Python27\Lib\distutils\cygwincompiler.py
(5) I have a file called setup.py and a module called tryingcython.pyx that is written in python. My setup.py says
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
cmdclass = {'build_ext':build_ext},
ext_modules=[Extension("tryingcython",["tryingcython.pyx"])]
)
So then I open Command Prompt and get into the directory that contains setup.py and tryingcython.pyx, and I type
python setup.py build_ext --inplace --compiler=mingw32
Then it tells me:
running build_ext
skipping 'tryingcython.c' Cython extension (up-to-date)
building 'tryingcython.c' extension
gcc -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c tryingcython.c -o build\
temp.win32-2.7\Release\tryingcython.o
error: command 'gcc' failed: No such file or directory
So I guess Cython can't tell that I have gcc and it can't find it or what, even though I've tried about every single piece of advice I can find online for making it realize that I have MinGW which has gcc included.
Any help/additional ideas on how I can get cython to actually work would be much appreciated.
You are using exactly the same operational system and versions than me.
Try to cal gcc using:
SET input=intput.c
SET output=output.pyd
gcc -shared -IC:\Python27\include -LC:\Python27\libs -O2 -o %output% %input% -lpython27
Usually I put this call in a cythongcc.bat file, in a directory recognized by the PATH environment variable as:
gcc -shared -IC:\Python27\include -LC:\Python27\libs -O3 -mtune=native -o %1.pyd %2.c -lpython27
So that I can , from where my cython .pyx files are, just do:
cython input.pyx
cythongcc input input
To get the compiled .pyd working!
I have XCode installed and also FreeTDS. I tried to connect to my SQL Server and it works perfect.
Now I have to develop an aplication on python that works with this SQL Server and I´m trying to install pymsql, but I got this error when I launche sudo python setup.py command:
==> sudo python setup.py install
running install
running bdist_egg
running egg_info
writing pymssql.egg-info/PKG-INFO
writing top-level names to pymssql.egg-info/top_level.txt
writing dependency_links to pymssql.egg-info/dependency_links.txt
reading manifest file 'pymssql.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pymssql.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.7-intel/egg
running install_lib
running build_ext
skipping '_mssql.c' Cython extension (up-to-date)
building '_mssql' extension
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/sw/include -Ifreetds/nix_64/include -I/opt/local/include -I/opt/local/include/freetds -I/opt/local/freetds/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mssql.c -o build/temp.macosx-10.7-intel-2.7/_mssql.o -DMSDBLIB
_mssql.c: In function ‘__pyx_f_6_mssql_15MSSQLConnection_convert_python_value’:
_mssql.c:7322: warning: implicit conversion shortens 64-bit value into a 32-bit value
_mssql.c: In function ‘__pyx_f_6_mssql_15MSSQLConnection_get_result’:
_mssql.c:9554: warning: implicit conversion shortens 64-bit value into a 32-bit value
_mssql.c:9566: warning: implicit conversion shortens 64-bit value into a 32-bit value
_mssql.c: In function ‘__pyx_pf_6_mssql_20MSSQLStoredProcedure_2bind’:
_mssql.c:11146: warning: implicit conversion shortens 64-bit value into a 32-bit value
llvm-gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.7-intel-2.7/_mssql.o -L/sw/lib -Lfreetds/nix_64/lib -L/opt/local/lib -L/opt/local/lib/freetds -L/opt/local/freetds/lib -lsybdb -lrt -o build/lib.macosx-10.7-intel-2.7/_mssql.so
ld: warning: directory not found for option '-L/sw/lib'
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/opt/local/lib/freetds'
ld: warning: directory not found for option '-L/opt/local/freetds/lib'
ld: library not found for -lrt
collect2: ld returned 1 exit status
ld: warning: directory not found for option '-L/sw/lib'
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: directory not found for option '-L/opt/local/lib/freetds'
ld: warning: directory not found for option '-L/opt/local/freetds/lib'
ld: library not found for -lrt
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//cc6eQsIN.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1
Any help or clue?
Unfortunately, pymssql's setup.py (as of version pymssql-2.0.0b1-dev-20111019) needs a bit of help to work properly on OSX Lion. The current setup.py tries to compile/link against some pre-built Linux FreeTDS libraries, and also tries to link against librt, which doesn't exist on OSX. Additionally, it only explicitly looks for FreeTDS libraries from Fink or MacPorts, so if you've installed Homebrew (if you use if) or FreeTDS itself in a non-standard location, it may not be located by compiler/linker.
I created a repaired version of setup.py here. It worked well enough for me with the Homebrew build of FreeTDS using the standard locations (/usr/local/{lib, include}), but as always YMMV. You may need to adjust setup.py further if you've installed FreeTDS in a different location. You can generally ignore the warnings from the linker about missing directories that may not exist on your system:
ld: warning: directory not found for option '-L/usr/local/lib/freetds'
One other note: You will probably have built FreeTDS for a single architecture, likely x86_64. By default, pymssl will be a multi-architecture build (assuming you're using the system Python 2.7.1), so even with a patched setup.py you will see a linker warning something like:
ld: warning: ignoring file /usr/local/lib/libsybdb.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
That warning just indicates that the FreeTDS libraries only have single architecture version to link against. You can avoid the warning by using ARCHFLAGS to make a x86_64-only build:
ARCHFLAGS="-arch x86_64" python setup.py install
Or, try this fork, it installs without issues:
https://github.com/blackbass1988/pymssql-macos-lion
To install on OS X Mavericks, you need
OS X Command Line Tools
FreeTDS
brew install freetds
Cython
pip install cython
and then finally you can install the pymssql-macoslion
pip install git+git://github.com/blackbass1988/pymssql-macos-lion.git#master
Just incase anyone is reading this the following worked for me:
brew install freetds
sudo pip install pymssql
I tried installing lxml on Mac OSX Snowleopard and keep getting the error:
lipo: can't figure out the architecture type of: /var/folders/
I did install XCode with 10.4 SDK support and I changed gcc 4.2 to 4.0.1
Any clues??? Python 2.6.1 with Leopard 1.6.7..
running install
running bdist_egg
running egg_info
writing src/lxml.egg-info/PKG-INFO
writing top-level names to src/lxml.egg-info/top_level.txt
writing dependency_links to src/lxml.egg-info/dependency_links.txt
reading manifest file 'src/lxml.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'lxml.etree.c' under directory 'src/lxml'
warning: no files found matching 'lxml.objectify.c' under directory 'src/lxml'
warning: no files found matching 'lxml.etree.h' under directory 'src/lxml'
warning: no files found matching 'lxml.etree_api.h' under directory 'src/lxml'
warning: no files found matching '*.html' under directory 'doc'
writing manifest file 'src/lxml.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-universal/egg
running install_lib
running build_py
running build_ext
building 'lxml.etree' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/usr/include/libxml2 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.6-universal-2.6/src/lxml/lxml.etree.o -w -flat_namespace
i686-apple-darwin10-gcc-4.2.1: src/lxml/lxml.etree.c: No such file or directory
i686-apple-darwin10-gcc-4.2.1: no input files
powerpc-apple-darwin10-gcc-4.2.1: src/lxml/lxml.etree.c: No such file or directory
powerpc-apple-darwin10-gcc-4.2.1: no input files
i686-apple-darwin10-gcc-4.2.1: src/lxml/lxml.etree.c: No such file or directory
i686-apple-darwin10-gcc-4.2.1: no input files
lipo: can't figure out the architecture type of: /var/tmp//ccCwMxyq.out
error: command 'gcc-4.2' failed with exit status 1
you have an architecture problem for your python, Because of changes in Xcode 4 (dropping of support for the 10.4u SDK and gcc-4.0) it is not practical to build C extension modules with that Python on 10.7 Lion. Either use the Apple-supplied Python 2.7
/usr/bin/python2.7
Install the Python 2.7.3 Mac OS X 64-bit/32-bit x86-64/i386 Installer
I was having the same issue while trying to install milk with Python 2.7. I was not able to get my problem solved with Ali Elouafiq's exact answer, but I was able to get milk installed using the systems Python 2.6.
So perhaps trying other versions of Python until in case it works is a cost effective approach.
I found that compilation issues like these are easily avoided by installing python via brew. If brew isn't able to link the formula, just force it with:
brew link --overwrite python
See also: http://docs.python-guide.org/en/latest/starting/install/osx/