I need help installing pypng in Python 3.3

David Robinow drobinow at gmail.com
Mon Oct 29 11:08:10 EDT 2012


On Mon, Oct 29, 2012 at 8:23 AM,  <icgwh at tagyourself.com> wrote:
> Hello all,
>
> I am very new to python. I am currently porting a little project of mine from java to python and I need to be able to construct and write png images. I naturally turned myself toward pypng to accomplish this.
>
> I learned from the net that pypng 0.0.13 is supposed to work in Python 3.x when run through '2to3'. However, in my case, it apparently does not.
>
You haven't shown that.
> I ran into various problems when trying to install it, some of them I could fix myself. First I attempted to install pip but I couldn't get Windows to recognize pip as an internal command as the prompt informs me.
 No, it's not an internal command, but you don't need that. I'm
assuming your python is installed under C:\Python33. If not, adjust as
needed.  Try:
 C:\Python33\Scripts\pip install pypng

[You didn't say what you did to install pip so I don't know if pip.exe
actually exists in C:\Python33\Scripts]

> Then I tried to directly run "setup.py install" from the pypng folder. It didn't work as I got a syntax error. I noticed that in the beginning of the installation process, the following warning was displayed: "conf[use_2to3 = true] unrecognized configuration option"

 The following works for me:
C:\Python33\python setup.py install

>
> At that point I was already pretty pissed but I managed to make the warning disappear by updating (installing?) distribute. After that there are no more errors during the installation process and everything seems to work fine. (This seems still strange to me as 2to3 was present in Tools/Script out of the box)

It's not clear what you did here. setup.py should run 2to3 for you.
What command did you use to successfully? install it?

> I use pydev in Eclipse and pydev reports several error in png.py anytime I want to import or use it. When trying to import from IDLE I get:
>
> except ValueError, e:
>                  ^
> Syntax error, line 1863
 It's clear that the install process didn't run 2to3.

> that paricular error I was able to fix by changing it to "except ValueError as e:" but I don't understand why 2to3 didn't do it automatically.
 2to3 does do it automatically.
> There are several more errors reported by pydev, here are a few:
>
> line 1368 : "raise ValueError('Chunk %s too short for checksum.', tag)"
>             Undefined variable: tag

Looking at the code, this appears to be a bug.
>
> line 2736 : "rows = [map(numpy.uint16, range(0,0x10000,0x5555))]"
>             Undefined variable from import: uint16
>
> The second one made me suspect I needed to install numpy too. As there are no installers for numpy aimed toward Python3.3.
 A few lines above there's a try/except for importing numpy. It should
skip this test if numpy is not available. I'm not sure how you were
able to execute that line [unless you've got a stray numpy.py  file
somewhere somewhere]

> I decided to install Python2.7 and retry the whole process. Unfortunately I didn't get much more success. I get the exact same errors in pydev when using the 2.7 version of the interpreter and I cannot install numpy either because when I run the .exe file aimed toward Python 2.7 i get the error message:
>
> "Python version 2.7 required, which was not found in the registry"
>
> I then have the option to manually enter the path to Python 2.7 but the textform is greyed out and I can't type in anything.
>

Do you have the file c:\Python33\Lib\site-packages\pypng-0.0.13-py3.3.egg  ?
If not, you have not successfully installed pypng. Please try one of
the methods I gave above.



More information about the Python-list mailing list