in

venv: python module napalm is required?


I know this probably asked many times about missing modules in venv. I have make sure all the module paths is set but I don’t seem to see what is missing in my environment as I keep getting the python module napalm is required in my ansible run. Get someone shred some light here?

To reproduce:

python3 -m venv ~/Documents/venv/project1
. ~/Documents/venv/project1/bin/activate
python3 -m pip install --upgrade pip
pip3 install ansible napalm napalm-ansible

# export environment variables 
export ANSIBLE_LIBRARY=~/Documents/venv/project1/lib/python3.9/site-packages/ansible/modules/:~/Documents/venv/project1/lib/python3.9/site-packages/napalm_ansible/modules/:~/Documents/venv/project1/lib/python3.9/site-packages/napalm
export ANSIBLE_ACTION_PLUGINS=~/Documents/venv/project1/lib/python3.9/site-packages/napalm_ansible/plugins/action
export ANSIBLE_PYTHON_INTERPRETER=~/Documents/venv/project1/bin/python

#ansible version
(project1) RAQ10-642:project1 lchan$ ansible --version
ansible [core 2.12.1]
  config file = /Users/lchan/Documents/rgithub/project1/ansible.cfg
  configured module search path = ['/Users/lchan/Documents/venv/project1/lib/python3.9/site-packages/ansible/modules', '/Users/lchan/Documents/venv/project1/lib/python3.9/site-packages/napalm_ansible/modules', '/Users/lchan/Documents/venv/project1/lib/python3.9/site-packages/napalm']
  ansible python module location = /Users/lchan/Documents/venv/project1/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/lchan/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/lchan/Documents/venv/project1/bin/ansible
  python version = 3.9.9 (main, Nov 21 2021, 03:22:47) [Clang 12.0.0 (clang-1200.0.32.29)]
  jinja version = 2.11.2
  libyaml = True

# run stuff
cd ~/Documents/github/project1/
ansible-playbook project/project_pb.yml -i project/inventory/stg.ini -l xyz --extra-var "commit_changes=0" -vvv

Errors:

ansible-playbook [core 2.12.1]
  config file = /Users/lchan/Documents/rgithub/project1/ansible.cfg
  configured module search path = ['/Users/lchan/Documents/venv/project1/lib/python3.9/site-packages/ansible/modules', '/Users/lchan/Documents/venv/project1/lib/python3.9/site-packages/napalm_ansible/modules', '/Users/lchan/Documents/venv/project1/lib/python3.9/site-packages/napalm']
  ansible python module location = /Users/lchan/Documents/venv/project1/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/lchan/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/lchan/Documents/venv/project1/bin/ansible-playbook
  python version = 3.9.9 (main, Nov 21 2021, 03:22:47) [Clang 12.0.0 (clang-1200.0.32.29)]
  jinja version = 2.11.2
  libyaml = True
Using /Users/lchan/Documents/rgithub/project1/ansible.cfg as config file
host_list declined parsing /Users/lchan/Documents/rgithub/project1/project/inventory/stg.ini as it did not pass its verify_file() method
script declined parsing /Users/lchan/Documents/rgithub/project1/project/inventory/stg.ini as it did not pass its verify_file() method
auto declined parsing /Users/lchan/Documents/rgithub/project1/project/inventory/stg.ini as it did not pass its verify_file() method
yaml declined parsing /Users/lchan/Documents/rgithub/project1/project/inventory/stg.ini as it did not pass its verify_file() method
Parsed /Users/lchan/Documents/rgithub/project1/project/inventory/stg.ini inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

...


TASK [junos : Get facts on the interfaces in the running config] **********************************************************************************************************************************************************************************************************
task path: /Users/lchan/Documents/rgithub/project1/project/roles/junos/tasks/main.yml:20
<10.224.240.164> ESTABLISH LOCAL CONNECTION FOR USER: lchan
<10.224.240.164> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /tmp/ `"&& mkdir "` echo /tmp/ansible-tmp-1640903866.1761029-31946-162751198371511 `" && echo ansible-tmp-1640903866.1761029-31946-162751198371511="` echo /tmp/ansible-tmp-1640903866.1761029-31946-162751198371511 `" ) && sleep 0'
Using module file /Users/lchan/Documents/venv/project1/lib/python3.9/site-packages/napalm_ansible/modules/napalm_get_facts.py
<10.224.240.164> PUT /Users/lchan/.ansible/tmp/ansible-local-31903l6xjidx1/tmp7fgqh7ab TO /private/tmp/ansible-tmp-1640903866.1761029-31946-162751198371511/AnsiballZ_napalm_get_facts.py
<10.224.240.164> EXEC /bin/sh -c 'chmod u+x /tmp/ansible-tmp-1640903866.1761029-31946-162751198371511/ /tmp/ansible-tmp-1640903866.1761029-31946-162751198371511/AnsiballZ_napalm_get_facts.py && sleep 0'
<10.224.240.164> EXEC /bin/sh -c '/usr/bin/python3 /tmp/ansible-tmp-1640903866.1761029-31946-162751198371511/AnsiballZ_napalm_get_facts.py && sleep 0'
<10.224.240.164> EXEC /bin/sh -c 'rm -f -r /tmp/ansible-tmp-1640903866.1761029-31946-162751198371511/ > /dev/null 2>&1 && sleep 0'
fatal: [cr1-ams1]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "args": null,
            "dev_os": "junos",
            "filter": [
                "config"
            ],
            "hostname": "10.224.240.164",
            "ignore_notimplemented": false,
            "optional_args": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "provider": {
                "dev_os": null,
                "hostname": "10.224.240.164",
                "password": null,
                "timeout": 60,
                "username": "ansible"
            },
            "timeout": 100,
            "username": "napalm"
        }
    },
    "msg": "the python module napalm is required"
}



Source: https://stackoverflow.com/questions/70537433/venv-python-module-napalm-is-required

Job Protal App Built Using Flutter

The web framework for writing faster sites, faster. Written in Go