Search code examples
pythonwindowspycharmtensorboard

Kill a process in Windows 10 from the PyCharm command line


I would like to use Tensorboard on a Python application. When I start it using the command line of PyCharm in Windows 10, I get the following message:

"Reusing TensorBoard on port 8111 (pid 10180), started 0:23:16 ago. (Use '!kill 10180' to kill it.)

This means, that I have already used this port number. Unfortunately the instructions don't work. I want to kill the process on port 8111 (pid 10180). So I tried several commands (from this website https://winaero.com/kill-process-windows-10/#Kill_a_process_using_PowerShell) that all did not work, with and without exlamation point:

!taskkill /pid 10180
!taskkill /F /pid 10180
!taskkill 10180
!taskkill pid 10180
!Stop-Process -ID 10180 -Force
!Stop-Process -pid 10180 -Force

Would anyone mind telling me how to kill the process such that I can start Tensorboard again on the same port? I'll appreciate every comment.


Solution

  • Updated Answer:

    Essentially this problem is caused by temporary files not being deleted, as I found here. The solution for this is to type import tempfile and tempfile.gettempdir() into the console to return the path to the temporary file directory. Copy and paste this into the file explorer and navigate into the .tensorboard-info folder and delete anything inside. This will clear all the processes tensorboard thinks it is running, which should stop the issue from happening.

    The reason this issue is happening is that if tensorboard closes unexpectedly it leaves behind temporary files that should have been cleaned up after the process stops. Because of this any new tensorboard process checks the temp folder and finds a file which indicates that another instance is running, even though it no longer is.