`failed to walk directory: failed to copy file con...
# ask-ai
g
failed to walk directory: failed to copy file content for .venv/lib64: read .venv/lib: is a directory
during
lk agent create
file compression stage
t
Thanks for reaching out, Oliver. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! This error pops up because the
lk agent create
command stumbles upon a symbolic link inside your
.venv
directory while it's compressing files. To be specific, the symlink
.venv/lib64
points to
.venv/lib
(which is actually a directory), but the CLI tries to read it like it’s a file. No worries though! To fix this, you just need to exclude the
.venv
directory from your agent build context. Here’s how you can do it: • Add
.venv
to a
.dockerignore
file:
Copy code
.venv
venv/
• If you don’t have a
.dockerignore
file, you can add it to your
.gitignore
instead:
Copy code
.venv
venv/
It’s actually a good idea to exclude virtual environment directories like
.venv
because they contain platform-specific binaries and symlinks, which can bloat your build size. Plus, dependencies are best installed fresh inside the container during the Docker build process. Sources: complex-agents/nutrition-assistant/.gitignore | agent/.dockerignore | agent/.gitignore | python-agent-example-app/.dockerignore | pkg/agentfs/tar_test.go
g
I have the following in .dockerignore
Copy code
.venv/
venv/
t
You're right to exclude
.venv
in your
.dockerignore
, and that’s not what's causing the issue. To help you better, could you share the exact error message or logs you get when
lk agent create
fails? That way, we can figure out what's going on together. Sources: Builds and Dockerfiles | LiveKit Docs