1

I tested a python script to send anythink with Pushover. But I get the error "ImportError: No module named pushover"

My installed Versions:

# pip install python-pushover
Collecting python-pushover
  Using cached https://files.pythonhosted.org/packages/6f/3d/144a0137c749bd152c3ab7f4d3ce8fe1455168dab36c2fcd900d3fab16ad/python-pushover-0.4.tar.gz
Requirement already satisfied: requests>=1.0 in /usr/local/lib/python3.5/dist-packages (from python-pushover) (2.21.0)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (1.24.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (2018.11.29)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (2.8)
Installing collected packages: python-pushover
  Running setup.py install for python-pushover ... done
Successfully installed python-pushover-0.4
# python -V
Python 2.7.13
# python3 -V
Python 3.5.3

The scriptheader:

#!/usr/bin/env python
import pushover

I have tried with pip(3) to install python-pushover but with no success.

Mahir Islam
  • 1,941
  • 2
  • 12
  • 33

2 Answers2

0

In my case, you should :

uninstall that package:

pip uninstall pushover

and install the correct package:

pip install python-pushover

And your code will work fine.

An Nguyen
  • 288
  • 1
  • 15
  • Its the same error.Traceback (most recent call last): File "./notify_pushover.py", line 6, in import pushover ImportError: No module named pushover –  Dec 13 '18 at 06:59
  • hmm , let me check again – An Nguyen Dec 13 '18 at 07:00
  • execuse me, what python version you are using ? – An Nguyen Dec 13 '18 at 07:02
  • Thank you. My testscript: https://github.com/sriccio/zabbix-alertscripts/blob/master/notify_pushover.py –  Dec 13 '18 at 07:02
  • I have write in first post: Debian Stretch with Python 2.7.13 and Python 3.5.3 –  Dec 13 '18 at 07:03
  • Run ```which pip``` and make sure you are running on same one. Not conda or other envs tricks – Aaron_ab Dec 13 '18 at 07:25
  • which pip: /usr/local/bin/pip. I have try /usr/local/bin/pip install python-pushover with the same error. Pushover is here: /usr/local/bin/pushover –  Dec 13 '18 at 07:30
0

I faced this exact error today. This is due to co-existing of different versions of python in your system.

Do, /usr/bin/python3 if the module was installed for py3 and just /usr/bin/python for py2 before running the script.

Refer Installed module using pip, not found for more.

Sumukha Pk
  • 124
  • 1
  • 7