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

Bug #1750553 reported by Graham Clinch on 2018-02-20
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-pip (Ubuntu)
salt (Ubuntu)

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/", 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/", line 36, in <module>
    import pip
  File "/usr/lib/python3/dist-packages/pip/", line 26, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/usr/lib/python3/dist-packages/pip/utils/", line 23, in <module>
    from pip.locations import (
  File "/usr/lib/python3/dist-packages/pip/", line 103, in <module>
    bin_user = os.path.join(user_site, 'bin')
  File "/usr/lib/python3.6/", 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:

...which reports that it is an issue with pip:

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
 -- 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
 PATH=(custom, no user)
SourcePackage: salt
UpgradeStatus: No upgrade log present (probably fresh install)

Graham Clinch (g-clinch) wrote :
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers