Need help reg pip.installed

34 views
Skip to first unread message

Venkataramana Kintali

unread,
Jun 10, 2024, 12:30:20 PMJun 10
to salt-...@googlegroups.com
hello there,

Need some help and inputs regarding one  of our salt states. We are using salt minion 3007.1 version and salt master 3005 version. The minion is ubuntu22 node with python 3.10 and pip 22. When I run one of our salt states to install a pip pkg (using pip.installed) , salt is attempting to install under salt's pip salt-pip. We are expecting this to be installed with the system level pip instead of salt's pip. Also I get  content type mismatch error when pip attempts to install the package.

Code:

include:
    - pkgs.pip

pip-mysql-connector-python-pkg:
    pkg.installed:
        - name: bash
        - require:
            - pip: pip-mysql-connector-python-pip

pip-mysql-connector-python-pip:
    pip.installed:
        - name: mysql-connector-python
        - find_links: "{{ pillar.artifactory }}/bin-ext-release-local/mysql-connector-python-2.0.3.tar.gz"
        - require:
            - pkg: pip-pkg

Output:

[INFO    ] Running state [mysql-connector-python] at time 16:09:11.052412
[INFO    ] Executing state pip.installed for [mysql-connector-python]
[INFO    ] Executing command /opt/saltstack/salt/salt-pip in directory '/root'
[INFO    ] Executing command /opt/saltstack/salt/salt-pip in directory '/root' <==== Attempting to install with salt-pip
[INFO    ] Executing command /opt/saltstack/salt/salt-pip in directory '/root'
[ERROR   ] Command '/opt/saltstack/salt/salt-pip' failed with return code: 1

 stdout: Looking in indexes: http://artifactory/api/pypi/pypi-cache/simple/
Looking in links: http://artifactory/bin-ext-release-local/mysql-connector-python-2.0.3.tar.gz
Collecting mysql-connector-python
  Using cached http://artifactory/api/pypi/pypi-cache/packages/packages/b1/71/764bb13e62e97f8a6cab315c916c9c35d734dafa4a198f45c73651171ad5/mysql_connector_python-8.4.0-cp310-cp310-manylinux_2_17_x86_64.whl (19.4 MB)
Installing collected packages: mysql-connector-python
  File already within root directory: /opt/saltstack/salt/extras-3.10/mysql/vendor/libssl.so.3
  File already within root directory: /opt/saltstack/salt/extras-3.10/mysql/vendor/libcrypto.so.3
  Adjust rpath of /opt/saltstack/salt/extras-3.10/_mysql_connector.cpython-310-x86_64-linux-gnu.so to $ORIGIN/../lib
  Set RPATH=$ORIGIN/../lib:$ORIGIN/mysql/vendor /opt/saltstack/salt/extras-3.10/_mysql_connector.cpython-310-x86_64-linux-gnu.so
[ERROR   ] stderr: WARNING: Skipping page http://artifactory/bin-ext-release-local/mysql-connector-python-2.0.3.tar.gz because the HEAD request got Content-Type: application/x-gzip. The only supported Content-Types are application/vnd.pypi.simple.v1+json, application/vnd.pypi.simple.v1+html, and text/html
  WARNING: In `rpath_only mode` but /lib/x86_64-linux-gnu/libstdc++.so.6 is not in /opt/saltstack/salt
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'patchelf'
[ERROR   ] retcode: 1
[ERROR   ] Failed to install packages: mysql-connector-python. Error: Looking in indexes: http://artifactory/api/pypi/pypi-cache/simple/
Looking in links: http://artifactory/bin-ext-release-local/mysql-connector-python-2.0.3.tar.gz
Collecting mysql-connector-python
  Using cached http://artifactory/api/pypi/pypi-cache/packages/packages/b1/71/764bb13e62e97f8a6cab315c916c9c35d734dafa4a198f45c73651171ad5/mysql_connector_python-8.4.0-cp310-cp310-manylinux_2_17_x86_64.whl (19.4 MB)
Installing collected packages: mysql-connector-python
  File already within root directory: /opt/saltstack/salt/extras-3.10/mysql/vendor/libssl.so.3
  File already within root directory: /opt/saltstack/salt/extras-3.10/mysql/vendor/libcrypto.so.3
  Adjust rpath of /opt/saltstack/salt/extras-3.10/_mysql_connector.cpython-310-x86_64-linux-gnu.so to $ORIGIN/../lib
  Set RPATH=$ORIGIN/../lib:$ORIGIN/mysql/vendor /opt/saltstack/salt/extras-3.10/_mysql_connector.cpython-310-x86_64-linux-gnu.so WARNING: Skipping page http://artifactory/bin-ext-release-local/mysql-connector-python-2.0.3.tar.gz because the HEAD request got Content-Type: application/x-gzip. The only supported Content-Types are application/vnd.pypi.simple.v1+json, application/vnd.pypi.simple.v1+html, and text/html
  WARNING: In `rpath_only mode` but /lib/x86_64-linux-gnu/libstdc++.so.6 is not in /opt/saltstack/salt
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'patchelf'
[INFO    ] Completed state [mysql-connector-python] at time 16:09:14.236450 (duration_in_ms=3184.038)


