Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install #1

Open
sanguino opened this issue Mar 31, 2019 · 9 comments
Open

Can't install #1

sanguino opened this issue Mar 31, 2019 · 9 comments

Comments

@sanguino
Copy link

sanguino commented Mar 31, 2019

Hi,

I'm trying to install your api. I had some problems to install bluepy, but now I solved it, I get this error I don't know how to resolve:

pip3 install ./xiaomi-flower-care-api/
Processing ./xiaomi-flower-care-api
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-89uw8bo2-build/setup.py", line 13, in <module>
        long_description=readme(),
      File "/tmp/pip-89uw8bo2-build/setup.py", line 7, in readme
        return readme_file.read()
      File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 830: ordinal not in range(128)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-89uw8bo2-build/

Can you help me? I don't know a lot of python, so maybe it's trivial, sorry if I asking something too simple.

Thanks!

@sanguino
Copy link
Author

sanguino commented Mar 31, 2019

I fixed it adding encoding='utf8' to setup.py:

def readme():
    with open('README.md', encoding='utf8') as readme_file:
        return readme_file.read()

But now I have a problem executing read.py:

~/xiaomi-flower-care-api/example $ sudo python3 read.py
Getting data from device..

Traceback (most recent call last):
  File "read.py", line 15, in <module>
    print('Name: {}'.format(sensor.name))
  File "../flowercare/reader.py", line 39, in name
    response = self._read_handle(_HANDLE_DEVICE_NAME)
  File "../flowercare/reader.py", line 127, in _read_handle
    with Peripheral(self._mac, iface=self._interface) as connection:
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 391, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 434, in _connect
    rsp = self._getResp('stat')
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 407, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 339, in _waitResp
    raise BTLEInternalError("Helper exited")
bluepy.btle.BTLEInternalError: Helper exited
Exception ignored in: <bound method Peripheral.__del__ of <bluepy.btle.Peripheral object at 0xb6aa5870>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in __del__
    self.disconnect()
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect
    self._writeCmd("disc\n")
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd
    self._helper.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe

@kobush
Copy link

kobush commented Jul 13, 2019

I get the exact same error.

@ghost
Copy link

ghost commented Jul 14, 2019

I have also encountered the same error with Python 3.5.3 @vrachieru Could you please write which Python version did you use?

@frankfnord
Copy link

same error here.
python3 --version: Python 3.7.3

@sanguino
Copy link
Author

Me too, Python 3.7.3

@johnsonflowers
Copy link

i get an error
Successfully built flowercare
Failed to build bluepy
Installing collected packages: bluepy, flowercare
Running setup.py install for bluepy ... error
ERROR: Complete output from command /usr/local/opt/python/bin/python3.7 -u -c 'import setuptools, tokenize;file='"'"'/private/var/folders/ym/k81rfk4n4914jsk7yzvqbn2jtk9071/T/pip-install-pz7e0fzf/bluepy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/ym/k81rfk4n4914jsk7yzvqbn2jtk9071/T/pip-record-i654mvci/install-record.txt --single-version-externally-managed --compile:

@XReyRobert
Copy link

This is not a python issue but a shell issue.

If it happens when using SSH, this is a fault on the SSH client, not the RPi. For example using an Ubuntu machine as the SSH client will cause this problem.
To fix this SSH problem, edit the file /etc/ssh/ssh_config on the SSH client (not the RPi) and remove the line
SendEnv LANG LC_*

I had this issue when accessing my raspberry through ssh, removing the SendEnv line solved the issue and I could install xiaomi-flower-care-api properly

@XReyRobert
Copy link

I fixed it adding encoding='utf8' to setup.py:

def readme():
    with open('README.md', encoding='utf8') as readme_file:
        return readme_file.read()

But now I have a problem executing read.py:

~/xiaomi-flower-care-api/example $ sudo python3 read.py
Getting data from device..

Traceback (most recent call last):
  File "read.py", line 15, in <module>
    print('Name: {}'.format(sensor.name))
  File "../flowercare/reader.py", line 39, in name
    response = self._read_handle(_HANDLE_DEVICE_NAME)
  File "../flowercare/reader.py", line 127, in _read_handle
    with Peripheral(self._mac, iface=self._interface) as connection:
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 391, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 434, in _connect
    rsp = self._getResp('stat')
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 407, in _getResp
    resp = self._waitResp(wantType + ['ntfy', 'ind'], timeout)
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 339, in _waitResp
    raise BTLEInternalError("Helper exited")
bluepy.btle.BTLEInternalError: Helper exited
Exception ignored in: <bound method Peripheral.__del__ of <bluepy.btle.Peripheral object at 0xb6aa5870>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 630, in __del__
    self.disconnect()
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 453, in disconnect
    self._writeCmd("disc\n")
  File "/usr/local/lib/python3.5/dist-packages/bluepy/btle.py", line 305, in _writeCmd
    self._helper.stdin.flush()
BrokenPipeError: [Errno 32] Broken pipe

did you ever resolved this ?

@belaborbely-jyu
Copy link

belaborbely-jyu commented Mar 26, 2024

With Python3 bluepy may need an additional libraries: libglib2.0-dev based on bluepy

sudo apt-get install python3-pip libglib2.0-dev
sudo pip3 install bluepy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants