Skip to content

1. Installation

sidhujasminder edited this page Mar 1, 2018 · 8 revisions

Installation

JSNAPy requires Python 2.7 or Python>=3.4 and associated pip tool

1. Install from PyPI
      sudo pip install jsnapy
2. Install using pip command from source code
      sudo pip install git+https://github.com/Juniper/jsnapy.git 
3. Install by cloning source code
    a) Clone the source code from this git repository
           git clone https://github.com/Juniper/jsnapy
       Or Download source code from
           https://github.com/Juniper/jsnapy  
       Untar jsnapy-master.zip (if downloaded zip folder) using command
       unzip jsnapy-master.zip
    b) Go to jsnapy-master folder and install by:
       sudo pip install .
       or 
       sudo python setup.py sdist
       sudo pip install dist/jsnapy-x.x.tar.gz

Update JSNAPy:

  1. Update using pip command from source code

    sudo pip install -U git+https://github.com/Juniper/jsnapy.git

  2. Update using pip command from PyPI

    sudo pip install -U jsnapy

Custom jsnapy lookup directory Added in v1.1

  1. Jsnapy has the following default structure during installation:

       /etc/jsnapy/
                |____ testfiles/
                |____ snapshots/
                |____ jsnapy.cfg
                |____ logging.yml              
    
  2. /etc/jsnapy also serves as the default lookup directory to search for configuration files when running various jsnapy commands.

  3. To change the default lookup directory during installation one can use the following commands:

    • Installation via pip: sudo pip install jsnapy --install-option="--install-data=~/Desktop/test_inst"
      or
      sudo pip install dist/jsnapy-x.x.tar.gz --install-option="--install-data=~/Desktop/test_inst"
    • Installation via setup.py: sudo python setup.py install --install-data ~/Desktop/test_inst

JSNAPy Installation in Python Virtual Environment Added in v1.2

Use the above installation methods, without sudo. This would avoid system wide installation and help using JSNAPy installed within the virtual environment.

Following these steps should do the installation:

    virtualenv venv

    source venv/bin/activate

    pip install jsnapy

Now to check which jsnapy is being used, try

     which jsnapy

This should point to venv/bin/jsnapy

Major Note for virtualenv:

In Some Cases it has been observed that on uninstalling jsnapy from a virtualenv(venv) and then reinstalling jsnapy in the same environment, prevents the creation of the venv/var and venv/etc folders. the reason is that the pip during install picks up the cache and tries to install it. This prevents the creation of the env/var and env/etc folders.

Recommended way of installing in virtualenv is from source using-

Suggested: pip install --no-cache jsnapy

Also works with: pip install --no-binary jsnapy jsnapy

JSNAPy Installation in Windows Added in v1.2

The above installation are also applicable in windows. The above command will install jsnapy. It can also be installed with custom directories or from github source code as per given arguments.

Note:

  1. sudo is not identified in windows
  2. /etc/jsnapy is identified in unix based devices, for windows the entire structure is with respect to ~/jsnapy/ and for python virtual environment let's say venv, it is venv/etc/jsnapy/

'~' : user home directory

You can’t perform that action at this time.