Problem with python module: undefined symbol _Py_RefTotal

Hi,
I am trying to create a snap with snapcraft 4.5.4, of a ROS package that includes a node that uses the pip module spidev. I have added

dependencies:
plugin: python
python-version: python2
python-packages: [spidev]

in the snapcraft.yaml file, and it build successfully. But after installing and running the snap, it fails with

ImportError: /snap/mysnap/x12/lib/python2.7/site-packages/spidev.so: undefined symbol: _Py_RefTotal 

on the line “import spidev”

I also tried to add the spidev module to rosdep and including it in my package.xml, but with the same result.
From what I´ve found of similar problems it seems to be related to either a wrong python version or compiler, but not sure how to fix this.

Running the ROS node normally, after having installed spidev with “pip install spidev” (using python2) works without problems.

Hope someone can help.

Best Regards,
Milan