-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
More fixes for doc building with python 3 #1383
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
Conversation
@cjmayo Let me know if this works with python 3. I have no reason to believe it shouldn't. Edit: Er, I mean let me know if it doesn't work with python 3. |
+1. This works for me. Thanks for taking care of this -- building the docs under Python 3 is something that fell through the cracks during the Python 3 port. |
Thanks goes to @cjmayo for providing the original patches. |
df93eca and 19b1a05 work with Python 3 for me and I can get the docs to build (I can't formally verify but I have lots of html, images and pdfs and all the links I have tried in the html work). But it is a bit more complicated. I can only get this to work with Python 3.3.0 and not with Python 3.2.3 (specifically Gentoo Linux python-3.2.3). 3.2 fails with:
and I haven't figured that out. My recipe: Dependencies needed for Python 3.3 compatibility:
Matplotlib library patches (most of these probably break Python 2 use so need work):
Matplotlib documentation build system patches:
|
Sorry for the noise. I was wrong about this "working for me". I was inadvertently using the Python 2.x installation of Sphinx. I'm working through some remaining Python 3 issues and will have a PR against this soon. |
@cjmayo Have those docutils patches been merged upstream? We might not be able to get this in for 1.2 if we have to wait for upstream changes. |
Yes they are direct from upstream: But they are only needed for Python 3.3. All the other the other matplotlib fixes will be needed for Python 3.2 too and there is something else needed for 3.2 for that 'ascii' codec error. |
Having major headaches with python2/3 unicode differences. Bleh. I'm trying to use the utilities from six.py but it claims six is not a module... |
@cjmayo I have an idea about that ascii error on python 3.2. I'm pretty sure in python 3.2 things like |
I'm moving the commits from #1361 into this branch. |
@mdboom Are you saying running |
@dmcdougall: Yes -- you'll need to install sphinx in Python 3 (using |
$ which sphinx-build
/opt/local/Library/Frameworks/Python.framework/Versions/3.2/bin/sphinx-build
$ python --version
Python 3.2.3
$ python make.py
Running Sphinx v1.1.3
Initializing GitHub plugin
loading pickled environment... done
animation, api, axes_grid, event_handling, misc, mplot3d, old_animation, pylab_examples, tests, units, user_interfaces, widgets,
building [html]: targets for 566 source files that are out of date
updating environment: 0 added, 53 changed, 0 removed
reading sources... [ 5%] api/artist_api
Exception occurred:
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/sphinx/ext/inheritance_diagram.py", line 146, in _class_info
builtins = list(vars(__builtin__).values())
NameError: global name '__builtin__' is not defined
The full traceback has been saved in /var/folders/rs/pqvv7l192xs426r_016501f80000gn/T/sphinx-err-v0lp1g.log, if you want to report the issue to the developers. |
@dmcdougall: You're farther along than I ever got at this point. That traceback is too promising -- it suggests that the inheritance_diagram hasn't yet been updated for Python 3 (I guess). I wonder if disabling that plugin in our |
@mdboom I'm using all of the changes in this PR. I added some commits earlier today. I also merged the ones from #1361 to keep everything together. MacPorts doesn't seem to sport a py31/py32 version of sphinx. I have no experience with sphinx. My guess is that support for python 3 is minimal. I'm not sure where to go from here. |
@mdboom Commenting out the inheritance diagram in conf.py it mostly works. I get the following error, but the doc build still completes!
|
One of them is a unicode issue, because |
It's great that it completes. That unicode issue is probably fixable -- something along the lines of
If that's the only problem, we're in pretty good shape. |
I'm also getting this: Edit: but the build still completes. |
Er, nevermind. Turns out the pickling thing gets done to save time on subsequent runs? Since I keep switching between python2 and python3 the pickled environment gets corrupted but it gets regenerated correctly. Disregard my previous comment. |
I can get past the ascii error with Python 3.2 with an updated version of the gen_gallery.py patch above:
And a new patch to plot_directive.py:
This now gets me through the html generation and also png creation. Fails now in using graphviz. Couple of comments on the recent comments. On the 'Jouni K. Sepp\xe4nen' would Have you tested:
on Python 2? |
@cjmayo Cheers for the patch updates. For some reason I don't have a problem with the current ones, but I'll add your updates in since they work for you.
Probably. I didn't know this existed. I have never worked with python 3, so this whole PR/frustration is a combination of me learning and getting headaches.
Nope. All the testing I did was the generate the documentation under python2, and the build succeeds. I have not checked the output. |
I am getting a new error building the docs under python 3:
I have no idea why this is happening. |
With the last two patches I can now get to the end of the doc building with Python 3.2.3, but I have to use sphinx tip (6bb9dfbdf66e) - sphinx 1.1.3 does not work for me. |
@cjmayo Progress! Interesting that you need current Sphinx HEAD. What errors do you get with sphinx 1.1.3? We have two options on proceeding depending on your response to my above question:
|
At the end of the day, the most important thing is to be able to produce the docs under some version of Python (and Python 2.x is currently working). Having them build under 3.x is of course very desirable, but if that can't be done with a stable version of Sphinx, than there's not much point to putting this is our release either. IMHO, of course. |
@mdboom Agreed; there are more important v1.2.x bugs currently milestoned. Furthermore, I think if we are waiting in either case the v1.2.x milestone is unnecessary. I will keep this PR open and remove the milestone. If anybody disagrees then adding it back on is fine. |
Even with these changes, I'm encountering an import error related to this bug: RuntimeError: dictionary changed size during iteration from colors.py #1401 |
Thanks @ariddell - the error you are describing is a matplotlib issue relating to python3.3 to try and keep the issues separate, this build process fix is for the documentation building with a currently supported python (lets say python3.2 for sake of argument). So whilst I think what you highlight is important, it should be addressed as a completely independent issue (#1401). Cheers, |
@dmcdougall - do you remember the status of this? Is it worth re-visiting and getting this PR merged? |
I'm getting the error with 3.2.3. I've setup a clean virtualenv, pip install'd only numpy and git://github.com/dmcdougall/matplotlib.git@py3_docs_2#egg=matplotlib and I get this:
Python path is: ['', '/home/abr/.virtualenvs/matplotlib-py3.2/lib/python3.2/site-packages/distribute-0.6.24-py3.2.egg', '/home/abr/.virtualenvs/matplotlib-py3.2/lib/python3.2/site-packages/pip-1.1-py3.2.egg', '/home/abr/.virtualenvs/matplotlib-py3.2/lib/python3.2', '/home/abr/.virtualenvs/matplotlib-py3.2/lib/python3.2/plat-linux2', '/home/abr/.virtualenvs/matplotlib-py3.2/lib/python3.2/lib-dynload', '/usr/lib/python3.2', '/usr/lib/python3.2/plat-linux2', '/home/abr/.virtualenvs/matplotlib-py3.2/lib/python3.2/site-packages'] Hope this helps. Thanks for all your work on this. |
Ah... Ok - thanks for pointing that out. In that case I think it is very pertinent for this PR. Cheers, |
@dmcdougall - I'd be happy to merge this. Is there more work to be done before I do, or shall I go ahead and press the green button? |
@pelson It appears that @cjmayo is currently operational with these changes, and that @ariddell is having issues with that dictionary error. That error, however, appears to have been resolved in the comments in #1401. So, I think we should merge this. If there are further dictionary errors, we can resolve those separately. Cheers @cjmayo for the help. |
More fixes for doc building with python 3
In #1361, @cjmayo pointed out some extra fixes that needed to be implemented to make doc building under python 3 work properly. These have been modified to not break backward compatibility with doc building in python 2.