gbdev / pandocs

The single, most comprehensive Game Boy technical reference.

Home Page:https://gbdev.io/pandocs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to deploy with python version 3.10 and above

alloncm opened this issue · comments

Hi, I was trying to to deploy the site locally on my Windows 10 machine.
After following the instructions in the DEPLOY.md file I was greeted with this error for mdbook serve command:

2022-11-08 21:57:18 [INFO] (mdbook::book): Book building has started
    Finished release [optimized] target(s) in 0.28s
     Running `target\release\pandocs-preproc.exe supports html`
    Finished release [optimized] target(s) in 0.26s
     Running `target\release\pandocs-preproc.exe`
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Window" (using chapter "Scrolling")
warning: Referencing multiply-defined section "Window" (using chapter "Scrolling")
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
2022-11-08 21:57:21 [INFO] (mdbook::book): Running the html backend
    Finished release [optimized] target(s) in 0.27s
     Running `target\release\pandocs-preproc.exe supports linkcheck`
    Finished release [optimized] target(s) in 0.29s
     Running `target\release\pandocs-preproc.exe`
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Window" (using chapter "Scrolling")
warning: Referencing multiply-defined section "Window" (using chapter "Scrolling")
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
2022-11-08 21:57:24 [INFO] (mdbook::book): Running the linkcheck backend
2022-11-08 21:57:24 [INFO] (mdbook::renderer): Invoking the "linkcheck" renderer
2022-11-08 21:57:24 [WARN] (mdbook::renderer): The command `mdbook-linkcheck` for backend `linkcheck` was not found, but was marked as optional.
    Finished release [optimized] target(s) in 0.30s
     Running `target\release\pandocs-preproc.exe supports pandocs`
    Finished release [optimized] target(s) in 0.49s
     Running `target\release\pandocs-preproc.exe`
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Window" (using chapter "Scrolling")
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
2022-11-08 21:57:26 [INFO] (mdbook::book): Running the pandocs backend
2022-11-08 21:57:26 [INFO] (mdbook::renderer): Invoking the "pandocs" renderer
   Compiling pandocs-renderer v0.1.0 (C:\Users\Alon\source\pandocs\renderer)
    Finished release [optimized] target(s) in 10.36s
     Running `C:\Users\Alon\source\pandocs\target\release\pandocs-renderer.exe`
Traceback (most recent call last):
  File "C:\Users\Alon\source\pandocs\docs\pandocs\imgs\src\graph_render.py", line 1, in <module>
    import pygal
  File "C:\Python310\lib\site-packages\pygal\__init__.py", line 33, in <module>
    from pygal.graph.bar import Bar
  File "C:\Python310\lib\site-packages\pygal\graph\bar.py", line 27, in <module>
    from pygal.graph.graph import Graph
  File "C:\Python310\lib\site-packages\pygal\graph\graph.py", line 26, in <module>
    from pygal._compat import is_list_like, is_str, to_str
  File "C:\Python310\lib\site-packages\pygal\_compat.py", line 23, in <module>
    from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (C:\Python310\lib\collections\__init__.py)
Error: Generating "MBC5_Rumble_Mild.csv" failed with exit code: 1
error: process didn't exit successfully: `C:\Users\Alon\source\pandocs\target\release\pandocs-renderer.exe` (exit code: 1)
2022-11-08 21:57:48 [ERROR] (mdbook::renderer): Renderer exited with non-zero return code.
2022-11-08 21:57:48 [ERROR] (mdbook::utils): Error: Rendering failed
2022-11-08 21:57:48 [ERROR] (mdbook::utils):    Caused By: The "pandocs" renderer failed

It seems that pygal which is a dependency of graph_render.py support only until python version 3.9.
The Github repo doesn't seem very active (last commit is 1 year old) so I'm not sure if they going to support new versions of python.

P.S. In order to run the renderer I had to change the python command it uses on Windows from py3 to python here, I have never invoked python on a Windows machine with py3 but always with python or python3 so I'm not sure if this is expected and just problem with my installation or not.

