[Numpy-discussion] [OT] any image io module that works with python3?

Nadav Horesh nadavh@visionsense....
Sat Mar 12 23:56:38 CST 2011


This lead to another error probably due to line 68 in map.h. As much as I could trace it, ob_type is a member of PyObject,  not of PyTypeObject. I have no clue how to resolve this.

    Nadav.
________________________________________
From: numpy-discussion-bounces@scipy.org [numpy-discussion-bounces@scipy.org] On Behalf Of Christoph Gohlke [cgohlke@uci.edu]
Sent: 13 March 2011 00:37
To: numpy-discussion@scipy.org
Subject: Re: [Numpy-discussion] [OT] any image io       module  that    works   with    python3?

On 3/12/2011 12:47 PM, Nadav Horesh wrote:
> After the  replacement of ö with o, the installation went without errors, but:
>
> nadav@nadav_home ~ $ python3
> Python 3.1.3 (r313:86834, Feb 25 2011, 11:08:33)
> [GCC 4.4.4] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import _imaging
> Traceback (most recent call last):
>    File "<stdin>", line 1, in<module>
> ImportError: /usr/lib64/python3.1/site-packages/PIL/_imaging.so: undefined symbol: Py_FindMethod

Py_FindMethod should be excluded by `#ifndef PY3` or similar
preprocessor statements. There is a typo in map.c line 65: change
`#ifdef PY3` to `#ifndef PY3` and clean your build directory before
rebuilding.

Christoph

>
>   Thank you,
>
>      Nadav.
> ________________________________________
> From: numpy-discussion-bounces@scipy.org [numpy-discussion-bounces@scipy.org] On Behalf Of Christoph Gohlke [cgohlke@uci.edu]
> Sent: 12 March 2011 21:49
> To: numpy-discussion@scipy.org
> Subject: Re: [Numpy-discussion] [OT] any image io module that   works   with    python3?
>
> On 3/12/2011 8:45 AM, Nadav Horesh wrote:
>> I forgot to mention that I work on linux (gentoo x86-64).Here are my achievements till now:
>>
>> 1. PythonMagick: Needs boost which I do not have it avaiable on python3
> Boost works on Python 3.1. You might need to compile it.
>> 2. Pygame: I have the stable version(1.9.1) should it work?
> You need the developer version from svn.
>> 3. FreeImage: I installed FreeImagePy on python3, but it doesn't work yet.
> FreeImagePy is unmaintained, does not work on Python 3, and has problems
> on 64 bit platforms. Just wrap the functions you need in ctypes.
>> 4. PIL: I patched setup.py and map.c so "python3 setup.py build" is working, but:
> Try replace "Hans Häggström" with "Hans Haggstrom" in PIL/WalImageFile.py
>
> Christoph
>
>>
>> nadav@nadav_home /dev/shm/PIL-1.1.7-py3 $ sudo python3.1  setup.py install
>> /usr/lib64/python3.1/distutils/dist.py:259: UserWarning: Unknown distribution option: 'ext_comp_args'
>>     warnings.warn(msg)
>> running install
>> running build
>> running build_py
>> running build_ext
>> --------------------------------------------------------------------
>> PIL 1.1.7 SETUP SUMMARY
>> --------------------------------------------------------------------
>> version       1.1.7
>> platform      linux2 3.1.3 (r313:86834, Feb 25 2011, 11:08:33)
>>                 [GCC 4.4.4]
>> --------------------------------------------------------------------
>> --- TKINTER support available
>> --- JPEG support available
>> --- ZLIB (PNG/ZIP) support available
>> --- FREETYPE2 support available
>> --- LITTLECMS support available
>>
>> .
>> .
>> .
>>
>> byte-compiling /usr/lib64/python3.1/site-packages/PIL/WalImageFile.py to WalImageFile.pyc
>> Traceback (most recent call last):
>>     File "setup.py", line 520, in<module>
>>       setup(*(), **configuration)  # old school :-)
>>     File "/usr/lib64/python3.1/distutils/core.py", line 149, in setup
>>       dist.run_commands()
>>     File "/usr/lib64/python3.1/distutils/dist.py", line 919, in run_commands
>>       self.run_command(cmd)
>>     File "/usr/lib64/python3.1/distutils/dist.py", line 938, in run_command
>>       cmd_obj.run()
>>     File "/usr/lib64/python3.1/distutils/command/install.py", line 592, in run
>>       self.run_command(cmd_name)
>>     File "/usr/lib64/python3.1/distutils/cmd.py", line 315, in run_command
>>       self.distribution.run_command(command)
>>     File "/usr/lib64/python3.1/distutils/dist.py", line 938, in run_command
>>       cmd_obj.run()
>>     File "/usr/lib64/python3.1/distutils/command/install_lib.py", line 98, in run
>>       self.byte_compile(outfiles)
>>     File "/usr/lib64/python3.1/distutils/command/install_lib.py", line 135, in byte_compile
>>       dry_run=self.dry_run)
>>     File "/usr/lib64/python3.1/distutils/util.py", line 560, in byte_compile
>>       compile(file, cfile, dfile)
>>     File "/usr/lib64/python3.1/py_compile.py", line 137, in compile
>>       codestring = f.read()
>>     File "/usr/lib64/python3.1/codecs.py", line 300, in decode
>>       (result, consumed) = self._buffer_decode(data, self.errors, final)
>> UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 1909: invalid continuation byte
>>
>>
>>
>> Any idea on how to correct it? Any elegant way to avoid byte compiling?
>>
>>     Nadav
>>
>>
>> ________________________________________
>> From: numpy-discussion-bounces@scipy.org [numpy-discussion-bounces@scipy.org] On Behalf Of Zachary Pincus [zachary.pincus@yale.edu]
>> Sent: 12 March 2011 14:35
>> To: Discussion of Numerical Python
>> Subject: Re: [Numpy-discussion] [OT] any image io module that works with        python3?
>>
>> Here's a ctypes interface to FreeImage that I wrote a while back and
>> was since cleaned up (and maintained) by the scikits.image folk:
>>
>> https://github.com/stefanv/scikits.image/blob/master/scikits/image/io/_plugins/freeimage_plugin.py
>>
>> If it doesn't work out of the box on python 3, then it should be
>> pretty simple to fix.
>>
>> Zach
>>
>>
>>
>> On Mar 12, 2011, at 4:40 AM, Christoph Gohlke wrote:
>>
>>>
>>>
>>> On 3/12/2011 1:08 AM, Nadav Horesh wrote:
>>>> Having numpy, scipy, and matplotlib working reasonably with
>>>> python3, a
>>>> major piece of code I miss for a major python3 migration is an
>>>> image IO.
>>>> I found that pylab's imread works fine for png image, but I need to
>>>> read
>>>> all the other image format as well as png and jpeg output.
>>>> Any hints (including advices how easyly construct my own module) are
>>>> appreciated.
>>>> Nadav.
>>>>
>>>
>>> On Windows, PIL (private port at
>>> <http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil>), PythonMagick
>>> <http://www.imagemagick.org/download/python/>, and pygame 1.9.2pre
>>> <http://www.pygame.org>   are working reasonably well for image IO. Also
>>> the FreeImage library<http://freeimage.sourceforge.net/>   is easy to
>>> use
>>> with ctypes<http://docs.python.org/py3k/library/ctypes.html>.
>>>
>>> Christoph
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion




More information about the NumPy-Discussion mailing list