Skip to content

[Installation]: Ricecooker pycaption dependency update? #890

Open

Description

@kill9zombie

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: ricecooker v0.8.0
uv Python version: cpython-3.13.13-linux-x86_64-gnu

Current behavior

After following the installation docs and adding ricecooker to pyproject.toml I end up with this:

$ uv run ./linecook.py --help
/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib64/python3.13/site-packages/PyPDF2/generic.py:353: SyntaxWarning: invalid escape sequence '\c'
  tok = b_("\c")
Traceback (most recent call last):
  File "/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/./linecook.py", line 4, in <module>
    from ricecooker.chefs import LineCook
  File "/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib64/python3.13/site-packages/ricecooker/chefs.py", line 14, in <module>
    from .classes import files
  File "/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib64/python3.13/site-packages/ricecooker/classes/files.py", line 20, in <module>
    from ricecooker.utils.pipeline import FilePipeline
  File "/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib64/python3.13/site-packages/ricecooker/utils/pipeline/__init__.py", line 7, in <module>
    from .convert import ConversionStageHandler
  File "/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib64/python3.13/site-packages/ricecooker/utils/pipeline/convert.py", line 40, in <module>
    from ricecooker.utils.subtitles import build_subtitle_converter_from_file
  File "/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib64/python3.13/site-packages/ricecooker/utils/subtitles.py", line 4, in <module>
    from pycaption import CaptionReadError
  File "/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib64/python3.13/site-packages/pycaption/__init__.py", line 2, in <module>
    from .base import (
        CaptionConverter, CaptionNode, Caption, CaptionList, CaptionSet)
  File "/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib64/python3.13/site-packages/pycaption/base.py", line 3, in <module>
    from past.utils import old_div
  File "/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib64/python3.13/site-packages/past/__init__.py", line 88, in <module>
    from past.translation import install_hooks as autotranslate
  File "/home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib64/python3.13/site-packages/past/translation/__init__.py", line 35, in <module>
    import imp
ModuleNotFoundError: No module named 'imp'

Possible cause / temporary fix

I'm not much of a python developer, so I'm sure there's a better solution (possibly involving le-pycaption). But from what I've found there seems to be an open issue on python future (where it imports imp) that effects later python versions :
CharmersTraining/python-future#246

After adding pycaption>=2.1.1 to pyproject.toml and running a uv sync ricecooker works fine:

$ uv run ./linecook.py --help
Unable to load pyppeteer, using phantomjs for JS loading.
usage: linecook.py [-h] [--token TOKEN] [-u] [--debug] [-v] [--warn] [--quiet] [--compress] [--thumbnails] [--download-attempts DOWNLOAD_ATTEMPTS]
                   [--resume]
                   [--step {INIT,CONSTRUCT_CHANNEL,CREATE_TREE,DOWNLOAD_FILES,GET_FILE_DIFF,START_UPLOAD,UPLOADING_FILES,UPLOAD_CHANNEL,PUBLISH_CHANNEL,DONE,LAST}]
                   [--prompt] [--deploy] [--publish] [--sample SIZE] [--reset] [--stage] --channeldir CHANNELDIR [--channelinfo CHANNELINFO]
                   [--contentinfo CONTENTINFO] [--exercisesinfo EXERCISESINFO] [--questionsinfo QUESTIONSINFO] [--generate]
                   [--importstudioid IMPORTSTUDIOID]
                   [command]

Upload the folder hierarchy to the content workshop.

positional arguments:
  command               Desired action: dryrun or uploadchannel (default).

