Python ssl issues with lastgenre

I am a newbie to beets and it seems amazing however I am having problems getting it configured and working properly.
The last piece to get working is lastgenre I am getting a certificate error with it
Hardware: Synology NAS DS1511+
OS: DSM 6
beets version 1.4.3
Python version 2.7.13
plugins: acousticbrainz, beatport, chroma, discogs, fetchart, lastgenre, lyrics, missing

command : beet -v lastgenre gives
error : lastgenre: last.fm error: NetworkError: [SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c:661)
lastgenre: last.fm error: NetworkError: [SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c:661)

I think its a synology/python error, seems to be to do with #PEP 493: “private” API to configure HTTPS defaults without monkey patching

but I have no idea how to fix it, can anyone help?

Hmm, that’s odd… I’m assuming this has to do with the version of Python provided by Synology. This thread seems to reflect the same problem, for example: https://forum.synology.com/enu/viewtopic.php?t=98648

Perhaps the solution is to try installing Python manually, or to switch to a different version of Python (e.g., 3.6)?

Thanks for the response! So I took your advice and removed 2.7.13 (also had to remove a bunch of other packages including beets before I could remove python) these are the steps I took

  1. opkg remove --force-removal-of-dependent-packages python
  2. Ran opkg install python3
  3. Had to reinstall pip - wget https://bootstrap.pypa.io/get-pip.py
  4. python3 get-pip.py
  5. pip install beets
    It seemed to install ok and seems to be using python 3.6 here is the output
    Collecting beets
    Using cached beets-1.4.3.tar.gz
    Requirement already satisfied: six>=1.9 in /volume1/@entware-ng/opt/lib/python3.6/site-packages (from beets)
    Collecting mutagen>=1.33 (from beets)
    Using cached mutagen-1.37.tar.gz
    Collecting munkres (from beets)
    Using cached munkres-1.0.8.tar.gz
    Collecting unidecode (from beets)
    Using cached Unidecode-0.04.20-py2.py3-none-any.whl
    Collecting musicbrainzngs>=0.4 (from beets)
    Using cached musicbrainzngs-0.6.tar.gz
    Collecting pyyaml (from beets)
    Using cached PyYAML-3.12.tar.gz
    Collecting jellyfish (from beets)
    Using cached jellyfish-0.5.6.tar.gz
    Building wheels for collected packages: beets, mutagen, munkres, musicbrainzngs, pyyaml, jellyfish
    Running setup.py bdist_wheel for beets … done
    Stored in directory: /root/.cache/pip/wheels/f7/fd/bd/69685c9c0d01fbbcf0a44000acb964cb132b53704e30467284
    Running setup.py bdist_wheel for mutagen … done
    Stored in directory: /root/.cache/pip/wheels/d2/99/7a/49007bed098faaed83d9b802386f4b31d6babc30f354ed8ff7
    Running setup.py bdist_wheel for munkres … done
    Stored in directory: /root/.cache/pip/wheels/aa/8f/c6/43d3af94253c17eecb5bc451e4b5cbfd099a387e582a798ec8
    Running setup.py bdist_wheel for musicbrainzngs … done
    Stored in directory: /root/.cache/pip/wheels/b7/06/bb/c891cad2436937ba584d1823fa20373194ff73c081af84f68d
    Running setup.py bdist_wheel for pyyaml … done
    Stored in directory: /root/.cache/pip/wheels/2c/f7/79/13f3a12cd723892437c0cfbde1230ab4d82947ff7b3839a4fc
    Running setup.py bdist_wheel for jellyfish … done
    Stored in directory: /root/.cache/pip/wheels/0f/a8/f6/3c2f1675f6a60367a113203470a21398c178d5145df7e68d24
    Successfully built beets mutagen munkres musicbrainzngs pyyaml jellyfish
    Installing collected packages: mutagen, munkres, unidecode, musicbrainzngs, pyyaml, jellyfish, beets
    Successfully installed beets-1.4.3 jellyfish-0.5.6 munkres-1.0.8 musicbrainzngs-0.6 mutagen-1.37 pyyaml-3.12 unidecode-0.4.20

Had to obviously reinstall all the plugins I had which again seem to switch over to python 3.6 as this shows
Collecting pylast
Using cached pylast-1.8.0.tar.gz
Requirement already satisfied: six in /volume1/@entware-ng/opt/lib/python3.6/site-packages (from pylast)
Building wheels for collected packages: pylast
Running setup.py bdist_wheel for pylast … done
Stored in directory: /root/.cache/pip/wheels/73/28/28/f5bd85c7c59ba22b2d416a001df252f2b7300c5b4e04387f25
Successfully built pylast
Installing collected packages: pylast
Successfully installed pylast-1.8.0

But I have exactly the same output if I run beet -v lastgenre

Is there any way I can check what version is actually running?

Actually just checking it the line number is now different so I guess its using 3.6
lastgenre: last.fm error: NetworkError: [SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c:749)
lastgenre: last.fm error: NetworkError: [SSL: CERTIFICATE_VERIFY_FAILED] unknown error (_ssl.c:749)

Any ideas?

Huh! That’s very strange. My best guess at this point is that your system didn’t come with a full battery of SSL certificates, or they’re not installed properly. This comment on another project’s similar issue with the Synology OS: https://github.com/SynoCommunity/spksrc/issues/1575#issuecomment-84695701

seems to indicate it might be possibly by linking the certificates into the right place. Maybe try that, or a little more googling about certificates on Synology in general?

Thanks sooooooo much for your help and pointing me in the right directions
After much googling and not finding much at all I began messing about and seeing what I could find.

Some trial and error and I came across this which worked just grand!
opkg install ca-certificates

just in case anyone else has this issue

Nice! Good to know it was just missing certificates.