I\'m getting an error when trying to execute python program that uses multiprocessing package:
File \"/usr/local/lib/python2.6/multiprocessing/__init__.py\
For POSIX semaphores to work, the users need r/w access to shared memory (/dev/shm
).
Check the permissions to /dev/shm
. On my laptop (Ubuntu) it looks like this:
$ ls -ld /dev/shm
drwxrwxrwt 2 root root 40 2010-01-05 20:34 shm
To permanently set the correct permissions (even after a reboot), add the following to your /etc/fstab
:
none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0
Haven't tried this, just copied from a forum post.
In my OVH VPS Classic, this error was caused by a loop in /dev/shm and /run/shm. Both were symlinks linking to each other. So as root here is what I did:
# rm /dev/shm
# mkdir /dev/shm
# chmod 777 /dev/shm
# nano /etc/fstab
Then I modified the shm line from:
none /dev/shm tmpfs rw 0 0
To:
none /dev/shm tmpfs rw,nosuid,nodev,noexec 0 0
Restarted the server... And that fixed the problem! Alternatively you can mount shm manually:
# mount /dev/shm
Hope this helps :-)
One simple solution without rebooting is
sudo chmod 777 /dev/shm
That solved my problem.