I'm having this issue where PyCharm 2018.1.3 (and previous versions) doesn't allow me to Attach to Local Process even though I've changed the ptrace_scope setting outlined in the documentation here:


It just spins while waiting to attach, and it eventually just gives up and kills the debugger process.

I've restarted and it still just doesn't work. It did work prior to upgrading (16.04 and 17.10), but every 18.04 VM that I've built has this issue.

Does anyone know if there is a new setting, or configuration file to edit on this new version of Ubuntu?

  • I'm having the same problem. At first I thought it was due to the 2018.1.3 upgrade, but reverting to previous version fails as well. I then realized I've not tried attaching to a process for debugging since upgrading Ubuntu to 18.04. I always was able to attach before after using the echo 0 | tee /proc/sys/kernel/yama/ptrace_scope command. – shao.lo May 25 '18 at 16:06
  • gdb python3 processnumber still works – shao.lo May 25 '18 at 17:45
  • 1
    shao.lo said: looks like this has already been reported as a bug – guest-vm May 26 '18 at 11:20

Quite a few posts discuss this problem.

One person on StackOverflow claims to have fixed the problem. In the article PyCharm “Attach to local process” does nothing, this answer is given on Dec 15, 2017:

I made it work with the following three things after some googling and test.

  1. Fix the ptrace permission problem as described in http://askubuntu.com/questions/41629/after-upgrade-gdb-wont-attach-to-process
  2. The Python executable under pyenv is a script rather than a real executable. I switched to Ubuntu's own Python 3.5. Deleted the .idea subfolder in the project directory and .PyCharm2017.3 in home directory. After reopen the project set the Project Interpreter to the same Python 3.5
  3. Ran $ sudo apt install python3-dbg python3-dev. Not sure if this step is necessary, but I did it to make GDB be able to run the py-* command as well when searching for an alternative
  • 1st link leads to VSCode instead of PyCharm. Point 1 has already been done by OP & bounty starter (hint:ptrace_scope). Point 3 has been done too by OP of the bug report brought forth by bounty starter before this answer was posted. – guest-vm May 27 '18 at 11:48
  • This combination of actions was recently reported as working by two persons on StackOverflow. Downvote with no explanation is not helpful in ironing out a solution, which may require here a group effort . If someone has tried it and encountered a problem, then describing it will help. – harrymc May 31 '18 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.