Building Python Library

Hi! I have been struggling with building the Blender Python library on Ubuntu 18.04. Here is the steps I had take to build:

  1. Clone the repo
    mkdir ~/blender-git
    cd ~/blender-git
    git clone https://git.blender.org/blender.git
    cd blender
    git checkout v2.80
    git submodule update --init --recursive

  2. Install dependencies
    cd ~/blender-git
    ./blender/build_files/build_environment/install_deps.sh

  3. Make and Install
    cd ~/blender-git/blender
    make bpy
    I also went into the CMake file and changed the python paths to a virtual environment path.
    after that I did make install
    Once everything has been done, I tried to import the Blender library to python:
    import bpy

And then I tried to call
bpy.ops.render.render()

And it segfaults. Using GDB the error message says

Thread 1 “python3.7” received signal SIGSEGV, Segmentation fault.
0x00007ffff3a8ae70 in GHOST_ActivateOpenGLContext ()
from /home/frank/blender/lib/python3.7/site-packages/bpy.so

Does anyone know what the issue is?

Same issue here on Debian 10