Pages

Tuesday, 29 April 2014

Install Python pip on QNAP NAS

  • QNAP Model: TS–439 Pro II
  • CPU: Intel(R) Atom(TM)

Setup procedures

  • Install Python from QNAP App center. (It should be the most easy way)
  • Access your NAS through SSH, ex. ssh admin@192.168.1.2
  • Install setuptools
    $ wget https://pypi.python.org/packages/source/s/setuptools/setuptools-3.4.4.tar.gz --no-check-certificate      
    $ tar xf setuptools-3.4.4.tar.gz        
    $ cd setuptools-3.4.4       
    $ python setup.py build
    $ python setup.py install
    
  • Install pip
    $ curl -O https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz -k
    $ tar xf pip-1.5.4.tar.gz
    $ cd pip-1.5.4
    $ python setup.py install   
    
  • Add symbolic links
    $ vim /share/MD0_DATA/.qpkg/Python/python.sh
    

    Note: you can find a cheatsheet on how to use vim here.

    Insert the following two statements under the “#create symbolic links” section

    /bin/ln -sf ${QPKG_BASE}/.qpkg/Python/bin/pip /usr/bin/pip
    /bin/ln -sf ${QPKG_BASE}/.qpkg/Python/bin/pip2.7 /usr/bin/pip2.7
    

    Save and exit.

    /share/MD0_DATA/.qpkg/Python/python.sh restart
    

SSL error when using pip

When running pip install you’ll get the following SSL error (run with -v option):

SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Workaround: Install libraries manually

Example:

  • Download the archive:
    curl -o boto-2.27.0.tar.gz https://pypi.python.org/packages/source/b/boto/boto-2.27.0.tar.gz#md5=47a4d81554380b21d85005f91d12a585 -k
    
  • Install the archive:
    pip install boto-2.27.0.tar.gz