{"id":872,"date":"2014-11-26T16:06:10","date_gmt":"2014-11-26T14:06:10","guid":{"rendered":"http:\/\/adrhc.go.ro\/wordpress\/?p=872"},"modified":"2018-11-10T16:57:17","modified_gmt":"2018-11-10T14:57:17","slug":"python-2-7-9-and-pip","status":"publish","type":"post","link":"https:\/\/adrhc.go.ro\/blog\/python-2-7-9-and-pip\/","title":{"rendered":"Python 2.7.9 and pip commands"},"content":{"rendered":"<pre class=\"brush:bash shell;toolbar: false\">\r\n#See https:\/\/adrhc.go.ro\/wordpress\/common-commands-when-building\/ for building environment, x.sh script and other things not defined here.\r\n#Before starting do declare the environment variables specified to the link above.\r\n\r\n#Compiling python-2.7.9\r\nNEW_BUILD_NAME=python\r\nNEW_BUILD_VER=2.7.9\r\nNEW_BUILD_NAME_AND_VER=$NEW_BUILD_NAME-$NEW_BUILD_VER\r\nls -l \/tmp\/$NEW_BUILD_NAME-*\r\nls -l ~\/ffp_0.7_armv5\/packages\/$NEW_BUILD_NAME-*\r\nNEW_BUILD_NR=0\r\n\r\n#ERROR\r\n\tFailed to build these modules:\r\n\t_curses_panel      readline\r\n#SOLUTION (before configure)\r\n\tuse -lreadline -lncurses for BUILD_FLAGS and LDFLAGS\r\n#.\/configure --prefix=\/ffp --enable-shared --enable-ipv6 --enable-big-digits --enable-unicode --with-signal-module --with-threads=\/ffp --with-pth --with-doc-strings --without-pymalloc --with-fpectl --with-ensurepip=upgrade\r\n#configure without pip; better install manually pip-6.0.6 in order to avoid CERTIFICATE_VERIFY_FAILED error when running pip\r\n.\/configure --prefix=\/ffp --enable-shared --enable-ipv6 --enable-big-digits --enable-unicode --with-signal-module --with-threads=\/ffp --with-pth --with-doc-strings --without-pymalloc --with-fpectl\r\n#ERROR\r\n\t.\/Parser\/asdl_c.py -h Include .\/Parser\/Python.asdl\r\n\t\/ram_bin\/usr\/bin\/python: \/ffp\/lib\/libpthread.so.0: no version information available (required by \/usr\/lib\/libpython2.6.so.1.0)\r\n\tmake: *** [Include\/Python-ast.h] Segmentation fault (core dumped)\r\n#SOLUTION (before make)\r\n\ttouch Include\/Python-ast.h Python\/Python-ast.c\r\n#ERROR\r\n\tFailed to build these modules:\r\n\t_curses_panel\r\n#SOLUTION (before make)\r\n\tslacker -u br2:ncurses-5.9_20140927-arm-1.txz\r\nrenice -14 `pidof cc1plus` -p `pidof make` -p `pidof as` -p `pidof configure`\r\n#grep -I -r \"\\\/bin\" . | grep -v \"\\\/ffp\\\/bin\" | grep -v \"\\\/ffp\\\/sbin\"\r\nsed -i s\/\"\\\/bin\\\/install\"\/\"\\\/ffp\\\/bin\\\/install\"\/g Makefile\r\nsed -i s\/\"\\\/bin\\\/install\"\/\"\\\/ffp\\\/bin\\\/install\"\/g Makefile.pre\r\ntouch Include\/Python-ast.h Python\/Python-ast.c\r\nnohup \/ffp\/bin\/make -C ~\/compile\/Python-2.7.9 &\r\ntail -f nohup.out\r\nrm -r $HOME\/temp\/$NEW_BUILD_NAME_AND_VER\r\nmake install DESTDIR=$HOME\/temp\/$NEW_BUILD_NAME_AND_VER\r\ncd $HOME\/temp\/$NEW_BUILD_NAME_AND_VER\r\nmakepkg $NEW_BUILD_NAME $NEW_BUILD_VER $NEW_BUILD_NR\r\ncp -v \/tmp\/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz ~\/ffp_0.7_armv5\/packages\/\r\nfunpkg -q $NEW_BUILD_NAME\r\nfunpkg -i ~\/ffp_0.7_armv5\/packages\/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz\r\n#In order to avoid CERTIFICATE_VERIFY_FAILED when using easy_install (from setuptools)\r\n#download the Mozilla's CA Bundle certificate:\r\nwget -nv http:\/\/curl.haxx.se\/ca\/cacert.pem -O \/ffp\/etc\/ssl\/cert.pem\r\n\r\n#You could use easy_install (from setuptools module) in order to install modules as alternative to pip.\r\n#When using pip if required to use --egg option than better compile the module manually.\r\n#see http:\/\/forum.nas-central.org\/viewtopic.php?f=249&t=16627&p=92309#p92309\r\n\r\n#List python modules:\r\npython\r\n#then, from python's shell\/prompt:\r\nhelp('modules')\r\nhelp('setuptools') -> info about setuptools module\r\nhelp('jinja2') -> info about jinja2 module (observe lower case usage)\r\n\r\n#List module's files\r\npip show -f Jinja2\r\n\r\n#Install pip 6.0.6 (a tool for installing and managing Python packages)\r\n#pip 6.0.6 has no CERTIFICATE_VERIFY_FAILED error\r\n#requires scripttest (>=1.3) and virtualenv (>=1.10)\r\n#wget https:\/\/pypi.python.org\/packages\/source\/s\/scripttest\/scripttest-1.3.tar.gz\r\n#wget https:\/\/pypi.python.org\/packages\/source\/v\/virtualenv\/virtualenv-12.0.5.tar.gz#md5=637abbbd04d270ee8c601ab29c4f7561\r\ncd ~\/compile\r\nwget https:\/\/pypi.python.org\/packages\/source\/p\/pip\/pip-6.0.6.tar.gz#md5=bbb17814bdf82187f46aaf9cec6b6caa\r\ntar xvzf pip-6.0.6.tar.gz\r\ncd pip-6.0.6\r\n~\/x.sh ffpg\r\nexport BUILD_FLAGS=\"-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -fno-stack-protector -pthread -O2 -Wall -I\/ffp\/include\"\r\nexport LDFLAGS=\"-L\/ffp\/lib\"\r\nexport CPPFLAGS=\"$BUILD_FLAGS\"\r\nexport CXXFLAGS=\"$BUILD_FLAGS\"\r\nexport CFLAGS=\"$BUILD_FLAGS\"\r\nexport LC_ALL=POSIX\r\npython setup.py --help-commands\r\npython setup.py --help\r\npython setup.py --help build\r\npython setup.py build\r\npython setup.py install --record module-files.txt\r\n\r\n#Uninstall a python module\r\ncd ~\/compile\/pip-1.2.1 -> has CERTIFICATE_VERIFY_FAILED error at install\r\ncd ~\/compile\/pip-1.5.6 -> has CERTIFICATE_VERIFY_FAILED error always\r\ncd ~\/compile\/pip-6.0.6 -> has no CERTIFICATE_VERIFY_FAILED error\r\ncat module-files.txt | xargs rm -rf\r\nfind \/ffp\/lib\/python2.7\/ -name \"*pip*\"\r\nrm -r \/ffp\/lib\/python2.7\/site-packages\/pip-6.0.6-py2.7.egg\r\n\r\n#Install Jinja2-2.7.3\r\ncd ~\/compile\r\nwget https:\/\/pypi.python.org\/packages\/source\/J\/Jinja2\/Jinja2-2.7.3.tar.gz\r\ntar xvzf Jinja2-2.7.3.tar.gz\r\ncd Jinja2-2.7.3\r\nfind . -type f \\( -exec sed -i s\/\"\\\/usr\\\/bin\\\/perl\"\/\"\\\/ffp\\\/bin\\\/perl\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/python\"\/\"\\\/ffp\\\/bin\\\/python\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/bash\"\/\"\\\/ffp\\\/bin\\\/bash\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/sh\"\/\"\\\/ffp\\\/bin\\\/sh\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/env\"\/\"\\\/ffp\\\/bin\\\/env\"\/ {} \\; , -exec sed -i s\/\"\\\/bin\\\/bash\"\/\"\\\/ffp\\\/bin\\\/bash\"\/ {} \\; , -exec sed -i s\/\"\\\/bin\\\/sh\"\/\"\\\/ffp\\\/bin\\\/sh\"\/ {} \\; , -exec sed -i s\/\"\\\/bin\\\/env\"\/\"\\\/ffp\\\/bin\\\/env\"\/ {} \\; , -exec sed -i s\/\"\\\/ffp\\\/ffp\\\/\"\/\"\\\/ffp\\\/\"\/ {} \\; \\)\r\nexport BUILD_FLAGS=\"-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -pthread -O2 -lintl -Wall -I\/ffp\/include\"\r\nexport LDFLAGS=\"-L\/ffp\/lib -lintl\"\r\nexport CPPFLAGS=\"$BUILD_FLAGS\"\r\nexport CXXFLAGS=\"$BUILD_FLAGS\"\r\nexport CFLAGS=\"$BUILD_FLAGS\"\r\nexport LC_ALL=POSIX\r\npython setup.py --help-commands\r\npython setup.py --help\r\npython setup.py --help build\r\npython setup.py build\r\npython setup.py install --record module-files.txt\r\n\r\n#Install SCons (better compile manually SCons because its files have non-FFP paths)\r\n#SCons install doesn't work without --egg option.\r\n#see also http:\/\/forum.nas-central.org\/viewtopic.php?f=249&t=16627&p=92309#p92309\r\npip install -U setuptools\r\npip install SCons -vvv --egg --log \/ffp\/var\/log\/python\/SCons.txt\r\n#Modify the paths used by \/ffp\/bin\/scons* files.\r\n\r\n#Using pip:\r\npython -m pip help\r\npython -m pip list\r\n#varianta cu freeze e o listare care arata si eventualele probleme ale pachetelor\r\npython -m pip freeze\r\npython -m pip help install\r\npython -m pip search simplejson\r\npython -m pip install simplejson -> nu a functionat\r\npython -m pip install cryptography 0.6.1\r\npython -m pip install pyOpenSSL 0.14 -vvv --log \/ffp\/var\/log\/python\/pyOpenSSL-0.14.txt\r\npython -m pip list --outdated\r\npython -m pip install -U CherryPy -> updating CherryPy\r\npython -m pip uninstall pycurl\r\npython -m pip install rst2html5 -> required by aria2\r\npip install PIL --allow-unverified PIL\r\n\r\n#ERROR (la instalarea multor pachete)\r\n\tAttributeError: Distribution instance has no attribute 'include_package_data'\r\n#SOLUTION\r\n\tNu instala setuptools folosind:\r\n\twget https:\/\/bitbucket.org\/pypa\/setuptools\/get\/default.tar.gz#egg=setuptools-dev\r\n\r\n#Install setuptools 7.0\r\ncd ~\/compile\r\n#wget imediat urmator va crapa dar va afisa wget pt descarcarea setuptools 7.0 ce functioneaza corect:\r\n#wget https:\/\/bootstrap.pypa.io\/ez_setup.py -O - | python\r\n#setuptools 7.0 ce functioneaza corect:\r\nwget https:\/\/pypi.python.org\/packages\/source\/s\/setuptools\/setuptools-7.0.zip\r\nmv default.tar.gz setuptools-7.0.tar.gz\r\ncd pypa-setuptools-48a23a037ea2\/\r\nfind . -type f \\( -exec sed -i s\/\"\\\/usr\\\/bin\\\/perl\"\/\"\\\/ffp\\\/bin\\\/perl\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/python\"\/\"\\\/ffp\\\/bin\\\/python\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/bash\"\/\"\\\/ffp\\\/bin\\\/bash\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/sh\"\/\"\\\/ffp\\\/bin\\\/sh\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/env\"\/\"\\\/ffp\\\/bin\\\/env\"\/ {} \\; , -exec sed -i s\/\"\\\/bin\\\/bash\"\/\"\\\/ffp\\\/bin\\\/bash\"\/ {} \\; , -exec sed -i s\/\"\\\/bin\\\/sh\"\/\"\\\/ffp\\\/bin\\\/sh\"\/ {} \\; , -exec sed -i s\/\"\\\/bin\\\/env\"\/\"\\\/ffp\\\/bin\\\/env\"\/ {} \\; , -exec sed -i s\/\"\\\/ffp\\\/ffp\\\/\"\/\"\\\/ffp\\\/\"\/ {} \\; \\)\r\nexport BUILD_FLAGS=\"-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -pthread -O2 -lintl -Wall -I\/ffp\/include\"\r\nexport LDFLAGS=\"-L\/ffp\/lib -lintl\"\r\nexport CPPFLAGS=\"$BUILD_FLAGS\"\r\nexport CXXFLAGS=\"$BUILD_FLAGS\"\r\nexport CFLAGS=\"$BUILD_FLAGS\"\r\nexport LC_ALL=POSIX\r\npython setup.py --help-commands\r\npython setup.py --help\r\npython setup.py --help build\r\npython setup.py build\r\npython setup.py install --record module-files.txt\r\n\r\n#Install pycurl-7.19.5 -> required by pyLoad and easier to install using pip or easy_install (from setuptools)\r\ncd ~\/compile\r\nwget http:\/\/pycurl.sourceforge.net\/download\/pycurl-7.19.5.tar.gz\r\ntar xvzf pycurl-7.19.5.tar.gz\r\ncd pycurl-7.19.5\r\nfind . -type f \\( -exec sed -i s\/\"\\\/usr\\\/bin\\\/perl\"\/\"\\\/ffp\\\/bin\\\/perl\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/python\"\/\"\\\/ffp\\\/bin\\\/python\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/bash\"\/\"\\\/ffp\\\/bin\\\/bash\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/sh\"\/\"\\\/ffp\\\/bin\\\/sh\"\/ {} \\; , -exec sed -i s\/\"\\\/usr\\\/bin\\\/env\"\/\"\\\/ffp\\\/bin\\\/env\"\/ {} \\; , -exec sed -i s\/\"\\\/bin\\\/bash\"\/\"\\\/ffp\\\/bin\\\/bash\"\/ {} \\; , -exec sed -i s\/\"\\\/bin\\\/sh\"\/\"\\\/ffp\\\/bin\\\/sh\"\/ {} \\; , -exec sed -i s\/\"\\\/bin\\\/env\"\/\"\\\/ffp\\\/bin\\\/env\"\/ {} \\; , -exec sed -i s\/\"\\\/ffp\\\/ffp\\\/\"\/\"\\\/ffp\\\/\"\/ {} \\; \\)\r\nexport BUILD_FLAGS=\"-march=armv5te -mfloat-abi=soft -mabi=aapcs-linux -pthread -O2 -lintl -Wall -I\/ffp\/include\"\r\nexport LDFLAGS=\"-L\/ffp\/lib -lintl\"\r\nexport CPPFLAGS=\"$BUILD_FLAGS\"\r\nexport CXXFLAGS=\"$BUILD_FLAGS\"\r\nexport CFLAGS=\"$BUILD_FLAGS\"\r\nexport LC_ALL=POSIX\r\npython setup.py --help-commands\r\npython setup.py --help\r\n#ERROR0\r\n\tpython: symbol 'CRYPTO_set_locking_callback': can't resolve symbol\r\n\tpython: symbol 'CRYPTO_num_locks': can't resolve symbol\r\n\tpython: symbol 'CRYPTO_set_id_callback': can't resolve symbol\r\n\tTraceback (most recent call last):\r\n\tFile \"&lt;stdin>\", line 1, in &lt;module>\r\n\tImportError: unknown dlopen() error\r\n#SOLUTION0\r\n\tNu compila cu openssl:\r\n\tpython setup.py build --curl-config=\/ffp\/bin\/curl-config --with-ssl --openssl-dir=\/ffp\r\n\tModifica setup.py:\r\n\t# self.libraries = []\r\n\tself.libraries = [\"crypto\"]\r\npython setup.py build --curl-config=\/ffp\/bin\/curl-config --with-ssl\r\npython setup.py install --record module-files.txt\r\n#test installation:\r\npython\r\nimport pycurl\r\nCTRL+D\r\n\r\n#certifi (14.5.14)\t-> required in order to avoid CERTIFICATE_VERIFY_FAILED when using easy_install (from setuptools)\r\n#pip (6.0.6)\t\t-> required version in order to avoid CERTIFICATE_VERIFY_FAILED error when running pip\r\n\r\n#Requirements files are used to hold the result from pip freeze for the purpose of achieving repeatable installations. \r\n#In this case, your requirement file contains a pinned version of everything that was installed when pip freeze was run.\r\npip freeze > \/ffp\/opt\/apache-htdocs\/public\/python2.7-packages.txt\r\npip install -r \/ffp\/opt\/apache-htdocs\/public\/python2.7-packages.txt\r\n\r\n#ecdsa module below must be corrected after installation:\r\ncd \/ffp\/lib\/python2.7\/site-packages\/ecdsa\r\nffpg\r\n\r\n#root@nsa310:~# pip list\r\ncertifi (14.5.14)\r\nCherryPy (3.2.6)\r\necdsa (0.12)\r\niotop (0.6)\r\nJinja2 (2.7.3)\r\nlibxml2-python (2.6.21)\r\nlxml (3.4.2)\r\nMarkupSafe (0.23)\r\nmod-python (3.5.0-)\r\nnose (1.3.4)\r\nparamiko (1.15.2)\r\npip (6.0.6)\r\npycrypto (2.6.1)\r\npycurl (7.19.5.1)\r\npykg-config (1.3.0)\r\nPyrex (0.9.9)\r\npysqlite (2.6.3)\r\npytesseract (0.1.5)\r\npytz (2014.10)\r\nsetuptools (12.0.4)\r\ntzselect (0.1)\r\nWebHelpers (1.3)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#See https:\/\/adrhc.go.ro\/wordpress\/common-commands-when-building\/ for building environment, x.sh script and other things not defined here. #Before starting do declare the environment variables specified to the link above. #Compiling python-2.7.9 NEW_BUILD_NAME=python NEW_BUILD_VER=2.7.9 NEW_BUILD_NAME_AND_VER=$NEW_BUILD_NAME-$NEW_BUILD_VER ls -l \/tmp\/$NEW_BUILD_NAME-* ls -l ~\/ffp_0.7_armv5\/packages\/$NEW_BUILD_NAME-* NEW_BUILD_NR=0 #ERROR Failed to [&hellip;]<\/p>\n<div class=\"link-more\"><a href=\"https:\/\/adrhc.go.ro\/blog\/python-2-7-9-and-pip\/#more-872\" class=\"more-link\">Continue reading &#10142; <span class=\"screen-reader-text\">Python 2.7.9 and pip commands<\/span><\/a><\/div>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,11,163],"tags":[123],"class_list":["post-872","post","type-post","status-publish","format-standard","hentry","category-compiling-from-source","category-linux","category-nsa310","tag-python"],"_links":{"self":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts\/872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/comments?post=872"}],"version-history":[{"count":0,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/posts\/872\/revisions"}],"wp:attachment":[{"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/media?parent=872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/categories?post=872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adrhc.go.ro\/blog\/wp-json\/wp\/v2\/tags?post=872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}