AdvancedClimateSystems / uModbus

Python implementation of the Modbus protocol.
Mozilla Public License 2.0
211 stars 82 forks source link

pip3 install #60

Closed joaopmrod closed 5 years ago

joaopmrod commented 6 years ago

I get this error when trying to install on my odroid-xu4 (Ubuntu 18.04 LTS (GNU/Linux 4.14.37-135 armv7l, Python 3.6.5 (default, Apr 1 2018, 05:46:30) [GCC 7.3.0] on linux)

How can I fix it?

odroid@odroid:~/centopeia_firm$ pip3 install umodbus
Collecting umodbus
  Using cached https://files.pythonhosted.org/packages/9d/ef/a575ba0840854b937ab7e5c6c4b40c4491089e42114a9b4413e87a84b2a8/uModbus-1.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ty56b9mk/umodbus/setup.py", line 12, in <module>
        long_description = open(os.path.join(cwd, 'README.rst'), 'r').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 0xce in position 547: ordinal not in range(128)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ty56b9mk/umodbus/
OrangeTux commented 6 years ago

Thanks for submitting this issue. At the moment I don't have much time to look into it. But a quick workaround for you would be downloading the source and then run python setup.py to install it manually.

Devangsavla commented 6 years ago

Is there any update on this. This doesn't seem to be a problem on windows. It's happening to me after I've finished my development on windows and wanted to deploy the code on Linux. The error message is as below:

pi@raspberrypi:~ $ sudo pip3 install umodbus Collecting umodbus Exception: Traceback (most recent call last): File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connection.py", line 138, in _new_conn (self.host, self.port), self.timeout, **extra_kw) File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/connection.py", line 98, in create_connection raise err File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/connection.py", line 88, in create_connection sock.connect(sa) OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen chunked=chunked) File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 350, in _make_request self._validate_conn(conn) File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 837, in _validate_conn conn.connect() File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connection.py", line 281, in connect conn = self._new_conn() File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connection.py", line 147, in _new_conn self, "Failed to establish a new connection: %s" % e) requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x75c3f170>: Failed to establish a new connection: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run wb.build(autobuilding=True) File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build self.requirement_set.prepare_files(self.finder) File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file require_hashes File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link self.link = finder.find_requirement(self, upgrade) File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement all_candidates = self.find_all_candidates(req.name) File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates for page in self._get_pages(url_locations, project_name): File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages page = self._get_page(location) File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page return HTMLPage.get_page(link, session=self.session) File "/usr/lib/python3/dist-packages/pip/index.py", line 792, in get_page "Cache-Control": "max-age=600", File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get return self.request('GET', url, *kwargs) File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request return super(PipSession, self).request(method, url, args, kwargs) File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request resp = self.send(prep, send_kwargs) File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 630, in send history = [resp for resp in gen] if allow_redirects else [] File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 630, in history = [resp for resp in gen] if allow_redirects else [] File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 190, in resolve_redirects adapter_kwargs File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send r = adapter.send(request, kwargs) File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send resp = super(CacheControlAdapter, self).send(request, **kw) File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send timeout=timeout File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment total -= 1 TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

OrangeTux commented 6 years ago

It seems that you are having network issues unrelated to uModbus.

8minutenergy commented 6 years ago

I am running into this exact same issue building a Linux container image for docker. pip install works fine pip3 install fails with

Collecting umodbus
  Downloading https://files.pythonhosted.org/packages/9d/ef/a575ba0840854b937ab7e5c6c4b40c4491089e42114a9b4413e87a84b2a8/uModbus-1.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-3p0i_lr3/umodbus/setup.py", line 12, in <module>
        long_description = open(os.path.join(cwd, 'README.rst'), 'r').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 0xce in position 547: ordinal not in range(128)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-3p0i_lr3/umodbus/

I believe this has something to do with the UTF-8 characters in the readme file and a bug in pip3.

OrangeTux commented 6 years ago

@8minutenergy I cannot reproduce the bug. Could you post which docker images you used and which commands you issued?

8minutenergy commented 6 years ago

I am using ubuntu:cosmic. Work around is to run pip install umodbus instead of pip3 install umodbus.

Dockerfile

FROM ubuntu:cosmic

SHELL [ "bash", "-c" ]

RUN apt-get update && apt-get install -y tzdata && apt-get install -y \ build-essential \ python-dev \ python-setuptools \ openssl \ libssl-dev \ libevent-dev \ python-pip \ git \ gnupg \ dirmngr \ libyaml-dev \ openssh-client \ python3 \ python3-dev \ python3-venv \ python3-pip \ python3-setuptools \ python-numpy \ python-pandas \ && pip install PyYAML \ && pip install umodbus \ && pip3 install click \ && pip3 install voluptuous \ && pip3 install umodbus \ && rm -rf /var/lib/apt/lists/*

OrangeTux commented 6 years ago

Weird, It works on my machine.... I'll later investigate it later

OrangeTux commented 6 years ago

@8minutenergy Can you add this line to the Dockerfile:

FROM ubuntu:cosmic

ENV LANG C.UTF-8

SHELL [ "bash", "-c" ]

RUN apt-get update && apt-get install -y tzdata && apt-get install -y \
        build-essential \
        python-dev \
        python-setuptools \
        openssl \
        libssl-dev \
        libevent-dev \
        python-pip \
        git \
        gnupg \
        dirmngr \
        libyaml-dev \
        openssh-client \
        python3 \
        python3-dev \
        python3-venv \
        python3-pip \
        python3-setuptools \
        python-numpy \
        python-pandas \
        && pip install PyYAML \
        && pip install umodbus \
        && pip3 install click \
        && pip3 install voluptuous \
        && pip3 install umodbus \
        && rm -rf /var/lib/apt/lists/*
OrangeTux commented 5 years ago

Closed due to inactivity. You can reopen if you feel the need