-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
SyntaxWarning: "invalid escape sequence '\.'" coming from pypandoc
dependency
#1722
Comments
pypandoc
dependency
Thank you for filing this issue. At first glance this looks like you installed aider in an environment with many other Python modules and aider's dependencies got mixed up. Can you please try to install aider in a separate Python environment? Either with This document may be helpful -> https://aider.chat/docs/troubleshooting/imports.html |
I have noticed the same error in a different project, completely unrelated to aider. The issue is in the Ref. https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1994136.html |
The introduction of pydub also seems to have introduced more of these warnings aider-sandbox$ uv venv --python 3.12 --no-project --seed venv312
aider-sandbox$ uv python find
/home/neal/workspace/aider-sandbox/venv312/bin/python3
neal@neal-xps:aider-sandbox$ uv pip install --no-cache aider-chat
Resolved 84 packages in 1.41s
Built pyperclip==1.9.0
Prepared 84 packages in 4.02s
Installed 84 packages in 48ms
+ aider-chat==0.59.1
+ aiohappyeyeballs==2.4.0
+ aiohttp==3.10.5
+ aiosignal==1.3.1
+ annotated-types==0.7.0
+ anyio==4.6.0
+ attrs==24.2.0
+ backoff==2.2.1
+ beautifulsoup4==4.12.3
+ certifi==2024.8.30
+ cffi==1.17.1
+ charset-normalizer==3.3.2
+ click==8.1.7
+ configargparse==1.7
+ diff-match-patch==20230430
+ diskcache==5.6.3
+ distro==1.9.0
+ filelock==3.16.1
+ flake8==7.1.1
+ frozenlist==1.4.1
+ fsspec==2024.9.0
+ gitdb==4.0.11
+ gitpython==3.1.43
+ grep-ast==0.3.3
+ h11==0.14.0
+ httpcore==1.0.5
+ httpx==0.27.2
+ huggingface-hub==0.25.0
+ idna==3.10
+ importlib-metadata==7.2.1
+ importlib-resources==6.4.5
+ jinja2==3.1.4
+ jiter==0.5.0
+ json5==0.9.25
+ jsonschema==4.23.0
+ jsonschema-specifications==2023.12.1
+ litellm==1.47.0
+ markdown-it-py==3.0.0
+ markupsafe==2.1.5
+ mccabe==0.7.0
+ mdurl==0.1.2
+ multidict==6.1.0
+ networkx==3.2.1
+ numpy==1.26.4
+ openai==1.47.0
+ packaging==24.1
+ pathspec==0.12.1
+ pexpect==4.9.0
+ pillow==10.4.0
+ prompt-toolkit==3.0.47
+ psutil==6.0.0
+ ptyprocess==0.7.0
+ pycodestyle==2.12.1
+ pycparser==2.22
+ pydantic==2.9.2
+ pydantic-core==2.23.4
+ pydub==0.25.1
+ pyflakes==3.2.0
+ pygments==2.18.0
+ pypandoc==1.13
+ pyperclip==1.9.0
+ python-dotenv==1.0.1
+ pyyaml==6.0.2
+ referencing==0.35.1
+ regex==2024.9.11
+ requests==2.32.3
+ rich==13.8.1
+ rpds-py==0.20.0
+ scipy==1.13.1
+ smmap==5.0.1
+ sniffio==1.3.1
+ sounddevice==0.5.0
+ soundfile==0.12.1
+ soupsieve==2.6
+ tiktoken==0.7.0
+ tokenizers==0.19.1
+ tqdm==4.66.5
+ tree-sitter==0.21.3
+ tree-sitter-languages==1.10.2
+ typing-extensions==4.12.2
+ urllib3==2.2.3
+ wcwidth==0.2.13
+ yarl==1.11.1
+ zipp==3.20.2
aider-sandbox$ aider
/home/neal/workspace/aider-sandbox/venv312/lib/python3.12/site-packages/pydub/utils.py:300: SyntaxWarning: invalid escape sequence '\('
m = re.match('([su]([0-9]{1,2})p?) \(([0-9]{1,2}) bit\)$', token)
/home/neal/workspace/aider-sandbox/venv312/lib/python3.12/site-packages/pydub/utils.py:301: SyntaxWarning: invalid escape sequence '\('
m2 = re.match('([su]([0-9]{1,2})p?)( \(default\))?$', token)
/home/neal/workspace/aider-sandbox/venv312/lib/python3.12/site-packages/pydub/utils.py:310: SyntaxWarning: invalid escape sequence '\('
elif re.match('(flt)p?( \(default\))?$', token):
/home/neal/workspace/aider-sandbox/venv312/lib/python3.12/site-packages/pydub/utils.py:314: SyntaxWarning: invalid escape sequence '\('
elif re.match('(dbl)p?( \(default\))?$', token):
/home/neal/workspace/aider-sandbox/venv312/lib/python3.12/site-packages/pypandoc/pandoc_download.py:61: SyntaxWarning: invalid escape sequence '\.'
regex = re.compile(r"/jgm/pandoc/releases/download/.*(?:"+processor_architecture+"|x86|mac).*\.(?:msi|deb|pkg)") Notably when you run for the second time using the same python env, the pycache may cause the warnings to be suppressed. You can get around that by running the following after creating a fresh environment to shutoff bytecode. python -B $(which aider) Notably, the master branch of the pydub repo actually works fine Install aider-chat in a fresh environment then update pydub: neal@neal-xps:aider-sandbox$ uv venv --python 3.12 --no-project --seed venv312
Using CPython 3.12.6
Creating virtual environment with seed packages at: venv312
+ pip==24.2
Activate with: source venv312/bin/activate
neal@neal-xps:aider-sandbox$ source venv312/bin/activate
(venv312) neal@neal-xps:aider-sandbox$ uv pip install aider-chat
...
neal@neal-xps:aider-sandbox$ uv pip install --upgrade --no-cache git+https://github.com/ngharrington/pydub.git
Updated https://github.com/ngharrington/pydub.git (996cec4)
Resolved 1 package in 2.42s
Built pydub @ git+https://github.com/ngharrington/pydub.git@996cec42e9621701edb83354232b2c0ca0121560
Prepared 1 package in 620ms
Uninstalled 1 package in 0.33ms
Installed 1 package in 0.67ms
- pydub==0.25.1
+ pydub==0.25.1 (from git+https://github.com/ngharrington/pydub.git@996cec42e9621701edb83354232b2c0ca0121560)
(venv312) neal@neal-xps:aider-sandbox$ python -B $(which aider)
/home/neal/workspace/aider-sandbox/venv312/lib/python3.12/site-packages/pypandoc/pandoc_download.py:61: SyntaxWarning: invalid escape sequence '\.'
regex = re.compile(r"/jgm/pandoc/releases/download/.*(?:"+processor_architecture+"|x86|mac).*\.(?:msi|deb|pkg)")
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Aider v0.59.1
Main model: gpt-4o-2024-08-06 with diff edit format
Weak model: gpt-4o-mini
Git repo: .git with 2 files
Repo-map: using 1024 tokens, auto refresh
VSCode terminal detected, pretty output has been disabled.
Use /help <question> for help, run "aider --help" to see cmd line args
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
> As you see only the pandoc warning remains in this case. |
I've added an issue here |
If possible, do not install or update other Python modules in the same Python environment. Please use See also -> https://aider.chat/docs/troubleshooting/imports.html |
Issue
This appears to be an issue on Python 3.12 for the
pypandoc
library which aider uses. There's a patch in pypandoc where they fix this but it isn't released yet. aider'srequirements.txt
is currently set to usepypandoc==1.13
which still has the syntax warning. I think Aider will need to do something likepypandoc>=1.14
once pypandoc releases to get rid of that warning.Version and model info
Aider v0.57.1 (installed with
playright
as well)Python 3.12
The text was updated successfully, but these errors were encountered: