How did you install pySFML ? By adding the sonkun/sfml-stable repository ?
This issue is from the release candidate of SFML2 which is still the current version used in this repository. In other word, you're using pySFML 1.2 which is based on SFML2-RC. The current version of pySFML is 1.3 and is based on SFML2 (which fixes it). The repository should get updated as soon I fix the package bug >.< and Ubuntu will invite you to update python-sfml package as well as the libsfml package automatically. Don't worry, there are minor API changes between 1.2 and 1.3 so you could stick with 1.2 until the repository is updated, the transition won't be hard. Or you can compile 1.3 by hand but you'll need Cython and SFML2.0 installed manually.
Anyway, here the workarounds:
1) Create the window before loading any GL resources
window = sfmlg.RenderWindow(sf.window.VideoMode(800, 600), "Snake")
#first the window, then imagefactory.Loader()
loader = imagefactory.Loader()
2) If your computer has a nvidia discrete cards using Optimus technology, install Bumblebee (google it) and run your program using the nvidia card:
optirun python3 main.pyBy the way, why
from sfml.graphics import sfmlg