asciidisco / plugin.video.netflix

Inputstream based Netflix plugin for Kodi
MIT License
1.24k stars 226 forks source link

ImportError: No module named Cryptodome.Random #665

Closed pisek closed 5 years ago

pisek commented 5 years ago

I'm submitting a ...

General infomration

Prerequisites

Description

Cannot login to netflix or use plugin

Steps to Reproduce

  1. Clean installation of kodi
  2. Install Netflix plugin
  3. Go to Netflix plugin

Expected behavior: Should ask for login credentials or show categories

Actual behavior: An error emerges (more in log) and goes to "File manager"

Context (Environment)

Installation

Operating System

Additional informatin on the environment

[latest OSMC on rpi2 with latest Kodi 18]

Debug log

2019-04-15 18:10:34.131 T:1686106848 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--

jakermx commented 5 years ago

from Cryptodome.Random import get_random_bytes ImportError: No module named Cryptodome.Random

install pyCryptodomex to fix it

jakermx commented 5 years ago

In order to get our add-ons working correctly, we need to add some additional dependencies and their recommended packages.

sudo apt-get install python-pip python-crypto build-essential -y sudo apt-get install python-all-dev python-setuptools python-wheel -y sudo apt-get install python-crypto-dbg python-crypto-doc python-pip-whl -y

Now lets install our Python cryptography dependency.

pip install pycryptodomex

To make sure our add-ons are finding our pycryptodomex module, lets add a symbolic link to the location.

sudo ln -s /usr/lib/python2.7/dist-packages/Crypto /usr/lib/python2.7/dist-packages/Cryptodome

pisek commented 5 years ago

Works. Thanks.

RoyAnderson commented 5 years ago

Thanks. This fixed the same Netflix install problem I was having with the V18 build on a Vero 4K+. Strange they'd have this issue when they control the total environment.

smartathome commented 5 years ago

I ran into the same issue where I did install the dependency via apt-get... as per instructions of @jakermx. Unfortunately, a new issue popped up where the following module was missing "from Crypto.Util import Padding". Although I was convinced that I had installed the right module. It took me a while to figure out that Kodi uses Python2.7 and not Python3. The installed Cryptodome(x) module for 2.7 does not ship with the Padding.py module. Therefore, download it manually from https://raw.githubusercontent.com/dlitz/pycrypto/7acba5f3a6ff10f1424c309d0d34d2b713233019/lib/Crypto/Util/Padding.py into /usr/lib/python2.7/dist-packages/Crypto/Util. And test from the Python prompt whether "from Crypto.Util import Padding" works.

SolarPowerEV commented 4 years ago

Should someone here have trouble installing the Netflix plugin for KODI 18 on his QNAP HD Station running QTS 4.4.3, this might help:

The following instructions assume that the HD Station’s chroot is based in the same folder as it is the case on my QNAP (which was the standard path after installing HD Station through the App Center):

/share/CACHEDEV1_DATA/.qpkg/HD_Station

It might be in a different folder in your case (I am running a TBS-453DX with a single 1TB SSD from WD RED SA500). During my googling sessions I’ve seen instructions and logfiles based on the premise of the HD Station folder being located for example here: /share/MD0_DATA/.qpkg/HD_Station

So maybe check first, if you can cd or ls your way into the folder /share/CACHEDEV1_DATA/.qpkg/HD_Station and if that fails, try to find out where your HD Station is located instead in your QTS. The command getcfg SHARE_DEF defVolMP -f /etc/config/def_share.info should help with that.

Now come the steps to install the Crypto package to your HD Station that took me quite some time to figure out: Log into QNAP command line interface (via ssh or telnet) as admin and then execute the following commands: cd /share/CACHEDEV1_DATA/.qpkg/HD_Station chroot . Now you’re located in the HD station subenvironment as root, which is basically an Ubutunu 18.04 within QNAP’s QTS and gives you access to the usual commands and package managers like apt, pip etc. and can easily execute what CastagnaIT has suggested. In case you’re not very familiar with Linux (like I am), here are the baby steps

apt update (to update the dependencies and repositories in your system) apt upgrade (you can - and probably should! - skip that command, because it updates everything in your local Ubuntu 18.04 environment, which takes some time. Since I was already frustrated and didn’t care much anymore, I did it nonetheless and couldn’t see any bad consequences (or any difference to be honest except a newer version of the Chrome browser) later when using HD station apt install build-essential apt install python-dev apt install python-pip apt install python-setuptools often a message like “it’s already up to date” will be the result. Which is fine, because most packages are probably already included on your HD Station.

Since first using the officially recommended command pip install --user pycryptodomex

resulted the Crypto package to be installed in the wrong folder /root/.local/lib/python2.7/site-packages/Cryptodome and thus could not be found by the plugin expecting the content to be in /usr/lib/python2.7/dist-packages/Cryptodome it made it necessary to hack a little by adding a symbolic link and downloading a Padding.py file like described in the posts above in this thread.

But thanks to the helpful comments of CastagnaIT, the author of the Netflix plugin, I was able to correct that mistake and instead install a fitting cryptolibrary in the right location making things easier and cleaner.

Since his first suggestion apt install python-pycryptodomex

did not work for me, because the package seems to be not known on my QNAP QTS HD-Station Ubuntu subsystem

I used his alternative suggestion apt install python-pycryptodome

and that worked like a charm. The alternative Crypto library got installed in the right location: /usr/lib/python2.7/dist-packages/Cryptodome

and there was also a Padding.py to be found in the subfolder /Util

Voilá! You should now be able to use your Netflix plugin without error messages (and without messing around with symbolic links or manually downloaded Padding.py files).

AnwarKamel commented 3 years ago

Try this: pip3 install pycryptodomex

truthelectron commented 1 year ago

I am having the same problem with windows, using pycharm IDE