Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

error on gateway.py #23

Closed
jumping2000 opened this issue Sep 30, 2018 · 8 comments
Closed

error on gateway.py #23

jumping2000 opened this issue Sep 30, 2018 · 8 comments

Comments

@jumping2000
Copy link
Contributor

Hi,
I have this error on raspberry Pi Zero W with last Raspbian Strech Lite, is there a way to solve it?
thanks

./gateway.py
Traceback (most recent call last):
  File "./gateway.py", line 15, in <module>
    from workers_manager import WorkersManager
  File "/home/pi/bt-mqtt-gateway/workers_manager.py", line 4, in <module>
    from pip._internal import main as pip_main
ImportError: No module named 'pip._internal'
@zewelor
Copy link
Owner

zewelor commented Sep 30, 2018

From fast google search:
pypa/pip#5373
pypa/pip#5253

Are you using python 3 ?

@jumping2000
Copy link
Contributor Author

hello, thank you for your answer!
before writing here I searched on google but the problem it'a a little bit different because Phyton and Pip appear to be good:

pi@raspberrypi:~/bt-mqtt-gateway $ pip3 -V
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)
pi@raspberrypi:~/bt-mqtt-gateway $ python3 --version
Python 3.5.3

@bbbenji
Copy link
Collaborator

bbbenji commented Sep 30, 2018

What is the output of pip -V?

If it's an unknown command, you can either add an alias to your ~/.bashrc

alias pip=pip3

or add to your $PATH symlink named pip pointing to the pip3 binary.

@jumping2000
Copy link
Contributor Author

this is the sequence of commands:

sudo apt install python-pip
.........
pi@raspberrypi:~/bt-mqtt-gateway $ 
pi@raspberrypi:~/bt-mqtt-gateway $ ./gateway.py
Traceback (most recent call last):
  File "./gateway.py", line 15, in <module>
    from workers_manager import WorkersManager
  File "/home/pi/bt-mqtt-gateway/workers_manager.py", line 4, in <module>
    from pip._internal import main as pip_main
ImportError: No module named 'pip._internal'
pi@raspberrypi:~/bt-mqtt-gateway $ pip -V
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)
pi@raspberrypi:~/bt-mqtt-gateway $
pi@raspberrypi:~/bt-mqtt-gateway $ sudo reboot now
.......
pi@raspberrypi:~ $ sudo easy_install pip
Searching for pip
Best match: pip 9.0.1
Adding pip 9.0.1 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Using /usr/lib/python2.7/dist-packages
Processing dependencies for pip
Finished processing dependencies for pip
pi@raspberrypi:~ $ sudo easy_install3 pip
Searching for pip
Best match: pip 9.0.1
Adding pip 9.0.1 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip3.5 script to /usr/local/bin
Installing pip3 script to /usr/local/bin

Using /usr/lib/python3/dist-packages
Processing dependencies for pip
Finished processing dependencies for pip
pi@raspberrypi:~ $ ls
bluez-5.49  bt-mqtt-gateway
pi@raspberrypi:~ $ cd bt-mqtt-gateway
pi@raspberrypi:~/bt-mqtt-gateway $ ./gateway.py
Traceback (most recent call last):
  File "./gateway.py", line 15, in <module>
    from workers_manager import WorkersManager
  File "/home/pi/bt-mqtt-gateway/workers_manager.py", line 4, in <module>
    from pip._internal import main as pip_main
ImportError: No module named 'pip._internal'
pi@raspberrypi:~/bt-mqtt-gateway $ 
....
pi@raspberrypi:~/bt-mqtt-gateway $ pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 63kB/s 
Installing collected packages: pip
Successfully installed pip-18.0
...
pi@raspberrypi:~/bt-mqtt-gateway $ ./gateway.py
Could not install packages due to an EnvironmentError: [Errno 13] Permesso negato: '/usr/local/lib/python3.5/dist-packages/construct'
Consider using the `--user` option or check the permissions.

Traceback (most recent call last):
  File "./gateway.py", line 30, in <module>
    manager.register_workers(settings['manager']).start(mqtt)
  File "/home/pi/bt-mqtt-gateway/workers_manager.py", line 40, in register_workers
    worker_obj = klass(**worker_config['args'])
  File "/home/pi/bt-mqtt-gateway/workers/base.py", line 5, in __init__
    self._setup()
  File "/home/pi/bt-mqtt-gateway/workers/thermostat.py", line 55, in _setup
    from eq3bt import Thermostat
ImportError: No module named 'eq3bt'

@jumping2000
Copy link
Contributor Author

now after "pip install --upgrade pip" I have another type of error

@bbbenji
Copy link
Collaborator

bbbenji commented Sep 30, 2018

pip install python-eq3bt

@jumping2000
Copy link
Contributor Author

Great!! Now it works:
./gateway.py -d

Starting
Added: miflora with 600 seconds interval
Added: thermostat with 120 seconds interval
Subscribing to: thermostat/+/+/set
Subscribing to: homeassistant/status with command: update_all
Updating all workers

So, do you understand what was the problem?
I see in closed issues that there is not error with python 3.6 , maybe with python 3.5 do I need to upgrade pip (with pip install --upgrade pip) ?
bye

@bbbenji
Copy link
Collaborator

bbbenji commented Oct 1, 2018

I think the error was that you had pip on Python 2.x and pip3 on Python 3.x. Then the second error was just missing python-eq3bt. Glad you got it working:)

@bbbenji bbbenji closed this as completed Oct 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants