Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install with Python 3.2 #18

Closed
tenspd137 opened this issue Nov 6, 2012 · 31 comments
Closed

Install with Python 3.2 #18

tenspd137 opened this issue Nov 6, 2012 · 31 comments

Comments

@tenspd137
Copy link

Just trying this out because I would like to move to python 3.2, but I need to be able to use PIL. Using pip install Pillow with python3.2, it fails with:

TypeError: Can't convert 'bytes' object to str implicitly


Command /usr/bin/python3.2 -c "import setuptools;file='/tmp/pip-build/Pillow/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-5ovsco-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build/Pillow
Storing complete log in /root/.pip/pip.log

Exception info:

Exception information:
Traceback (most recent call last):
File "/usr/lib64/python3.2/site-packages/pip/basecommand.py", line 107, in main
status = self.run(options, args)
File "/usr/lib64/python3.2/site-packages/pip/commands/install.py", line 261, in run
requirement_set.install(install_options, global_options)
File "/usr/lib64/python3.2/site-packages/pip/req.py", line 1166, in install
requirement.install(install_options, global_options)
File "/usr/lib64/python3.2/site-packages/pip/req.py", line 589, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/usr/lib64/python3.2/site-packages/pip/util.py", line 612, in call_subprocess
% (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command /usr/bin/python3.2 -c "import setuptools;file='/tmp/pip-build/Pillow/setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-5ovsco-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build/Pillow

Just wondering if this is supposed to work yet ( I read that it did, but can't remeber where) or if there is something I am missing. Thanks!

@aclark4life
Copy link
Member

Cool, thanks for the report. It's not known to work yet but good that people are trying. I hope to have a release out by end of year, PyCon 2013 at the latest.

@tenspd137
Copy link
Author

Oh - ok. Sorry for the "bug report" then since it isn't supposed to work yet. I was looking at the wrong repo - looks like someone is trying a fork here:

https://github.com/fluggo/Pillow.git

@aclark4life
Copy link
Member

No problem. Will leave this open and close it when it works :-)

@tenspd137
Copy link
Author

Thanks - I don't know if the fork contributes back here or what, but my guess is you aren't in charge of it. Anyway, I can't get it to work - at least on linux. Look forward to getting this for 3.2! :)

@aclark4life
Copy link
Member

FWIW I am the Pillow (PIL fork) author, release manager and cheerleader.

@tenspd137
Copy link
Author

Well, it is good stuff - so I will wait for the official word from here.

@taigit
Copy link

taigit commented Nov 30, 2012

django 1.5 on python 3.x will likely create demand for PIL / Pillow as developers start new django projects.
Especially since the django ImageField requires PIL and it is the standard way to upload images from django forms.

We plan to offer first-class, production-ready support for Python 3 in our next release, Django 1.6.
We’re recommending that Django 1.5 not be used in production under Python 3. Instead, use this opportunity to begin porting applications to Python 3. If you’re an author of a pluggable component, we encourage you to start porting now.

https://docs.djangoproject.com/en/dev/releases/1.5-beta-1/#python-compatibility

@takluyver
Copy link

Is there any progress on this? Looking at @fluggo's commit log, he seems to have spent considerable time and effort on Python 3 compatibility, while supporting 2.6 and 2.7 as well. Is that going to be merged into Pillow?

@aclark4life
Copy link
Member

Progress: no. Merged: yes. No later than PyCon 2013

@warsaw
Copy link

warsaw commented Jan 7, 2013

On Jan 06, 2013, at 02:24 PM, Alex Clark ☺ wrote:

Progress: no. Merged: yes. No later than PyCon 2013

I tried compiling the git branch on Ubuntu 13.10 into a Python 3.3 virtualenv,
and was able to successfully load up a jpg and create/save a png thumbnail.
That alone makes it look pretty promising!

I'll see if I can whip together a Debian package for the code and throw it
into a PPA for folks to test with.

Great work!

@aclark4life
Copy link
Member

Hi Barry, that would be great! Thank you.

@warsaw
Copy link

warsaw commented Jan 8, 2013

On Jan 07, 2013, at 02:36 PM, Alex Clark ☺ wrote:

Hi Barry, that would be great! Thank you.

I just uploaded a very preliminary package to
http://launchpad.net/~pythoneers/+archive/ppa

The packaging branch is at lp:~barry/+junk/pillow-packaging

It's not perfect. I don't quite have the dependencies right so you'll have to
manually install tk and tcl just to get the non-tk python3-imaging package to
install. Also, I think the dbg packages aren't quite right and I know the
doc package isn't populated yet. I also need to get the selftest running.

Still, once you get the python3-imaging package installed into your Python 3.3
(this is only tested on raring so far), you can load an image, create a
thumbnail, and save it. That's way better than no PIL on Python 3 at
all. :)

I'll work on fixing the packaging as time allows and will coordinate with
the Debian and Ubuntu community to get more testing and eventually into the
archives. Patches/merge-proposals against the above bzr branch are of course
welcome!

This is looking promising.

@aclark4life
Copy link
Member

Thank you so much, Barry! FWIW: I'm not going to be too critical of @fluggo's pull request before I merge it. (I mostly rely on the community for that.) But, I will take the time to at least test @fluggo's branch on various versions of Python locally. As well as make sure it works with Plone, which is the main thing I care about (although Plone won't see Python 3 for at least another year.) That testing and merge could happen this month sometime, especially if some excitement builds around it.

@aclark4life
Copy link
Member

@fluggo can you send a pull request for your Python 3 support changes?

@warsaw
Copy link

warsaw commented Jan 9, 2013

On Jan 08, 2013, at 03:52 PM, Alex Clark ☺ wrote:

