Skip to content

pip install python 3 version of salt causes DecodeError #44283

@Inveracity

Description

@Inveracity

Description of Issue/Question

I wanted to try some of the new python3 capable code, but it turns out installing the python3 salt libraries via pip causes some confusions for the salt script in /usr/bin/salt when salt is already installed via apt repos.

Setup

normal apt installation of salt-master and salt-minion version 2017.7.2

Steps to Reproduce Issue

doing this:

python3 -m pip install salt
salt '*' test.ping

causes this:

Traceback (most recent call last):
  File "/usr/local/bin/salt", line 11, in <module>
    sys.exit(salt_main())
  File "/usr/local/lib/python3.5/dist-packages/salt/scripts.py", line 476, in salt_main
    client.run()
  File "/usr/local/lib/python3.5/dist-packages/salt/cli/salt.py", line 173, in run
    for full_ret in cmd_func(**kwargs):
  File "/usr/local/lib/python3.5/dist-packages/salt/client/__init__.py", line 806, in cmd_cli
    **kwargs):
  File "/usr/local/lib/python3.5/dist-packages/salt/client/__init__.py", line 1586, in get_cli_event_returns
    **kwargs
  File "/usr/local/lib/python3.5/dist-packages/salt/client/__init__.py", line 1174, in get_iter_returns
    for raw in ret_iter:
  File "/usr/local/lib/python3.5/dist-packages/salt/client/__init__.py", line 1099, in get_returns_no_block
    no_block=True, auto_reconnect=self.auto_reconnect)
  File "/usr/local/lib/python3.5/dist-packages/salt/utils/event.py", line 632, in get_event
    ret = self._get_event(wait, tag, match_func, no_block)
  File "/usr/local/lib/python3.5/dist-packages/salt/utils/event.py", line 540, in _get_event
    raw = self.subscriber.read_sync(timeout=wait)
  File "/usr/local/lib/python3.5/dist-packages/salt/transport/ipc.py", line 705, in read_sync
    return ret_future.result()
  File "/usr/local/lib/python3.5/dist-packages/tornado/concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 4, in raise_exc_info
  File "/usr/local/lib/python3.5/dist-packages/tornado/gen.py", line 1069, in run
    yielded = self.gen.send(value)
  File "/usr/local/lib/python3.5/dist-packages/salt/transport/ipc.py", line 681, in _read_sync
    raise exc_to_raise  # pylint: disable=E0702
  File "/usr/local/lib/python3.5/dist-packages/salt/transport/ipc.py", line 653, in _read_sync
    for framed_msg in self.unpacker:
  File "msgpack/_unpacker.pyx", line 469, in msgpack._unpacker.Unpacker.__next__ (msgpack/_unpacker.cpp:5459)
  File "msgpack/_unpacker.pyx", line 400, in msgpack._unpacker.Unpacker._unpack (msgpack/_unpacker.cpp:4483)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 22: invalid start byte

I guess pip replaces the salt script to try and run #!/usr/bin/python but I have not confirmed that.

reverting the problem

I got everything working again by doing the following:

python3 -m pip uninstall salt
apt-get install salt-master --reinstall
ln /usr/bin/salt /usr/local/bin/salt

It's not really a bug, but if people like me start to tinker and run in to trouble, they might find this helpful.

Versions Report

Salt Version:
           Salt: 2017.7.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: 3.5.0
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Nov 19 2016, 06:48:10)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 4.10.8-std-1
         system: Linux
        version: Ubuntu 16.04 xenial

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions