NickWaterton / Roomba980-Python

Python program and library to control iRobot Roomba 980 Vacuum Cleaner
MIT License
371 stars 103 forks source link

Always "ImportError: No module named password" #26

Closed lasse79 closed 6 years ago

lasse79 commented 6 years ago

Hi i tried to follow the hoe to do now several time on serveral systems. But all of them was debian on a raspberryPI3 Hardware. Maybe someknow the issue or can support me, or maybe a generel failure now?

I tried the pip installtion and as well the git, after executing the script i always getting some errrors connected to a password module.

> python roomba.py`
Traceback (most recent call last):
File "roomba.py", line 25, in <module>
from roomba.password import Password
File "/root/Roomba980-Python/roomba/roomba.py", line 25, in <module>
from roomba.password import Password
ImportError: No module named password
> python getpassword.py
Traceback (most recent call last):
File "getpassword.py", line 12, in <module>
from roomba import Password
File "/root/Roomba980-Python/roomba/roomba.py", line 25, in <module>
from roomba.password import Password
ImportError: No module named password

Had somebody the same issue and fixed it?

Thanks

NickWaterton commented 6 years ago

Did you run sudo python setup.py install Then you execute by simply entering roomba

The original instructions were written for before the script was packaged for pypi. The script now expects the library to be installed, which is why it’s not found - you haven’t installed it.

The next issue on the RPi3 is that you need opencv installed (it’s one of the pypi requirements), and you can’t install it via pip (don’t know why). You have to build it as described here https://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/

I need to revisit this whole thing, but I didn’t package it for pypi, so I don’t know what exactly changed since I posed the original.

NickWaterton commented 6 years ago

Actually, just tried this and it still doesn’t work on a RPi3 (which I have lying around).

I suggest, for now you edit roomba.py, line 25. from roomba.password import Password

And change it to from password import Password

Hopefully that should fix it. The problem is that the script now expects to be installed, but on an RPi one of the dependencies is opencv-python (which would normally be automatically installed via pip), but this doesn’t work on RPi, so the script doesn’t complete installation, so it can’t find the installed module “roomba”.

Let me know if this works, and I’ll see if I can fix it.

Not keen on the whole pypi thing, it sort of makes it easy to install, but it sure messes thing up cross platform...

NickWaterton commented 6 years ago

No, just tried that, and seems there are problems if you don’t have opencv or pillow installed, neither of which install properly via pip on an RPi.

Also, if you can’t install the program (because of the RPi pip issues), the program is main.py not roomba.py, roomba.py is the library which is supposed to be installed, main.py gets copied to roomba when it’s installed properly.

Looks like there is some work to be done to get this to work on a RPi, sorry I never tested it on an RPi before. Should not be much to do. I’ll see what I can do.

NickWaterton commented 6 years ago

OK,

I have patched the files so that you can run roomba directly without installing on RPI. I don't know how to fix the dependencies issues (but they are not really dependencies, roomba will work just fine without openCV and Pillow - just no maps).

You can install Pillow/OpenCV yourself (just not via pip or apt-get - you have to compile it yourself as you need a recent version of these -less than a couple of years old). There are guides around on how to do this.

Whether you have openCV or PIllow or not, once you have run

git clone https://github.com/NickWaterton/Roomba980-Python.git
cd Roomba980-Python/roomba

Do Not Install the program you can now just run it directly, by running: ./roomba_direct.py

This discovers my roomba on my RPi, but I haven't gone beyond that, as I'm already ruining roomba.py on my Ubuntu server, and only one device at a time can connect to the roomba. Command line option should work as well.

If you manage to install Pillow or openCV, roomba_direct.py should pick them up automatically next time it is run.

I suggest you start with PIL (Pillow) as it's less painful to install than openCV.