Thank you so much, Barry! FWIW: I'm not going to be too critical of @fluggo's
pull request before I merge it. (I mostly rely on the community for that.)
But, I will take the time to at least test @fluggo's branch on various
versions of Python locally. As well as make sure it works with Plone, which
is the main thing I care about (although Plone won't see Python 3 for at
least another year.) That testing and merge could happen this month sometime,
especially if some excitement builds around it.

Note that the build failed on the PPA build farm. It actually succeeded (and
succeeds in a local build), but there are a few extra checks that the build
farm perform, and the branch is failing those.

Quoting from:

https://launchpadlibrarian.net/127995050/buildlog_ubuntu-raring-amd64.pillow_0.1%2Bgit660f2ac-1_FAILEDTOBUILD.txt.gz

"""
Function PyInt_FromLong' implicitly converted to pointer at _sane.c:142 FunctionPy_InitModule' implicitly converted to pointer at _sane.c:1270
Function PyInt_FromLong' implicitly converted to pointer at _sane.c:142 FunctionPy_InitModule' implicitly converted to pointer at _sane.c:1270

Our automated build log filter detected the problem(s) above that will
likely cause your package to segfault on architectures where the size of
a pointer is greater than the size of an integer, such as ia64 and amd64.

This is often due to a missing function prototype definition.

Since use of implicitly converted pointers is always fatal to the application
on ia64, they are errors. Please correct them for your next upload.

More information can be found at:
http://wiki.debian.org/ImplicitPointerConversions
"""

This should be fixed upstream, but I'll try to patch it here if it's obvious.

@takluyver
Copy link

Is this pull request against @fluggo's branch relevant to those errors?
fluggo#2

@fluggo
Copy link
Contributor

fluggo commented Jan 9, 2013

On Wed, Jan 9, 2013 at 9:26 AM, Thomas Kluyver notifications@github.com wrote:

Is this pull request against @fluggo's branch relevant to those errors?
fluggo#2

I was wondering the same thing.

Alex, let me look at the 64-bit issue and the sane pull request
tonight, and I'll try to submit a pull request by the end of the week
at the latest.

--Brian

@aclark4life
Copy link
Member

Thanks Brian, cool

@warsaw
Copy link

warsaw commented Jan 9, 2013

On Jan 09, 2013, at 07:26 AM, Thomas Kluyver wrote:

Is this pull request against @fluggo's branch relevant to those errors?
fluggo#2

Yep. I didn't see that before so my PPA has a quilt patch that is very
similar to the pull request. I just commented that you can't use string
exceptions any more (tiny diff in the comment).

I also didn't #if redefine PyInt_* under Python 3, since I'm taking the
approach that Pillow is only for Python 3. I'm not sure if that's a valid
assumption. Anyway, I just s/PyInt_/PyLong_/ everywhere.

Nice fixes for threading, and I also s/PyString_/PyBytes_/.

Oh one last thing. The return on line 1302 has to return NULL on error.

@warsaw
Copy link

warsaw commented Jan 9, 2013

On Jan 09, 2013, at 07:28 AM, Brian Crowell wrote:

On Wed, Jan 9, 2013 at 9:26 AM, Thomas Kluyver notifications@github.com wrote:

Is this pull request against @fluggo's branch relevant to those errors?
fluggo#2

I was wondering the same thing.

Alex, let me look at the 64-bit issue and the sane pull request
tonight, and I'll try to submit a pull request by the end of the week
at the latest.

I added some inline comments in the pull request's code.

@fluggo
Copy link
Contributor

fluggo commented Jan 10, 2013

On Wed, Jan 9, 2013 at 9:28 AM, Brian Crowell brian@fluggo.com wrote:

Alex, let me look at the 64-bit issue and the sane pull request
tonight, and I'll try to submit a pull request by the end of the week
at the latest.

I've merged the Sane patch, but I've also added some Unicode
conversions and fixed the string/exception business. Sent it as part
of the pull request. Have fun.

--Brian

@aclark4life
Copy link
Member

Thank you!

@d-schmidt
Copy link
Contributor

I've added another fix and 3 features, maybe anybody want to test them.

@aclark4life
Copy link
Member

Added where? Can you send a pull request?

@aclark4life
Copy link
Member

Mike from pythonlibrary.org suggests comparing our Python 3 support implementation with another implementation: http://www.lfd.uci.edu/~gohlke/pythonlibs/. Making a note to do so here.
EDIT: gohlke has already contributed a number of patches to Pillow

@joulez
Copy link

joulez commented Mar 8, 2013

"python3.2 setup.py build" will fail.
How is everyone else building/installing Pillow for python3.2?
I'm not sure why the '\n' literal isn't prefixed with 'b' in order to concat with the files read in as bytes for long_description.
It appears to build/install fine for python3.2 and 'b' is ignored for python2 so it shouldn't be a problem and this issue can be closed.

@aclark4life
Copy link
Member

@joulez I just fixed setup.py in master…

@kmike
Copy link
Contributor

kmike commented Mar 8, 2013

Pip doesn't support non-ascii long_description under Python 2.x - try this e.g. with LC_ALL=C. Also, for Python 2.x long_description must be a bytestring, and for Python 3.x it must be unicode. So I think that for such popular package long_description should be limited to ascii (and conditionally decoded to unicode for Python 3.x). Maybe it is already ascii-only; I didn't check this.

@aclark4life
Copy link
Member

Seems to work OK in both 2.x and 3.x by changing '\n' to b'\n' …

@aclark4life
Copy link
Member

OK @tenspd137, please use 2.0.0! 👍

@aclark4life
Copy link
Member

@warsaw Any interest in updating your PPA?

radarhere pushed a commit that referenced this issue Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants