salt: [BUG] mysqlclient installation (via salt-pip) fails on 3006.6

Description Trying to install mysqlclient into 3006.6 relenv fails:

salt-pip install mysqlclient

  Downloading mysqlclient-2.2.1.tar.gz (89 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.0/90.0 kB 7.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Error in sitecustomize; set PYTHONVERBOSE for traceback:
      TypeError: expected str, bytes or os.PathLike object, not NoneType
      Fatal Python error: init_import_site: Failed to import the site module
      Python runtime state: initialized
      Traceback (most recent call last):
        File "/opt/saltstack/salt/lib/python3.10/site.py", line 617, in <module>
          main()
        File "/opt/saltstack/salt/lib/python3.10/site.py", line 610, in main
          execsitecustomize()
        File "/opt/saltstack/salt/lib/python3.10/site-packages/relenv/runtime.py", line 932, in wrapper
          import sitecustomize
        File "/tmp/pip-build-env-8sua0kqf/site/sitecustomize.py", line 23, in <module>
          site.addsitedir(path)
        File "/opt/saltstack/salt/lib/python3.10/site.py", line 216, in addsitedir
          sitedir, sitedircase = makepath(sitedir)
        File "/opt/saltstack/salt/lib/python3.10/site.py", line 97, in makepath
          dir = os.path.join(*paths)
        File "/opt/saltstack/salt/lib/python3.10/posixpath.py", line 76, in join
          a = os.fspath(a)
      TypeError: expected str, bytes or os.PathLike object, not NoneType
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

No problems on 3006.5

Setup AlmaLinux 8.9, salt-minion 3006.6 installed via bootstrap.saltstack.com

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 21 (8 by maintainers)

Most upvoted comments

Confirming this still occurs in 3006.7 per milestone set above.

I think I finally found the underlying issue and have opened an issue in the relenv project: saltstack/relenv#182

There, I also provide an alternative workaround.

What about the released 3007.1 or the upcoming 3007.2 (?) ?

@nf-brentsaner, @timwsuqld, @DaAwesomeP , @max-arnold , @lburinov73 : Please see my (long) comment https://github.com/saltstack/salt/issues/65980#issuecomment-2084721288 for a possible long-term fix.

The TLDR is a patch of /usr/bin/salt-pip and /opt/saltstack/salt/salt-pip is needed to change $0 in the exec line (which returns the full path to the file) to -m pip (after which the command matches the workaround you all used).

It would be good if some of the Developers would implement this in the code though …

EDIT 1: For completeness, here is the salt --versions-report to show the Versions of salt and its Dependencies that I am using:

root@HOST:~# salt --versions-report
Salt Version:
          Salt: 3007.0
 
Python Version:
        Python: 3.10.13 (main, Feb 19 2024, 03:31:20) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.16.0
      cherrypy: unknown
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: 4.0.11
     gitpython: 3.1.40
        Jinja2: 3.1.3
       libgit2: 1.5.0
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.7
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.1
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: 1.10.1
  python-gnupg: 0.5.2
        PyYAML: 6.0.1
         PyZMQ: 25.1.2
        relenv: 0.15.1
         smmap: 5.0.1
       timelib: 0.3.0
       Tornado: 6.3.3
           ZMQ: 4.3.4
 
Salt Package Information:
  Package Type: onedir
 
System Versions:
          dist: debian 12.5 bookworm
        locale: utf-8
       machine: x86_64
       release: 6.1.0-20-amd64
        system: Linux
       version: Debian GNU/Linux 12.5 bookworm
 

I can confirm the issue and that /opt/saltstack/salt/bin/python3.10 -m pip install mysqlclient is a workaround for my version:

Salt Version:
          Salt: 3006.6
 
Python Version:
        Python: 3.10.13 (main, Nov 15 2023, 04:34:27) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: 18.6.1
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.3
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.14.2
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: debian 12 bookworm
        locale: utf-8
       machine: x86_64
       release: 6.1.0-18-amd64
        system: Linux
       version: Debian GNU/Linux 12 bookworm

Confirmed here as well; occurred for me with libvirt-python.

Issue still occurs even if calling salt-pip explicitly at the shell on the minion.

Running /opt/saltstack/salt/bin/python3.10 -m pip install libvirt-python as root did work for me (after the failed pip.installed state ran, at least). You’ll probably have to restart salt-minion after.

This definitely looks like a salt-pip/pip.installed cockup.