junos-eznc required but does not appear to be installed

1,052 views
Skip to first unread message

Anish Patel

unread,
Sep 6, 2017, 4:28:54 PM9/6/17
to Junos Python EZ
Hi all,

I am getting the following error when trying to run a playbook

NY-APatel-home:ansible anish.patel$ ansible-playbook -i dev interface.yaml

PLAY [link-switch] *******************************************************************************************

TASK [Install JUNOS] *****************************************************************************************
fatal: [cart-acx]: FAILED! => {"changed": false, "failed": true, "msg": "junos-eznc is required but does not appear to be installed. It can be installed using `pip  install junos-eznc`"}

PLAY RECAP ***************************************************************************************************
cart-acx                   : ok=0    changed=0    unreachable=0    failed=1 

However junos-eznc is installed

NY-APatel-home:ansible anish.patel$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
ansible (2.3.2.0)
appdirs (1.4.3)
asn1crypto (0.22.0)
bcrypt (3.1.3)
cffi (1.10.0)
colorama (0.3.9)
cryptography (2.0.3)
enum34 (1.1.6)
idna (2.6)
ipaddress (1.0.18)
Jinja2 (2.9.6)
junos-eznc (2.1.7.dev0)
junos-netconify (1.0.2)
jxmlease (1.0.1)
lxml (3.8.0)
MarkupSafe (1.0)
ncclient (0.5.3)
netaddr (0.7.19)
packaging (16.8)
paramiko (2.2.1)
pep8 (1.7.0)
pip (9.0.1)
pyasn1 (0.3.3)
pycparser (2.18)
pycrypto (2.6.1)
PyNaCl (1.1.2)
pyparsing (2.2.0)
pyserial (3.4)
pyuda (0.1.dev0)
PyYAML (3.12)
scp (0.10.2)
setuptools (36.4.0)
six (1.10.0)
wheel (0.29.0)

Any ideas?  I've uninstalled, re-installed, upgraded etc.

Thanks much!

Anish

Nitin Kr (Automation)

unread,
Sep 7, 2017, 12:33:48 AM9/7/17
to Anish Patel, Junos Python EZ

Hi Anish,

 

Share the output of below command

which python

 

you might need to setup ansible_python_interpreter

refer: http://docs.ansible.com/ansible/latest/intro_inventory.html

 

hope that helps

 

Thanks

Nitin Kr

--
You received this message because you are subscribed to the Google Groups "Junos Python EZ" group.
To unsubscribe from this group and stop receiving emails from it, send an email to junos-python-...@googlegroups.com.
Visit this group at https://groups.google.com/group/junos-python-ez.
To view this discussion on the web visit https://groups.google.com/d/msgid/junos-python-ez/94ae6fc7-85d0-4a43-af63-6773eba5a39f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anish Patel

unread,
Sep 7, 2017, 8:25:48 AM9/7/17
to Junos Python EZ
Thanks for the quick reply Nitin.

Here is my playbook just for reference - when i use the junos_command modules I don't get any issues.
- hosts: link-switch
  roles:
  - Juniper.junos
  gather_facts: false
  connection: local

  tasks:
  - name: Install JUNOS
    junos_package:
      force: false
      reboot: false
      src: /var/tmp/jinstall-ppc-16.2R1.6-signed.tgz
      provider: "{{ credential }}"

NY-APatel-home:~ anish.patel$ which python
/usr/bin/python

worth noting I am doing this on a mac pro just for Proof Of Concept before I put this on ubuntu somewhere

I'll take a look at the reference you sent.

Thanks again!

Anish

Nitin Kr (Automation)

unread,
Sep 7, 2017, 10:07:19 AM9/7/17
to Anish Patel, Junos Python EZ

Hi Anish,

 

Need few other details. Can you share the output for below 2 commands?

 

python -c "from jnpr import junos; print junos"

python -c "import sys; print sys.path"

Anish Patel

unread,
Sep 7, 2017, 10:54:09 AM9/7/17
to Junos Python EZ
Sure here you go.

Last login: Thu Sep  7 10:34:47 on ttys008
NY-APatel-home:~ anish.patel$ python -c "from jnpr import junos; print junos"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/junos_eznc-2.1.7.dev0-py2.7.egg/jnpr/junos/__init__.py", line 1, in <module>
    from jnpr.junos.device import Device
  File "/Library/Python/2.7/site-packages/junos_eznc-2.1.7.dev0-py2.7.egg/jnpr/junos/device.py", line 18, in <module>
    from ncclient import manager as netconf_ssh
  File "build/bdist.macosx-10.11-intel/egg/ncclient/manager.py", line 22, in <module>
  File "build/bdist.macosx-10.11-intel/egg/ncclient/operations/__init__.py", line 16, in <module>
  File "build/bdist.macosx-10.11-intel/egg/ncclient/operations/rpc.py", line 20, in <module>
  File "build/bdist.macosx-10.11-intel/egg/ncclient/transport/__init__.py", line 18, in <module>
  File "build/bdist.macosx-10.11-intel/egg/ncclient/transport/ssh.py", line 26, in <module>
  File "build/bdist.macosx-10.11-intel/egg/paramiko/__init__.py", line 31, in <module>
  File "build/bdist.macosx-10.11-intel/egg/paramiko/transport.py", line 33, in <module>
ImportError: No module named cryptography.hazmat.backends

NY-APatel-home:~ anish.patel$
NY-APatel-home:~ anish.patel$
NY-APatel-home:~ anish.patel$ python -c "import sys; print sys.path"
['', '/Library/Python/2.7/site-packages/junos_eznc-2.1.7.dev0-py2.7.egg', '/Library/Python/2.7/site-packages/pyserial-3.4-py2.7.egg', '/Library/Python/2.7/site-packages/netaddr-0.7.19-py2.7.egg', '/Library/Python/2.7/site-packages/PyYAML-3.12-py2.7-macosx-10.11-intel.egg', '/Library/Python/2.7/site-packages/Jinja2-2.9.6-py2.7.egg', '/Library/Python/2.7/site-packages/scp-0.10.2-py2.7.egg', '/Library/Python/2.7/site-packages/paramiko-2.2.1-py2.7.egg', '/Library/Python/2.7/site-packages/ncclient-0.5.3-py2.7.egg', '/Library/Python/2.7/site-packages/lxml-3.8.0-py2.7-macosx-10.11-intel.egg', '/Library/Python/2.7/site-packages/MarkupSafe-1.0-py2.7-macosx-10.11-intel.egg', '/Library/Python/2.7/site-packages/pyasn1-0.3.3-py2.7.egg', '/Library/Python/2.7/site-packages/PyNaCl-1.1.2-py2.7-macosx-10.11-intel.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages']
NY-APatel-home:~ anish.patel$

Nitin Kr (Automation)

unread,
Sep 7, 2017, 12:22:32 PM9/7/17
to Anish Patel, Junos Python EZ

Hi Anish,

 

Cryptography is missing from your system. Please do run these 2 below command

 

pip install –upgrade pip

pip install cryptography

 

Also try options provided at

https://stackoverflow.com/questions/31569339/importerror-no-module-named-cryptography-hazmat-backends-boxsdk-on-mac

Reply all
Reply to author
Forward
0 new messages