-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Django container complains "error walking file system" when venv is installed #3083
Comments
@jmoppel I was unable to reproduce the issue. If you want, could you please record the steps you made in the terminal using https://asciinema.org/ and after sending the recording link? (Be careful to avoid showing things that could compromise security, such as passwords, tokens, etc.) Install asciinema pip3 install asciinema Create an account to able to manage your asciinema records asciinema auth Start record the steps asciinema rec -t "cookiecutter-django issue 3083" Note: asciinema rec -t "cookiecutter-django issue 3083" myrecord.cast to watch the recording, just run asciinema play myrecord.cast to upload to your account on https://asciinema.org/ asciinema upload myrecord.cast |
https://asciinema.org/a/L0Rzbuo6EgWi5EZpqgiOL6Vf7 One minor correction to the video. Before creating the video, I did a docker-compose build and then a docker-compose up. In the video I stated it was the other way around, which is not correct. For anyone who might find this issue in the future, the exact error message in the Docker console is: I have created a Docker file that corrects this problem on my machine. |
I have the same error when install a venv, docker show this log: error walking file system: FileNotFoundError [Errno 2] No such file or directory: '/app/venv/bin/python' |
@bryanus1 The fix I implemented to was to include the following lines in my local Django # Prevent 'error walking file system' when Python venv exists on host
RUN ln /usr/local/bin/python3.8 /usr/bin/python
RUN ln /usr/local/bin/python3.8 /usr/bin/python3
RUN ln /usr/local/bin/python3.8 /usr/bin/python3.8 There's probably a cleaner way to implement than what I've done, so it doesn't break for different versions of python. However, this is what we're using at the moment. I'm not certain if @luzfcb would like a pull request for this, since he hasn't been able to replicate the issue. |
@bryanus1 try to add |
Well I'm having the same issue. |
when removed the host virtual env (.venv) I created, its worked. |
I added |
@bryanus1 Did you rebuild your containers (which is required for the symlinks to be created in your container)? Run the following before trying to bring up your containers. docker-compose -f local.yml build --no-cache |
Rebuild images with this command but no works!!! |
Same here. Adding |
@bryanus1 Make a note of where the symlink |
@jmoppel |
I had the same problem, here is how I solved it. In a docker container there is no need to create a virtual environment, since docker is akin to a virtual environment, so in a container we can
|
I test your solution and works without problems, only make a change that volume must be a absolutly path, change |
It looks like this is a known issue with Watchgod that has an open pull request to fix the issue. |
In my case, @bryanus1 's solution worked:
|
What happened?
After creating a fresh project, and then docker-compose
build
andup
, The Django Docker container infinitely complains "error walking file system".What should've happened instead?
The Django container should start without any errors.
Additional details
This happens if you have a Python
venv
environment installed anywhere inside the project directory. The problem is, inside the docker container, venv symlinks to files that don't exist in the container (e.g./usr/bin/python3.8
). I have avenv
to test changes to requirements locally instead of waiting for a docker-compose build to fail (which takes a lot longer).Steps to reproduce
Inside a new or existing cookiecutter project directory
Stop the containers (ctrl-c). Now, create a new python venv
Now bring up your containers and the Django Container will constantly complain "error walking file system":
I assume this is
watchgod
complaining. Let me know if this is correct or not.If you're open to a fix for this issue, I'll open a pull request to update the Dockerfile and fix this problem.
The text was updated successfully, but these errors were encountered: