saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.11k stars 5.47k forks source link

[BUG] "No module named 'Crypto'" error when running salt-ssh host schedule.list #66845

Closed jwezel closed 1 month ago

jwezel commented 1 month ago

Description When running

$ salt-ssh host schedule.list

I get the error:

ModuleNotFoundError: No module named 'Crypto'

Setup

pipx install salt

Please be as specific as possible and give set-up details.

Steps to Reproduce the behavior

$ salt-ssh host schedule.list

Expected behavior

host:
    schedule: {}

Versions Report

Salt Version:
          Salt: 3007.1

Python Version:
        Python: 3.12.5 (main, Aug  6 2024, 19:08:49) [GCC 11.4.0]

Dependency Versions:
          cffi: 1.17.0
      cherrypy: 18.10.0
      dateutil: 2.9.0.post0
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.4
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.8
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.1
     pycparser: 2.22
  pycryptodomex: 3.20.0
        pygit2: Not Installed
  python-gnupg: 0.5.2
        PyYAML: 6.0.2
         PyZMQ: 26.2.0
        relenv: Not Installed
         smmap: Not Installed
       timelib: 0.3.0
       Tornado: 6.4.1
           ZMQ: 4.3.5

Salt Package Information:
  Package Type: Not Installed

System Versions:
          dist: ubuntu 24.04 noble
        locale: utf-8
       machine: x86_64
       release: 6.8.0-41-generic
        system: Linux
       version: Ubuntu 24.04 noble

Additional context

I could fix the problem by installing pycryptodome (pipx inject salt PyCryptodome) and then including it into Thin Salt:

salt-ssh --thin-extra-modules=Crypto -t host schedule.list

but it goes without saying that this needs to be fixed.

welcome[bot] commented 1 month ago

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

dmurphy18 commented 1 month ago

@jwezel Can you retry this with installed packages rather than pipx. You are using Python 3.12.5 which does not work with Salt (work is ongoing to provide support for Python 3.12, but it is not complete yet). The packaged software makes use of an internal Python 3.10 version and is ensured to have all dependencies at a tested and supported version, rather than what may have been already installed on your machine.

jwezel commented 1 month ago

OK, so it's due to my unorthodox way of installing. Question remains why pycryptodome is not included in the package, should probably be a line in a requirements.txt. But anyways, thanks for the info. Closing it.

dmurphy18 commented 1 month ago

@jwezel :rofl: So pycryptodome and pycryptodomex, all depended on the OS used, back when I was responsible for classic packagingi (and what a PITA they were too). Salt is moving away from these and to using cryptography which is a lot better.