dhellmann / pymotw-3

Other
147 stars 70 forks source link

problems with dependencies installation on python 3.10+ environments #17

Open nazarepiedady opened 1 year ago

nazarepiedady commented 1 year ago

I am starting to translate this material into Portuguese, and I having a lot of problems with the dependencies installation steps because I am using Python 3.10+.

@dhellmann could you provide some guidance about how to solve them?

dhellmann commented 1 year ago

I did a little bit once to update to 3.8 (see https://github.com/dhellmann/pymotw-3/tree/py38) but haven't looked at updating to anything newer.

What I usually do is remove the version numbers from the requirements list to install the latest versions, then use pip freeze to build the the list of the versions that I actually used so it's easier to reproduce the environment again.

nazarepiedady commented 1 year ago

@dhellmann Thanks, I want to serve the project on readthedocs.org, so what can I do to serve the project there readthedocs.org?

Until now all the builds I made failed, and Read The Docs use Python 3.7 to build the project. I received this error:

Could not import runpy module
Traceback (most recent call last):
  File "/home/docs/.pyenv/versions/3.7.9/lib/python3.7/runpy.py", line 17, in <module>
    from pkgutil import read_code, get_importer
ImportError: cannot import name 'read_code' from 'pkgutil' (/home/docs/checkouts/readthedocs.org/user_builds/pymotw-3-pt/checkouts/latest/source/pkgutil/__init__.py)

I keep the work here nazarepiedady/pymotw-3-pt, so could you say what I am not doing?

dhellmann commented 1 year ago

It looks like the pkgutil directory in the PyMOTW source tree is confusing the Python interpreter, so it is importing the wrong thing.

Have you set up RTD so it is running Paver in the build? I've never tried to build the project in RTD. I build it locally and commit the files so they can be service via GitHub pages.

nazarepiedady commented 1 year ago

@dhellmann I am not used to RTD, could you share with me the command or sequence of commands that you use to build locally? Then I will find a way to automatize it through the RTD.

dhellmann commented 1 year ago

The build system uses Paver. The commands you can use are all defined in https://github.com/dhellmann/pymotw-3/blob/master/pavement.py. For example, https://github.com/dhellmann/pymotw-3/blob/master/pavement.py#L191 implements the paver html command.

nazarepiedady commented 1 year ago

@dhellmann Good, I am almost there, it is running but it breaks at this point:

➜  paver html  
---> pavement.html
---> sphinxcontrib.paverutils.html
mkdir_p path('./build')
mkdir_p path('./build/html')
mkdir_p path('./build/doctrees')
sphinx-build -b html -d ./build/doctrees -c ./source -W ./source ./build/html
Running Sphinx v7.2.3
initializing tableref
initializing figureref
Initializing BitBucket plugin
defining table role
defining figure role
building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 184 source files that are out of date
updating environment: [new config] 184 added, 0 changed, 0 removed
reading sources... [ 58%] pdb/index
Exception occurred:
  File "/home/nazare/Public/github/pymotw-3-pt/venv/lib/python3.10/site-packages/sphinx/ext/extlinks.py", line 108, in role
    title = caption % part
TypeError: not all arguments converted during string formatting
The full traceback has been saved in /tmp/sphinx-err-8ehzspdb.log, if you want to report the issue to the developers.                                                     
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

Captured Task Output:
---------------------

---> pavement.html
---> sphinxcontrib.paverutils.html
mkdir_p path('./build')
mkdir_p path('./build/html')
mkdir_p path('./build/doctrees')
sphinx-build -b html -d ./build/doctrees -c ./source -W ./source ./build/html

Build failed running pavement.html: Subprocess return code: 2
nazarepiedady commented 1 year ago

@dhellmann I formatted all .rst documents inside the project to break rows only in front of a paragraph, could be it the cause?

How can I set the tools to ignore the string formatting?

dhellmann commented 1 year ago

That error looks like it's a change in how the extlinks extension to Sphinx works. It may have been triggered by using a newer version of Sphinx, I'm not sure. It does not seem likely that it is related to whitespace changes in the input files.

nazarepiedady commented 1 year ago

@dhellmann, I would like to migrate from paver to just using sphnix, what are your recommendations?

dhellmann commented 1 year ago

You could look at how paver is calling sphinx. I really don't remember all of the customizations that are in place there. Some of it had to do with integrating cog to generate the inline examples.

nazarepiedady commented 1 year ago

@dhellmann thanks for your time, I installed locally the python 3.7.1 version which you said on the site was the version used to build the site and test the code examples. I had some progress, the site is building locally but the algorithm that generates the stylesheets in the pavement.py is not compiling the .less code even considering that I have lessc installed globally.

If something goes out of the normal I will contact you, cheers.