Salt error 'Failed to import states pip_state' since move to python 3

Bug #1750553 reported by Graham Clinch
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pip
Fix Released
Unknown
python-pip (Ubuntu)
Fix Released
Undecided
Unassigned
salt (Ubuntu)
New
Undecided
Unassigned

Bug Description

Since the move to salt running under Python 3, salt 'pip' states fail with:

```
2018-02-20 11:11:29,176 [salt.loader ][ERROR ][13011] Failed to import states pip_state, this is due most likely to a syntax error:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/salt/loader.py", line 1405, in _load_module
    mod = spec.loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 823, in load_module
  File "<frozen importlib._bootstrap_external>", line 682, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/salt/states/pip_state.py", line 36, in <module>
    import pip
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 26, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 23, in <module>
    from pip.locations import (
  File "/usr/lib/python3/dist-packages/pip/locations.py", line 103, in <module>
    bin_user = os.path.join(user_site, 'bin')
  File "/usr/lib/python3.6/posixpath.py", line 80, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
```

This has been noted upstream in salt:
https://github.com/saltstack/salt/issues/44980

...which reports that it is an issue with pip:
https://github.com/pypa/pip/pull/4442

However no release of pip has been made that contains this fix.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: salt-minion 2017.7.2+dfsg1-2ubuntu1
ProcVersionSignature: Ubuntu 4.13.0-32.35-generic 4.13.13
Uname: Linux 4.13.0-32-generic x86_64
ApportVersion: 2.20.8-0ubuntu10
Architecture: amd64
Date: Tue Feb 20 11:29:41 2018
JournalErrors:
 -- Logs begin at Mon 2018-01-29 17:20:48 GMT, end at Tue 2018-02-20 11:29:14 GMT. --
 Feb 20 11:22:14 hostname kernel: piix4_smbus 0000:00:07.3: SMBus Host Controller not enabled!
 Feb 20 11:22:14 hostname kernel: sd 3:0:0:0: [sda] Assuming drive cache: write through
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_GB:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: salt
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Graham Clinch (g-clinch) wrote :
Revision history for this message
Benjamin Drung (bdrung) wrote :

Since this is a bug in python-pip (not salt), I mark the bug for salt as invalid.

Changed in salt (Ubuntu):
status: New → Invalid
Changed in python-pip (Ubuntu):
status: New → Triaged
Revision history for this message
Terentev-mn (terentev-mn) wrote :

Same problem after upgrade salt-minion (py3) 2019.2.3 to 3000 (py3)

Solution:
apt install python3-pip

Revision history for this message
Kai Kasurinen (kai-kasurinen) wrote :

Fixed in 10.0.0b1 (2018-03-31)

Changed in python-pip (Ubuntu):
status: Triaged → Fix Released
Changed in salt (Ubuntu):
status: Invalid → New
Changed in pip:
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.