OpenWonderLabs / python-host

The python code running on Raspberry Pi or other Linux based boards to control SwitchBot.
Apache License 2.0
376 stars 84 forks source link

UnicodeDecodeError on pip3 download gattlib #17

Closed SailingDreams closed 3 years ago

SailingDreams commented 4 years ago

Below is the error I get when trying to download gattlib. It seems pip3 wants to install and not simply download. Is there a way to make it download only?

` $ pip3 download gattlib Collecting gattlib Using cached gattlib-0.20200122.tar.gz (44 kB) ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-download-5wiu4h96/gattlib/setup.py'"'"'; file='"'"'/tmp/pip-download-5wiu4h96/gattlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-download-5wiu4h96/gattlib/pip-egg-info cwd: /tmp/pip-download-5wiu4h96/gattlib/ Complete output (7 lines): Traceback (most recent call last): File "", line 1, in File "/tmp/pip-download-5wiu4h96/gattlib/setup.py", line 51, in long_description = fh.read() File "/usr/lib/python3.6/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 7189: ordinal not in range(128)

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. `

The pip3 version I have $ pip3 --version pip 20.0.2 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)

I also tried to find the .gz in ~/.cache/pip but it wasn't there.

$ python -c "from pip._internal.locations import USER_CACHE_DIR; print(USER_CACHE_DIR)" ~/.cache/pip ~/.cache/pip$ find . | grep gattlib

SailingDreams commented 4 years ago

The issue above was resolved (thanks Tony) by specifying LC_ALL as shown below. I'm not sure why my Ubuntu 18.04 doesn't have LC_ALL specified. $ LC_ALL=en_US.UTF-8 pip3 download gattlib

The next error I got was this $ LC_ALL=en_US.UTF-8 pip3 install gattlib ... /usr/bin/ld: cannot find -lboost_python36

Which was solved by creating symbolic links: ln -s libboost_python3-py36.so /usr/lib/x86_64-linux-gnu/libboost_python36.so ln -s libboost_python3-py36.a /usr/lib/x86_64-linux-gnu/libboost_python36.a

sanjeewasam commented 4 years ago

Just wondering why you use this as there is a supported component in Home Assistant?. Is it to add the second unit support?

SailingDreams commented 4 years ago

@sanjeewasam I am vnc'ing into an ubuntu workstation to control hardware in a lab. I also need the switchbot arm to go down and stay down till I release it.

SwitchBot-Wonderlabs commented 3 years ago

@sanjeewasam try the newest README