options:
  -h, --help            show this help message and exit
  --token TOKEN         Studio API Access Token (specify wither the token value or the path of a file that contains the token).
  -u, --update          Force file re-download (skip .ricecookerfilecache/).
  --debug               Print extra debugging infomation.
  -v, --verbose         Verbose mode (default).
  --warn                Print errors and warnings.
  --quiet               Print only errors.
  --compress            Compress videos using ffmpeg -crf=32 -b:a 32k mono.
  --thumbnails          Automatically generate thumbnails for content nodes.
  --download-attempts DOWNLOAD_ATTEMPTS
                        Maximum number of times to retry downloading files.
  --resume              Resume chef session from a specified step.
  --step {INIT,CONSTRUCT_CHANNEL,CREATE_TREE,DOWNLOAD_FILES,GET_FILE_DIFF,START_UPLOAD,UPLOADING_FILES,UPLOAD_CHANNEL,PUBLISH_CHANNEL,DONE,LAST}
                        Step to resume progress from (use with the --resume).
  --prompt              Prompt user to open the channel after the chef run.
  --deploy              Immediately deploy changes to channel's main tree. This operation will overwrite the previous channel content. Use only during
                        development.
  --publish             Publish newly uploaded version of the channel.
  --sample SIZE         Upload a sample of SIZE nodes from the channel.
  --reset               (deprecated) Restarting the chef run is the default.
  --stage               (deprecated) Stage updated content for review. Uploading a staging tree is now the default behavior. Use --deploy to upload to the
                        main tree.
  --channeldir CHANNELDIR
                        The directory that corresponds to the root of the channel.
  --channelinfo CHANNELINFO
                        Filename for the channel metadata (assumed to be sibling of channeldir)
  --contentinfo CONTENTINFO
                        Filename for content metadata (assumed to be sibling of channeldir)
  --exercisesinfo EXERCISESINFO
                        Filename for execises metadata (assumed to be sibling of channeldir)
  --questionsinfo QUESTIONSINFO
                        Filename for execise questions metadata (assumed to be sibling of channeldir)
  --generate            Generate metadata files from directory stucture.
  --importstudioid IMPORTSTUDIOID
                        Generate CSV metadata from a specified studio_id (e.g. studio_id of main_tree for some channel)

Later versions of pycaption seem to clash with beautifulsoup4 dependencies in ricecooker.

AI usage

None, just search.

Activity

  1. learning-equality-bot commented on Nov 11, 2026

    @learning-equality-bot
    Contributor

    🔍 Thanks for opening this issue! @rtibblesbot will check it against the code and comment with its findings.

    What happens next:

    • The community-issue-review label stays on until the review comment is posted.
    • The comment identifies the files, lines, or commits examined so you can follow the reasoning and respond if you disagree.
    • If the check confirms the issue, @rtibblesbot may also correct the title and description. GitHub preserves the edit history, so the original text remains available.
    • @rtibblesbot's comments are LLM-generated, so please evaluate them critically.

    A maintainer decides what happens next. This check does not close the issue.

  2. rtibblesbot commented on Nov 11, 2026

    @rtibblesbot
    Contributor

    Verdict: claim does not hold
    Evidence: pyproject.toml:41 (le-pycaption>=2.2.0a1), uv.lock:529 (future 1.0.0), git show v0.8.0:setup.py (no future pin); import pycaption run on Python 3.13 with le-pycaption==2.2.0a1 and each future version

    The report says ricecooker v0.8.0 fails to import on Python 3.13 because the future package that le-pycaption depends on runs import imp.

    What the code and the packages actually do:

    • Neither v0.8.0 (setup.py) nor main pins future. le-pycaption 2.2.0a1 requires future with no version bound, so a fresh install resolves future 1.0.0, which is also the version in main's uv.lock.
    • In future 1.0.0, past/__init__.py no longer imports past.translation, and import imp is behind a version guard. import pycaption and from pycaption import CaptionReadError both succeed on Python 3.13.12.
    • With future==0.18.3 the same import fails on 3.13 with ModuleNotFoundError: No module named 'imp'. The traceback in the report (past/__init__.py:88 importing past.translation, import imp at past/translation/__init__.py:35) comes from a future release older than 1.0.0.
    • CI on main tests Python 3.10–3.14 (.github/workflows/pythontest.yml:43).

    The failure therefore comes from an environment that resolved future older than 1.0.0, not from a constraint ricecooker sets. To check, run uv pip show future in that project. uv add "future>=1.0.0" fixes it without swapping in pycaption. Both pycaption and le-pycaption install the same pycaption import package, so adding pycaption>=2.1.1 replaces the module that ricecooker depends on.

    The PyPDF2 SyntaxWarning comes from v0.8.0's pypdf2==1.26.0 pin. main replaced that pin with pypdf==6.20.1 (db50d9c).

    Recommended close: not_planned. A maintainer can ask for it in a reply mentioning @rtibblesbot.


    Written by rtibblesbot, an LLM-based coding agent.

  3. kill9zombie commented on Nov 11, 2026

    @kill9zombie
    Author

    Aha, in my older environment I have this:

    ➜  sushi-chef-tfl git:(main) ✗ uv pip show future
    Name: future
    Version: 0.15.2
    Location: /home/philh/code/kolibri/sushi-chefs/sushi-chef-tfl/.venv/lib/python3.13/site-packages
    Requires:
    Required-by: le-pycaption, linecook
    

    I must have set it up initially with an older version of something.

    When I setup a fresh environment:

    ➜  sushi-chefs mkdir test-chef                                                                                                                                
    ➜  sushi-chefs cd test-chef
    ➜  test-chef uv python pin 3.13                                                                                                                               
    Pinned `.python-version` to `3.13`                                                                                                                            
    ➜  test-chef                                                                                                                                                  
    ➜  test-chef uv init                                                           
    Initialized project `test-chef`                                                                                                                               
    ➜  test-chef git:(main) ✗
    ➜  test-chef git:(main) ✗ uv add ricecooker
    
    .. add a linecook.py
    
    ➜  test-chef git:(main) ✗ uv run ./linecook.py --help                                                                                                         
    /home/philh/code/kolibri/sushi-chefs/test-chef/.venv/lib64/python3.13/site-packages/PyPDF2/generic.py:353: SyntaxWarning: invalid escape sequence '\c'        
      tok = b_("\c")                                                               
    /home/philh/code/kolibri/sushi-chefs/test-chef/.venv/lib64/python3.13/site-packages/pycaption/dfxp/base.py:174: SyntaxWarning: invalid escape sequence '\s'   
      pattern = re.compile(u"^(?:[\n\r]+\s*)?(.+)")                                                                                                               
    /home/philh/code/kolibri/sushi-chefs/test-chef/.venv/lib64/python3.13/site-packages/pycaption/sami.py:262: SyntaxWarning: invalid escape sequence '\s'        
      pattern = re.compile("^(?:[\n\r]+\s*)?(.+)")                                                                                                                
    /home/philh/code/kolibri/sushi-chefs/test-chef/.venv/lib64/python3.13/site-packages/future/backports/html/parser.py:31: SyntaxWarning: invalid escape sequence
     '\s'                                                                          
      tagfind = re.compile('([a-zA-Z][-.a-zA-Z0-9:_]*)(?:\s|/(?!>))*')                                                                                            
    /home/philh/code/kolibri/sushi-chefs/test-chef/.venv/lib64/python3.13/site-packages/future/backports/html/parser.py:79: SyntaxWarning: invalid escape sequence
     '\s'                                                                          
      endtagfind = re.compile('</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>')                                                                                              
    /home/philh/code/kolibri/sushi-chefs/test-chef/.venv/lib64/python3.13/site-packages/pycaption/webvtt.py:24: SyntaxWarning: invalid escape sequence '\S'       
      TIMING_LINE_PATTERN = re.compile('^(\S+)\s+-->\s+(\S+)(?:\s+(.*?))?\s*$')    
    /home/philh/code/kolibri/sushi-chefs/test-chef/.venv/lib64/python3.13/site-packages/pycaption/webvtt.py:25: SyntaxWarning: invalid escape sequence '\d'       
      TIMESTAMP_PATTERN = re.compile('^(\d+):(\d{2})(:\d{2})?\.(\d{3})')                                                                                          
    /home/philh/code/kolibri/sushi-chefs/test-chef/.venv/lib64/python3.13/site-packages/pycaption/webvtt.py:29: SyntaxWarning: invalid escape sequence '\d'       
      '</?([cibuv]|ruby|rt|lang|(\d+):(\d{2})(:\d{2})?\.(\d{3})).*?>'              
    Unable to load pyppeteer, using phantomjs for JS loading.                                                                                                     
    usage: linecook.py [-h] [--token TOKEN] [-u] [--debug] [-v] [--warn] [--quiet] [--compress] [--thumbnails] [--download-attempts DOWNLOAD_ATTEMPTS]            
                       [--resume]                                                                                                                                 
                       [--step {INIT,CONSTRUCT_CHANNEL,CREATE_TREE,DOWNLOAD_FILES,GET_FILE_DIFF,START_UPLOAD,UPLOADING_FILES,UPLOAD_CHANNEL,PUBLISH_CHANNEL,DONE,L
    AST}]                                                                                                                                                         
                       [--prompt] [--deploy] [--publish] [--sample SIZE] [--reset] [--stage] --channeldir CHANNELDIR [--channelinfo CHANNELINFO]                  
                       [--contentinfo CONTENTINFO] [--exercisesinfo EXERCISESINFO] [--questionsinfo QUESTIONSINFO] [--generate]                                   
                       [--importstudioid IMPORTSTUDIOID]                           
                       [command]   
                                                                                   
    Upload the folder hierarchy to the content workshop.                           
                                                                                   
    positional arguments:                                                                                                                                         
      command               Desired action: dryrun or uploadchannel (default).                                                                                    
                                           
    options:                                                                       
      -h, --help            show this help message and exit                                                                                                       
      --token TOKEN         Studio API Access Token (specify wither the token value or the path of a file that contains the token).                               
      -u, --update          Force file re-download (skip .ricecookerfilecache/).   
      --debug               Print extra debugging infomation.                      
      -v, --verbose         Verbose mode (default).                                
      --warn                Print errors and warnings.                             
      --quiet               Print only errors.                                     
      --compress            Compress videos using ffmpeg -crf=32 -b:a 32k mono.    
      --thumbnails          Automatically generate thumbnails for content nodes.   
      --download-attempts DOWNLOAD_ATTEMPTS                                        
                            Maximum number of times to retry downloading files.    
      --resume              Resume chef session from a specified step.                                                                                            
      --step {INIT,CONSTRUCT_CHANNEL,CREATE_TREE,DOWNLOAD_FILES,GET_FILE_DIFF,START_UPLOAD,UPLOADING_FILES,UPLOAD_CHANNEL,PUBLISH_CHANNEL,DONE,LAST}              
                            Step to resume progress from (use with the --resume).  
      --prompt              Prompt user to open the channel after the chef run.                                                                                   
      --deploy              Immediately deploy changes to channel's main tree. This operation will overwrite the previous channel content. Use only during        
                            development.                                           
      --publish             Publish newly uploaded version of the channel.         
      --sample SIZE         Upload a sample of SIZE nodes from the channel.        
      --reset               (deprecated) Restarting the chef run is the default.                                                                                  
      --stage               (deprecated) Stage updated content for review. Uploading a staging tree is now the default behavior. Use --deploy to upload to the    
                            main tree.
      --channeldir CHANNELDIR                                                                                                                                     
                            The directory that corresponds to the root of the channel.                                                                            
      --channelinfo CHANNELINFO                                                                                                                                   
                            Filename for the channel metadata (assumed to be sibling of channeldir)                                                               
      --contentinfo CONTENTINFO                                                                                                                                   
                            Filename for content metadata (assumed to be sibling of channeldir)                                                                   
      --exercisesinfo EXERCISESINFO                                                                                                                               
                            Filename for execises metadata (assumed to be sibling of channeldir)                                                                  
      --questionsinfo QUESTIONSINFO                                                                                                                               
                            Filename for execise questions metadata (assumed to be sibling of channeldir)                                                         
      --generate            Generate metadata files from directory stucture.                                                                                      
      --importstudioid IMPORTSTUDIOID                                                                                                                             
                            Generate CSV metadata from a specified studio_id (e.g. studio_id of main_tree for some channel)
    

    The new environment does use future==1.0.0.

    Is there an option to update the installation docs a little to help people that don't use Python very often?

  4. bjester commented on Nov 11, 2026

    @bjester
    Member

    @kill9zombie Yeah I think it'd be okay to add something to the docs. You could open a PR your change and reference this issue if you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions