paul-gauthier / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
16.45k stars 1.54k forks source link

feature request: Alpine-based docker image #817

Closed Huge closed 1 month ago

Huge commented 1 month ago

I have tried building the repo in an Alpine container in an attempt to reduce the image size with pip install aider-chat and python-dev pkg before that, but failed on GRPC. The machine is a modern aarch64 laptop. aider_light_docker.dockerfile.txt

I do not understand why the default image seems so large on my system:

➜  ~ docker images                                    

REPOSITORY                                      TAG                   IMAGE ID       CREATED         SIZE
paulgauthier/aider                              v0.39.0               e864787367a5   2 weeks ago     1.41GB
paul-gauthier commented 1 month ago

Thanks for trying aider and filing this issue.

The install size went way up for aider v0.43.0. This is because aider uses vector search for the /help command, which requires pytorch. In some systems, the torch package brings in gigabytes of GPU dependencies.

I've just made some changes to dramatically reduce the size of the install. Aider will now install the CPU-only version of torch, which is much smaller.

The change is available in the main branch. You can get it by installing the latest version from github:

python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git

If you have a chance to try it, let me know if it works better for you. You may need to remove your existing virtual environment (to clean up the old install) and install in a fresh virtual env to actually reduce the disk usage.

Also, you can install aider via pipx to install it once on your system and use it within any project you are working on. This will also make sure aider's dependencies don't conflict with your python project's dependencies.

Huge commented 1 month ago

Thanks for the efforts, especially in this( minification) direction! I did pipx install git+https://github.com/paul-gauthier/aider.git on "my" system, which lead to

du -sh ~/.local/pipx/venvs/aider-chat/ 
1.6G    /home/ubuntu/.local/pipx/venvs/aider-chat/

which is still not great, especially compared to the simple <10MB binaries of alternative tools made in Go and/or Rust. And I'm saying that as a Python lover myself...

paul-gauthier commented 1 month ago

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.