HOWTO: Install and manage Python packages on FFP 0.7-arm

Marvell Kirkwood based
barmalej2
Posts: 2395
Joined: Sun Apr 29, 2012 5:24 pm

HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by barmalej2 » Mon Sep 02, 2013 8:51 am

Latest release on slacker br2 repo: python-2.7.9-arm-1
Prerequisites: FFP 0.7-arm, updated slacker sites with Uli's uwsiteloader.sh script.
The first thing you need is to install python-2.7.* and tools for managing python packages (pip-6.0.8 and setuptools-14.3.1):

Code: Select all

slacker -UuiA br2:python/
Secondly, install dependencies for python built-in modules:

Code: Select all

slacker -uiA br2:{expat,gettext,libiconv,libffi,ncurses,readline,gcc/gcc,gcc/gcc-solibs,uClibc,uClibc-solibs,sqlite,openssl} uli:{gdbm,zlib} s:{db5,bzip2}
Thirdly, gcc compiler with dependent libraries is required for "pip install" command, to compile C code for some packages:

Code: Select all

slacker -uiA br2:{gcc,gcc-solibs,gmp,mpfr,mpc,autoconf,automake,binutils,make,m4,pkg-config,libtool,check,dejagnu,expect,tcl,help2man,flex,texinfo,bison,intltool,libiconv,gettext,ncurses,perl-modules,uClibc,uClibc-solibs,findutils,patchutils} s:{perl-5.*,gawk,diffutils,gzip,bzip2,coreutils,grep,patch} mz:kernel_headers uli:zlib 
Further steps to install any package from PyPI (The Python Package Index-a repository of software for the Python programming language-https://pypi.python.org/pypi) are very simple. Pip has dependency packages installing mechanism. It will automatically download and install all dependency python packages as necessary for first requested package.

Install latest version of package:

Code: Select all

pip install PackageName
Install exact version of package

Code: Select all

pip install PackageName==1.0
List what packages are outdated:

Code: Select all

pip list -o
Upgrade a package:

Code: Select all

pip install --upgrade PackageName
Uninstall a package:

Code: Select all

pip uninstall PackageName
You will be asked to confirm uninstall process-Proceed (y/n)? y

Uninstall a package without confirming:

Code: Select all

pip uninstall -y PackageName
Show what files were installed:

Code: Select all

pip show --files PackageName
Search for package on PyPi:

Code: Select all

pip search PackageName
Personally I prefer go to PyPI web page-https://pypi.python.org/pypi directly and search for packages there.

Available commands:

Code: Select all

pip --help
Help on command:

Code: Select all

pip command --help
How to test python modules from newly installed python packages?
Python module name usually are the same as package name, but not necessary. You can find actual module name on the list of all python modules:

Code: Select all

pydoc modules
Check, do the installed pyhton module correctly functioning:

Code: Select all

python -c "import ModuleName"
Blank row output on screen is good, error output is bad.

More info about pip usage can be found on http://www.pip-installer.org/en/latest/usage.html
Differences between pip and setuptools (easy_install) are discussed here: http://stackoverflow.com/questions/3220 ... sy-install
Last edited by barmalej2 on Wed Oct 08, 2014 9:05 am, edited 24 times in total.

barmalej2
Posts: 2395
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by barmalej2 » Mon Sep 02, 2013 9:17 am

HOWTO: Upgrade from previous mine release-python-2.7.5-arm-0.txz

If you used my previous build and want to upgrade, this info will be relevant for you. Previous build was made with UCS4 support and the current one is with UCS2. It is the main reason, why all externally installed python packages (with setuptools-easy_install or pip tool doesn't matter) are incompatible with new version of python. Uninstall of external python packages is required.

Create a list of installed external python packages for pip uninstall command:

Code: Select all

pip freeze|xargs
Exclude from this list package wsgiref (it is the only one prebuild python package), select and paste list to pip uninstall command:

Code: Select all

pip uninstall -y packagename1==version packagename2==version
After uninstall of packages, you can proceed to upgrade python, following the steps from first post and after upgrading python, pip and setuptools, install packages again using the same list.

Note:
The wsgiref package is a part of the Python standard library. Currently it is the only one standard library package, that includes package metadata, so it is the only one standard library package, whose presence pip reports. Actually, it is an issue of python and looks like solved in version 3.3 http://bugs.python.org/issue12218
Last edited by barmalej2 on Sat Nov 09, 2013 9:01 am, edited 8 times in total.

User avatar
picard
Posts: 44
Joined: Tue Feb 05, 2013 6:46 am
Location: Germany
Contact:

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by picard » Sun Sep 08, 2013 1:40 pm

hello barmalej2,

I get this message from pip
root@NSA325:~# python -V
Python 2.7.5
root@NSA325:~# pip search flexget

/ffp/bin/python: symbol 'XML_SetHashSalt': can't resolve symbol

/ffp/bin/python: symbol 'XML_SetHashSalt': can't resolve symbol

FlexGet - FlexGet is a program aimed to automate downloading
or processing content (torrents, podcasts, etc.)
from different sources like RSS-feeds, html-pages,
various sites and more.
uguu - generate Flexget config files
root@NSA325:~# pip install --upgrade glances

/ffp/bin/python: symbol 'XML_SetHashSalt': can't resolve symbol

/ffp/bin/python: symbol 'XML_SetHashSalt': can't resolve symbol

Requirement already up-to-date: glances in /usr/local/zy-pkgs/ffproot/ffp/lib/py
thon2.7/site-packages
Requirement already up-to-date: psutil>=0.5.1 in /usr/local/zy-pkgs/ffproot/ffp/
lib/python2.7/site-packages (from glances)
Cleaning up...
do you have any idea what it can be?

barmalej2
Posts: 2395
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by barmalej2 » Sun Sep 08, 2013 2:48 pm

Upgrade your expat to 2.1.0 version:

Code: Select all

slacker -Uu br2:expat
Expat 2.0.1 from Fonz repo don't have function-'XML_SetHashSalt'

P.S Also check

Code: Select all

ldd /ffp/lib/python2.7/lib-dynload/pyexpat.so
after install.
Tried myself and successfully installed flexget with dependancy packages automatically:

Code: Select all

Successfully installed flexget FeedParser SQLAlchemy PyYAML BeautifulSoup beautifulsoup4 html5lib PyRSS2Gen pynzb progressbar jinja2 flask cherrypy requests python-dateutil jsonschema python-tvrage Werkzeug itsdangerous six
Cleaning up...
Last edited by barmalej2 on Sun Nov 03, 2013 5:24 pm, edited 2 times in total.


barmalej2
Posts: 2395
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by barmalej2 » Sat Oct 19, 2013 7:43 pm

First post is edited and updated today again. Changes:
1. Python ffp package release updated. Now it is build with UCS2 instead UCS4. Should be more compatible with other 2.7.* releases.
2. Updated setuptools to 1.1.6 version
3. Fully clarified dependencies for python and pip tool. Updated slacker links to new br2 repo.
4. Added instructions to second post, how to upgrade from my previous release-python-2.7.5-arm-0.txz
5. Added link to the end of first post, where all differences between pip and setuptools (easy_install) are shown.

wimpie007
Posts: 7
Joined: Mon Jul 01, 2013 7:05 am

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by wimpie007 » Thu Nov 07, 2013 6:53 pm

Thanks!
great work!
Perfect!

barmalej2
Posts: 2395
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by barmalej2 » Thu Nov 07, 2013 7:32 pm

You are welcome :)

wimpie007
Posts: 7
Joined: Mon Jul 01, 2013 7:05 am

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by wimpie007 » Mon Nov 11, 2013 7:29 pm

never mind...
found another way without pymssql...

---
trying to install "pip install pymssql"
unfortunately, i get:
_mssql.c:314:22: fatal error: sqlfront.h: No such file or directory
while building...

barmalej2
Posts: 2395
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by barmalej2 » Tue Nov 12, 2013 10:07 am

pymssql requires freetds package installed before http://www.freetds.org/, otherwise you will get error as you already know :)
pymssql is not "pure" python package.

Source:https://code.google.com/p/pymssql/issue ... ?id=97#c12

wimpie007
Posts: 7
Joined: Mon Jul 01, 2013 7:05 am

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by wimpie007 » Thu Nov 14, 2013 2:11 pm

Thanks again!!

barmalej2
Posts: 2395
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by barmalej2 » Mon Apr 07, 2014 3:25 pm

Updated python-pip and python-setuptools packages are available on slacker br2 repo. Setuptools since version 3.2 has additional dependency:python-certify, which is included in current setuptools-3.4.1_python2.7.5-arm-1.txz package.
Update them, as per instructions on first post:

Code: Select all

slacker -Uui br2:python

greenwitch
Posts: 25
Joined: Sun Feb 26, 2017 10:09 pm

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by greenwitch » Thu Jan 18, 2018 10:24 pm

Hello,

do you plan to upgrade version of python supported by your script to 3.4 or newer?

Adam

barmalej2
Posts: 2395
Joined: Sun Apr 29, 2012 5:24 pm

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by barmalej2 » Sat Jan 20, 2018 3:07 pm

Python3.x.x is not direct upgrade of python2.x.x as you might. Both versions are still developed in parallel by python.org. They are inter-incompatible. They can live together on one host, but this requires additional efforts resolving some conflicting files between them and adjusting python package managers for each version as well. Will think about that later after finish of toolchain upgrading.

User avatar
MrDini
Posts: 651
Joined: Mon Dec 21, 2015 7:21 pm
Contact:

Re: HOWTO: Install and manage Python packages on FFP 0.7-arm

Post by MrDini » Sat Jan 20, 2018 5:10 pm

I have a 2.7.10 and a 3.5.1 Python package (repo), and I am using them for ages. They Can coexist and work easily without any plus tricks/modifications.

That is because the python 2.7 Can be called by python and the python 3.5.1 uses the python3 (or python3.5). The pip and some other binaries which is installed by default are also follows that naming pattern. And the site-packages are stored individually too.
Thanks nas-central the lot of help! :)

Post Reply