cc @pinobatch on that PS

collections.Iterable needs to become collections.abc.Iterable in newer Python. You may be able to replace this:

from collections import Iterable

with this:

from collections.abc import Iterable

Warren Weckesser's answer on Stack Overflow claims that this breaking change was announced in 3.9 (deprecation) and put in place in 3.10 (removal).

Hi, I was trying to to deploy the site locally on my Windows 10 machine. After following the instructions in the DEPLOY.md file I was greeted with this error for mdbook serve command:

2022-11-08 21:57:18 [INFO] (mdbook::book): Book building has started
    Finished release [optimized] target(s) in 0.28s
     Running `target\release\pandocs-preproc.exe supports html`
    Finished release [optimized] target(s) in 0.26s
     Running `target\release\pandocs-preproc.exe`
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Window" (using chapter "Scrolling")
warning: Referencing multiply-defined section "Window" (using chapter "Scrolling")
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
2022-11-08 21:57:21 [INFO] (mdbook::book): Running the html backend
    Finished release [optimized] target(s) in 0.27s
     Running `target\release\pandocs-preproc.exe supports linkcheck`
    Finished release [optimized] target(s) in 0.29s
     Running `target\release\pandocs-preproc.exe`
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Window" (using chapter "Scrolling")
warning: Referencing multiply-defined section "Window" (using chapter "Scrolling")
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
2022-11-08 21:57:24 [INFO] (mdbook::book): Running the linkcheck backend
2022-11-08 21:57:24 [INFO] (mdbook::renderer): Invoking the "linkcheck" renderer
2022-11-08 21:57:24 [WARN] (mdbook::renderer): The command `mdbook-linkcheck` for backend `linkcheck` was not found, but was marked as optional.
    Finished release [optimized] target(s) in 0.30s
     Running `target\release\pandocs-preproc.exe supports pandocs`
    Finished release [optimized] target(s) in 0.49s
     Running `target\release\pandocs-preproc.exe`
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Palettes" (using chapter "Palettes")
warning: Referencing multiply-defined section "Window" (using chapter "Scrolling")
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: The Cartridge Header: Internal anchor link "#0144–0145 — New licensee code" not found, keeping as-is
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
warning: Referencing multiply-defined section "0000-1FFF - RAM Enable (Write Only)" (using chapter "Gameboy_Camera")
2022-11-08 21:57:26 [INFO] (mdbook::book): Running the pandocs backend
2022-11-08 21:57:26 [INFO] (mdbook::renderer): Invoking the "pandocs" renderer
   Compiling pandocs-renderer v0.1.0 (C:\Users\Alon\source\pandocs\renderer)
    Finished release [optimized] target(s) in 10.36s
     Running `C:\Users\Alon\source\pandocs\target\release\pandocs-renderer.exe`
Traceback (most recent call last):
  File "C:\Users\Alon\source\pandocs\docs\pandocs\imgs\src\graph_render.py", line 1, in <module>
    import pygal
  File "C:\Python310\lib\site-packages\pygal\__init__.py", line 33, in <module>
    from pygal.graph.bar import Bar
  File "C:\Python310\lib\site-packages\pygal\graph\bar.py", line 27, in <module>
    from pygal.graph.graph import Graph
  File "C:\Python310\lib\site-packages\pygal\graph\graph.py", line 26, in <module>
    from pygal._compat import is_list_like, is_str, to_str
  File "C:\Python310\lib\site-packages\pygal\_compat.py", line 23, in <module>
    from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (C:\Python310\lib\collections\__init__.py)
Error: Generating "MBC5_Rumble_Mild.csv" failed with exit code: 1
error: process didn't exit successfully: `C:\Users\Alon\source\pandocs\target\release\pandocs-renderer.exe` (exit code: 1)
2022-11-08 21:57:48 [ERROR] (mdbook::renderer): Renderer exited with non-zero return code.
2022-11-08 21:57:48 [ERROR] (mdbook::utils): Error: Rendering failed
2022-11-08 21:57:48 [ERROR] (mdbook::utils):    Caused By: The "pandocs" renderer failed

