caronc / nzb-notify

Push Notifications to a large number of supported services for NZBGet and SABnzbd (based on Apprise)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"ImportError: No module named nzbget" when using with sabnzbd

tehniemer opened this issue · comments

I'm getting the following error running this script in sabnzbd

 Notification script returned exit code 1 and output "Traceback (most recent call last):
  File "/config/scripts/Notify.py", line 175, in <module>
    from nzbget import SCRIPT_MODE
ImportError: No module named nzbget
"

I have it calling the sabnzbd-notify.py script.

I'm not sure what OS you're running, but basically you're just missing the dependencies needed to use nzb-notify.

# Run this from the directory you cloned nzb-notify into; this will haul in your
# missing dependencies:
pip install -r requirements.txt

It's running in Docker.

Have a look at #53. It seems like it's your exact error; there are a few suggestions in it at the bottom that will probably fix you right up! 🙂

OK thanks, I'll give that a try.

Did you have any luck? If so, do you mind if I close this ticket off? Otherwise please keep me posted as i can still try to be of more assistance 🙂

No, I have sabnzbd running in docker and this is the error I get

OCI runtime exec failed: exec failed: container_linux.go:346: starting container process caused "exec: \"pip\": executable file not found in $PATH": unknown

I'm guessing the image I'm using doesn't have the right things installed.

Sorry to hear that! Could you share your Dockerfile with me? Maybe we can just adjust it to fix your issue.

Thanks for your willingness to help, I'm using the LinuxServer.io image, looks like this is the dockerfile.

https://hub.docker.com/r/linuxserver/sabnzbd/dockerfile

I'm not able to test this at work (where I am due to the firewall blocking the ports needed to build the container), but something like this might work:

FROM lsiobase/xenial
MAINTAINER sparklyballs

# environment settings
ARG DEBIAN_FRONTEND="noninteractive"
ENV HOME="/config" \
PYTHONIOENCODING=utf-8

# install packages
RUN \
 echo "deb http://ppa.launchpad.net/jcfp/ppa/ubuntu xenial main" >> /etc/apt/sources.list.d/sabnzbd.list && \
 echo "deb-src http://ppa.launchpad.net/jcfp/ppa/ubuntu xenial main" >> /etc/apt/sources.list.d/sabnzbd.list && \
 echo "deb http://ppa.launchpad.net/jcfp/sab-addons/ubuntu xenial main" >> /etc/apt/sources.list.d/sabnzbd.list && \
 echo "deb-src http://ppa.launchpad.net/jcfp/sab-addons/ubuntu xenial main" >> /etc/apt/sources.list.d/sabnzbd.list && \
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 0x98703123E0F52B2BE16D586EF13930B14BB9F05F && \
 apt-get update && \
 apt-get install -y \
	p7zip-full \
	par2-tbb \
	python-sabyenc \
	sabnzbdplus \
	unrar \
	unzip \
        python-pip && \

#SABnzbd Notifications / Missing Dependencies
 pip install apprise \
	setuptools \
	pynzbget \
	chardet \
	six && \

# cleanup
 apt-get clean && \
 rm -rf \
	/tmp/* \
	/var/lib/apt/lists/* \
	/var/tmp/*

# add local files
COPY root/ /

# ports and volumes
EXPOSE 8080 9090
VOLUME /config /downloads /incomplete-downloads

Ideally the line should probably read:

...
#SABnzbd Notifications / Missing Dependencies
pip install -r /path/to/nzb-notify/requirements.txt &&
...

But until i can test the image myself, i don't know what the path is. You could try to get this yourself if you wanted. Do the following:

# first get the container name (hash)
docker ps

# Once you found the sabnzbd container (and have it's hash):
docker run <hash> --rm -i bash

# you'll get a linux prompt; you should be able to locate the
# path to where nzb-notify was installed to. Hopefully the requirements.txt
# exits....

Worst case... just try it with the manual references to the dependencies above.

Just to add to this, I missed your comment about pip being missing. Try adding this first:

apt-get install python-pip

I'll update the sample Docker container reference comment (above) too to include this.

Thanks for the guidance, I forked the linuxserver.io repository and ended up with this as my dockerfile

FROM lsiobase/ubuntu:bionic

# set version label
ARG BUILD_DATE
ARG VERSION
ARG SABNZBD_VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="sparklyballs"

# environment settings
ARG DEBIAN_FRONTEND="noninteractive"
ENV HOME="/config" \
PYTHONIOENCODING=utf-8

RUN \
 echo "***** install gnupg ****" && \
 apt-get update && \
 apt-get install -y \
        gnupg && \
 echo "***** add sabnzbd repositories ****" && \
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 0x98703123E0F52B2BE16D586EF13930B14BB9F05F && \
 echo "deb http://ppa.launchpad.net/jcfp/nobetas/ubuntu bionic main" >> /etc/apt/sources.list.d/sabnzbd.list && \
 echo "deb-src http://ppa.launchpad.net/jcfp/nobetas/ubuntu bionic main" >> /etc/apt/sources.list.d/sabnzbd.list && \
 echo "deb http://ppa.launchpad.net/jcfp/sab-addons/ubuntu bionic main" >> /etc/apt/sources.list.d/sabnzbd.list && \
 echo "deb-src http://ppa.launchpad.net/jcfp/sab-addons/ubuntu bionic main" >> /etc/apt/sources.list.d/sabnzbd.list && \
 echo "**** install packages ****" && \
 if [ -z ${SABNZBD_VERSION+x} ]; then \
	SABNZBD="sabnzbdplus"; \
 else \
	SABNZBD="sabnzbdplus=${SABNZBD_VERSION}"; \
 fi && \
 apt-get update && \
 apt-get install -y \
	p7zip-full \
	par2-tbb \
	python-pip \
	${SABNZBD} \
	unrar \
	unzip && \
 pip install --no-cache-dir \
	apprise \
	chardet \
	pynzb \
	requests \
	sabyenc \
	setuptools \
	pynzbget \
	six && \		
 echo "**** cleanup ****" && \
 apt-get clean && \
 rm -rf \
	/tmp/* \
	/var/lib/apt/lists/* \
	/var/tmp/*

# add local files
COPY root/ /

# ports and volumes
EXPOSE 8080 9090
VOLUME /config /downloads /incomplete-downloads

The test notification was sent, so it seems to be working and nothing else has broken....yet.

That's great to hear! Also, thank you for sharing your solution too!