This is happening after your kernel is dying unexpectedly. It leaves the Mongo Database running.
You can check for this in two steps:
- run by hand the same command as FiftyOne. You have the path to it in the
Subprocess [...]
log line. In your case, run this in your terminal:
/home/isaac/.local/lib/python3.8/site-packages/fiftyone/db/bin/mongod --dbpath '/home/isaac/.fiftyone/var/lib/mongo' --port 0 --nounixsocket
(extracted from the error you posted by removing the quotes and commas where necessary, as well as the log path argument)
You will then see the error messages, which includes something like this:
{"t":{"$date":"2023-08-21T10:01:46.459+00:00"},"s":"E", "c":"CONTROL", "id":20557, "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"DBPathInUse: Unable to lock the lock file: /home/isaac/.fiftyone/var/lib/mongo/mongod.lock (Resource temporarily unavailable). Another mongod instance is already running on the /home/isaac/.fiftyone/var/lib/mongo directory"}}
This clearly says there is another mongod
running (the error:
part of the message). Which brings us to the second step:
- run
ps -ef | grep [m]ongo
in another terminal window. You will see one line with the running process.
isaac 31820 1 1 08:47 ? 00:01:03 /home/isaac/miniconda3/envs/test-env/lib/python3.9/site-packages/fiftyone/db/bin/mongod --dbpath /home/isaac/.fiftyone/var/lib/mongo --logpath /home/isaac/.fiftyone/var/lib/mongo/log/mongo.log --port 0 --nounixsocket
This is what was left behind by the crashed kernel. You have to stop it:
kill 31820
The number is the process ID that appeared in the second column in the ps
output. If it doesn't work, you can do kill -9 31820
(a more aggressive process termination).
If you did the regular kill
(without -9
), then all should be good, you can restart your kernel and import fiftyone
.
But if you had to use -9
, then it is possible that the lock file is lingering on the disk. You have to remove it. Find the path in the initial error message and remove that file: rm /home/isaac/.fiftyone/var/lib/mongo/mongod.lock
Now all should be OK.