Automation

Expand all | Collapse all

Module not found issue with jnpr

  • 1.  Module not found issue with jnpr

    Posted 10-23-2019 04:21

    I am having some difficulty getting junos-eznc installed on a Centos 7 box and was hoping for some guidance...

    The Centos 7 VM already has Python 2.7 installed along with jnpr.junos module, however the code we need to run was built using Python 3.6.  If I run the script from default python install (2.7) I can import jnpr module, however if I switch to python3 and run the script I get the error "ModuleNotFoundError: No module named 'jnpr'".

     

    I have tried switching to default python 3 using "scl enable rh-python3 bash" and then installing junos-eznc using pip and pip3 which returns "Requirement already satisfied" but lists the python2.7 package location.  

     

    I just need to be able to import jnpr when using python3, any ideas, pointers or help would be appreaciated..

    Drac


    #jnpr
    #eznc


  • 2.  RE: Module not found issue with jnpr

    Posted 10-23-2019 04:32

    Check once PIP is install successfullyt or not and also there version.

    Then try to install pip install junos-eznc.

     



  • 3.  RE: Module not found issue with jnpr

    Posted 10-23-2019 07:49

    pip -V returns - pip 19.3 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)

    pip3 -V returns - pip 19.3 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)

     

    trying to resinstall PIP and PIP3 returns the same results too..

     

    $ sudo pip install junos-eznc
    DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    Requirement already satisfied: junos-eznc in /usr/lib64/python2.7/site-packages (2.3.0)
    Requirement already satisfied: lxml>=3.2.4 in /usr/lib64/python2.7/site-packages (from junos-eznc) (4.4.1)
    Requirement already satisfied: netaddr in /usr/lib/python2.7/site-packages (from junos-eznc) (0.7.19)
    Requirement already satisfied: PyYAML>=5.1 in /usr/lib64/python2.7/site-packages (from junos-eznc) (5.1.2)
    Requirement already satisfied: ncclient>=0.6.3 in /usr/lib/python2.7/site-packages (from junos-eznc) (0.6.6)
    Requirement already satisfied: yamlordereddictloader in /usr/lib/python2.7/site-packages (from junos-eznc) (0.4.0)
    Requirement already satisfied: pyserial in /usr/lib/python2.7/site-packages (from junos-eznc) (3.4)
    Requirement already satisfied: scp>=0.7.0 in /usr/lib/python2.7/site-packages (from junos-eznc) (0.13.2)
    Requirement already satisfied: jinja2>=2.7.1 in /usr/lib64/python2.7/site-packages (from junos-eznc) (2.10.3)
    Requirement already satisfied: pyparsing in /usr/lib/python2.7/site-packages (from junos-eznc) (2.4.2)
    Requirement already satisfied: transitions in /usr/lib/python2.7/site-packages (from junos-eznc) (0.7.1)
    Requirement already satisfied: six in /usr/lib/python2.7/site-packages (from junos-eznc) (1.12.0)
    Requirement already satisfied: paramiko>=1.15.2 in /usr/lib/python2.7/site-packages (from junos-eznc) (2.6.0)
    Requirement already satisfied: setuptools>0.6 in /usr/lib/python2.7/site-packages (from ncclient>=0.6.3->junos-eznc) (41.4.0)
    Requirement already satisfied: selectors2>=2.0.1 in /usr/lib/python2.7/site-packages (from ncclient>=0.6.3->junos-eznc) (2.0.1)
    Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib64/python2.7/site-packages (from jinja2>=2.7.1->junos-eznc) (1.1.1)
    Requirement already satisfied: cryptography>=2.5 in /usr/lib64/python2.7/site-packages (from paramiko>=1.15.2->junos-eznc) (2.8)
    Requirement already satisfied: pynacl>=1.0.1 in /usr/lib64/python2.7/site-packages (from paramiko>=1.15.2->junos-eznc) (1.3.0)
    Requirement already satisfied: bcrypt>=3.1.3 in /usr/lib64/python2.7/site-packages (from paramiko>=1.15.2->junos-eznc) (3.1.7)
    Requirement already satisfied: enum34; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography>=2.5->paramiko>=1.15.2->junos-eznc) (1.1.6)
    Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/lib64/python2.7/site-packages (from cryptography>=2.5->paramiko>=1.15.2->junos-eznc) (1.13.0)
    Requirement already satisfied: ipaddress; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography>=2.5->paramiko>=1.15.2->junos-eznc) (1.0.16)
    Requirement already satisfied: pycparser in /usr/lib/python2.7/site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.5->paramiko>=1.15.2->junos-eznc) (2.19)

     


    $ sudo pip3 install junos-eznc
    DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    Requirement already satisfied: junos-eznc in /usr/lib64/python2.7/site-packages (2.3.0)
    Requirement already satisfied: lxml>=3.2.4 in /usr/lib64/python2.7/site-packages (from junos-eznc) (4.4.1)
    Requirement already satisfied: netaddr in /usr/lib/python2.7/site-packages (from junos-eznc) (0.7.19)
    Requirement already satisfied: PyYAML>=5.1 in /usr/lib64/python2.7/site-packages (from junos-eznc) (5.1.2)
    Requirement already satisfied: ncclient>=0.6.3 in /usr/lib/python2.7/site-packages (from junos-eznc) (0.6.6)
    Requirement already satisfied: yamlordereddictloader in /usr/lib/python2.7/site-packages (from junos-eznc) (0.4.0)
    Requirement already satisfied: pyserial in /usr/lib/python2.7/site-packages (from junos-eznc) (3.4)
    Requirement already satisfied: scp>=0.7.0 in /usr/lib/python2.7/site-packages (from junos-eznc) (0.13.2)
    Requirement already satisfied: jinja2>=2.7.1 in /usr/lib64/python2.7/site-packages (from junos-eznc) (2.10.3)
    Requirement already satisfied: pyparsing in /usr/lib/python2.7/site-packages (from junos-eznc) (2.4.2)
    Requirement already satisfied: transitions in /usr/lib/python2.7/site-packages (from junos-eznc) (0.7.1)
    Requirement already satisfied: six in /usr/lib/python2.7/site-packages (from junos-eznc) (1.12.0)
    Requirement already satisfied: paramiko>=1.15.2 in /usr/lib/python2.7/site-packages (from junos-eznc) (2.6.0)
    Requirement already satisfied: setuptools>0.6 in /usr/lib/python2.7/site-packages (from ncclient>=0.6.3->junos-eznc) (41.4.0)
    Requirement already satisfied: selectors2>=2.0.1 in /usr/lib/python2.7/site-packages (from ncclient>=0.6.3->junos-eznc) (2.0.1)
    Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib64/python2.7/site-packages (from jinja2>=2.7.1->junos-eznc) (1.1.1)
    Requirement already satisfied: pynacl>=1.0.1 in /usr/lib64/python2.7/site-packages (from paramiko>=1.15.2->junos-eznc) (1.3.0)
    Requirement already satisfied: cryptography>=2.5 in /usr/lib64/python2.7/site-packages (from paramiko>=1.15.2->junos-eznc) (2.8)
    Requirement already satisfied: bcrypt>=3.1.3 in /usr/lib64/python2.7/site-packages (from paramiko>=1.15.2->junos-eznc) (3.1.7)
    Requirement already satisfied: cffi>=1.4.1 in /usr/lib64/python2.7/site-packages (from pynacl>=1.0.1->paramiko>=1.15.2->junos-eznc) (1.13.0)
    Requirement already satisfied: enum34; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography>=2.5->paramiko>=1.15.2->junos-eznc) (1.1.6)
    Requirement already satisfied: ipaddress; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography>=2.5->paramiko>=1.15.2->junos-eznc) (1.0.16)
    Requirement already satisfied: pycparser in /usr/lib/python2.7/site-packages (from cffi>=1.4.1->pynacl>=1.0.1->paramiko>=1.15.2->junos-eznc) (2.19)



  • 4.  RE: Module not found issue with jnpr

    Posted 10-23-2019 08:36

    Hello Draccusfly,

     

    I got it what problem you are phasing. but once can you send the screenshot of that error.so i can better explain you how  to recover this.

     

    Thanks.

     

     

     



  • 5.  RE: Module not found issue with jnpr

    Posted 10-23-2019 09:07

    Hi p.Versha

     

    Here's the actual error we see:

     

    $ python3 /home/scripts/srx-chks/RouterApp.py
    Traceback (most recent call last):
    File "/home/scripts/srx-chks/RouterApp.py", line 1, in <module>
    from router_connector import router_connection
    File "/home/scripts/srx-chks/router_connector.py", line 1, in <module>
    from jnpr.junos import Device
    ModuleNotFoundError: No module named 'jnpr'