It seems that pygal which is a dependency of graph_render.py support only until python version 3.9. The Github repo doesn't seem very active (last commit is 1 year old) so I'm not sure if they going to support new versions of python.

P.S. In order to run the renderer I had to change the python command it uses on Windows from py3 to python here, I have never invoked python on a Windows machine with py3 but always with python or python3 so I'm not sure if this is expected and just problem with my installation or not.

Hi @alloncm , we do not support Python 3.10 at the time being. pygal doesn't look like it's receiving commits anymore. Please check how to install python 3.9 on your system (e.g. https://github.com/pyenv/pyenv#windows). I will create an issue about migrating from pygal to another plot making library.

collections.Iterable needs to become collections.abc.Iterable in newer Python. You may be able to replace this:

from collections import Iterable

with this:

from collections.abc import Iterable

Warren Weckesser's answer on Stack Overflow claims that this breaking change was announced in 3.9 (deprecation) and put in place in 3.10 (removal).

Hi @pinobatch, I think @ISSOtm wanted your comment on my P.S. section at the end.

Short answer: I have never seen the name py3 in use. Therefore, I don't know.

I do not know an authoritative answer to the exact question that you asked. Because I was mentioned, I am offering answers to related questions to which I do know the answer. Apparently the answer I gave previously was not related enough. This second attempt, answering specifically the P.S. about names of Python interpreters on various operating systems, needs quite a bit of background explanation because I don't know how familiar other people reading this issue are with the history of CPython packaging conventions across both UNIX and Windows.

UNIX conventionally determines a program's type by reading its header, which for an interpreted script is its first line, called a "shebang line" after its first two characters (#!). Windows, by contrast, determines a file's type solely based on its extension. It cannot read anything from the file to determine the file's type because the file may have been archived to a tape in a nearline storage system, and opening would take a minute or more for a robot to pull the tape from a library, insert it into a tape drive, and fast-forward to the file. See "Taxes redux: You can’t open the file until the user tells you to open it" by Raymond Chen.

Because both Python 2 programs and Python 3 programs have names conventionally ending in .py (or .pyw for programs that don't use a terminal window), it was difficult for users to operate a Windows PC in which Python versions 3.0 through 3.2 coexisted with Python version 2.6 or 2.7 in which to run those scripts not yet ported to Python 3. The workaround introduced in Python 3.3 was Python Launcher for Windows (PEP 0397), a program that reads the first line of a file to determine which of several installed Python interpreters to use to run a particular file. This program is installed as %WINDIR%\py.exe (usually C:\Windows\py.exe), which is always on the PATH regardless of whether the program starting the script is 32-bit on 32-bit Windows, 32-bit on 64-bit Windows, or 64-bit on 64-bit Windows.

Under UNIX, CPython 2 was conventionally called /usr/bin/python2.7, with a symlink from /usr/bin/python for compatibility with programs that invoke Python 2 scripts using that interpreter. Minor versions of CPython 3 are called /usr/bin/python3.8, /usr/bin/python3.9, and /usr/bin/python3.10, with /usr/bin/python3 a symbolic link to the primary version used by an operating system. Windows, on the other hand, calls different interpreters python.exe, puts them in separate folders, and keeps a list of all installed Python interpreters in the registry for py.exe to read. (I don't know whether this covers only CPython or also competing implementations of Python, such as PyPy or IronPython.) One or none of these python.exe files may be in a folder on the current PATH. py.exe is always on the PATH. When you changed the Python command to python, the implementation of ShellExecute in the Windows system library resolved it to whatever python.exe was on the PATH. (My own makefiles use py to invoke Python scripts on Windows because it works even if the user chose not to add a particular Python version to the PATH during installation.)

I may have avoided answering the P.S. because I personally have never seen the command py3 in use on any system.

Thank you very much for the detailed answer!

Then I guess py3 was an accident and can safely be removed.