Any help and inputs are appreciated.

Thanks
Venkat


Dafydd Jones (techneg.it)

unread,
Jun 10, 2024, 4:30:14 PMJun 10
to salt-...@googlegroups.com
Hi,

for the last few releases Salt now comes with its own Python as you've discovered.
It's a bit hidden away but the Salt install guide has these instructions:

After upgrading, you might need to update any state files that use pip.installed if you need to install Python packages into the system Python environment. In the state file, provide the pip_bin or bin_env to the pip state module.

For example:

lib-foo:
  pip.installed:
    - pip_bin: /usr/bin/pip3
lib-bar:
  pip.installed:
    - bin_env: /usr/bin/python3
See more at https://docs.saltproject.io/salt/install-guide/en/latest/topics/upgrade-to-onedir.html

Note that a newer minion and an older master is not a supported configuration.
Best practice is to upgrade the master first then your minions.

HTH
Dafydd

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/CADPVCyK%3D4PCdrSvqnrJ8s3BVAJ%3D18wdoz29xgrXACbAN6G1MFA%40mail.gmail.com.

Reed Dier

unread,
Jun 10, 2024, 4:31:49 PMJun 10
to venkataram...@gmail.com, salt-...@googlegroups.com
Salt 3006 and up use onedir (and versions of 3005), which is a bundled python, rather than system python.

You need to specify the bin_env or pip_bin now, as it defaults to the bundled pip/python now.

Phipps, Thomas

unread,
Jun 10, 2024, 8:21:40 PMJun 10
to salt-...@googlegroups.com
one thing and this has nothing to do with your problem. However, it might save you a headache later.

a minion on a newer version than a master is not supported. and never will be..the master should always either be newer or on the same version as the minion.

venkataram...@gmail.com

unread,
Jun 25, 2024, 1:48:04 AM (5 days ago) Jun 25
to Salt-users
Thank you all. Any help on this error from pip ( Content Type error) is appreciated.


[INFO    ] Running state [mysql-connector-python] at time 16:09:11.052412
[INFO    ] Executing state pip.installed for [mysql-connector-python]
[INFO    ] Executing command /opt/saltstack/salt/salt-pip in directory '/root'
[INFO    ] Executing command /opt/saltstack/salt/salt-pip in directory '/root' <==== Attempting to install with salt-pip
[INFO    ] Executing command /opt/saltstack/salt/salt-pip in directory '/root'
[ERROR   ] Command '/opt/saltstack/salt/salt-pip' failed with return code: 1

 stdout: Looking in indexes: http://artifactory/api/pypi/pypi-cache/simple/
Looking in links: http://artifactory/bin-ext-release-local/mysql-connector-python-2.0.3.tar.gz
Collecting mysql-connector-python
  Using cached http://artifactory/api/pypi/pypi-cache/packages/packages/b1/71/764bb13e62e97f8a6cab315c916c9c35d734dafa4a198f45c73651171ad5/mysql_connector_python-8.4.0-cp310-cp310-manylinux_2_17_x86_64.whl (19.4 MB)
Installing collected packages: mysql-connector-python
  File already within root directory: /opt/saltstack/salt/extras-3.10/mysql/vendor/libssl.so.3
  File already within root directory: /opt/saltstack/salt/extras-3.10/mysql/vendor/libcrypto.so.3
  Adjust rpath of /opt/saltstack/salt/extras-3.10/_mysql_connector.cpython-310-x86_64-linux-gnu.so to $ORIGIN/../lib
  Set RPATH=$ORIGIN/../lib:$ORIGIN/mysql/vendor /opt/saltstack/salt/extras-3.10/_mysql_connector.cpython-310-x86_64-linux-gnu.so
[ERROR   ] stderr: WARNING: Skipping page http://artifactory/bin-ext-release-local/mysql-connector-python-2.0.3.tar.gz because the HEAD request got Content-Type: application/x-gzip. The only supported Content-Types are application/vnd.pypi.simple.v1+json, application/vnd.pypi.simple.v1+html, and text/html. <<<============
  WARNING: In `rpath_only mode` but /lib/x86_64-linux-gnu/libstdc++.so.6 is not in /opt/saltstack/salt
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'patchelf'

Phipps, Thomas

unread,
Jun 25, 2024, 4:52:04 AM (4 days ago) Jun 25
to salt-...@googlegroups.com
you need to have patchelf installed in your operating system. you most likely are also going to need readelf which is available in binutils.

these could be handled with a standard pkf.installed.

Reply all
Reply to author
Forward
0 new messages