I've followed this installation guide but on the last part where it says:

Revert back the swap size to its original value of 100MB by editing the /etc/dphys-swapfile. And, restart the service by issuing commands."

I type in:

sudo /etc/init.d/dphys-swapfile restart

But it says:

no such file or directory

But its still in the same place, what should I do?

  • 1
    You don't need to build opencv yourself any more. Install it from piwheels: blog.piwheels.org/new-opencv-builds Apr 1, 2019 at 16:41
  • Well its pretty much done i just need to find out how to fix this problem if not ill try that
    – Entity
    Apr 1, 2019 at 16:45
  • Try rebooting. It will automatically restart when you reboot the pi. Apr 1, 2019 at 20:26
  • It worked but when i tried to run a simple process some of the commands won't read such as cv2.imshow() or cv2.imread () along with the waitkey() everything else works fine but a few necessary likes of code. Is it that i dont have have depencies for them or is it something else?
    – Entity
    Apr 2, 2019 at 16:14

1 Answer 1


It seems that the author of that tutorial you have linked hasn't learned that Raspbian uses systemd instead of old style SysV init system since years. Try to restart the swapfile service with:

rpi ~$ sudo systemctl restart dphys-swapfile.service

and check with:

rpi ~$ systemctl status dphys-swapfile.service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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