This is a cached version of https://tomwojcik.com/posts/2021-01-20/filenotfound-fragmentpy-pycharm from 2/28/2026, 3:13:56 PM.
Fix broken PyCharm environment with docker | Tom Wojcik
How to fix the FileNotFoundError for fragment.py when PyCharm's Docker helpers get corrupted.
Fix broken PyCharm environment with docker January 20, 2021 pycharmdocker Broken Pycharm Helpers Every now and then my docker setup in PyCharm is broken. It usually happens when I run debugger and immediately stop it because I found an error. It might result in different error depending on the PyCharm or Docker version but the root of the traceback is always the same, it’s pycharm_helpers that PyCharm is using to setup a docker env. My full traceback Traceback (most recent call last): File "/opt/.pycharm_helpers/pydev/pydevd.py", line 1477, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/opt/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 11, in execfile stream = tokenize.open(file) # @UndefinedVariable File "/usr/local/lib/python3.8/tokenize.py", line 392, in open buffer = _builtin_open(filename, 'rb') FileNotFoundError: [Errno 2] No such file or directory: '/fragment.py' As Google returns no results for that one, I assume it’s not a very popular problem. What it is PyCharm is populating a volume using a container. So it first downloads a pycharm_helpers image with a tag corresponding to your PyCharm build number. Then docker volumes are created from this image. After that you can see /opt/.pycharm_helpers when running your containers from PyCharm. So, in my case, I assume only volume is broken. Still, I’d rather recreate everything from scratch. How to solve it Close PyCharm. Stop all running containers. docker stop $(docker ps -a -q) Remove PyCharm helpers container running docker ps -a | grep -i pycharm | awk '{print $1}' | xargs docker rm Remove PyCharm helpers image running docker image ls -a | grep -i pycharm | awk '{print $3}' | xargs docker rmi Try to remove PyCharm volume with helpers docker volume ls | grep -i pycharm | awk '{print $2}' | xargs docker volume rm It will probably fail as helpers were being used in your project so there are dependent containers on pycharm helpers. You will have to remove these containers as well. What I see: Error response from daemon: remove backend_pycharm_helpers_PY-203.6682.86: volume is in use - [816ccfc6795cbd399147c52bb657673f7c97194ca47b5aa061bd1dcfbab091ea, 99459b242988cc4f0e90d609ee9895af85685653b980ff62776317c098083a8a] So remove them with docker rm 816ccfc6795cbd399147c52bb657673f7c97194ca47b5aa061bd1dcfbab091ea 99459b242988cc4f0e90d609ee9895af85685653b980ff62776317c098083a8a Now rerun docker volume ls | grep -i pycharm | awk '{print $2}' | xargs docker volume rm After that, you should be good to go.