Discussion:
[OpenWrt-Users] Pip command found error even though pip is installed
Phani Siriki
2018-02-06 16:14:46 UTC
Permalink
Hi All

I am using chaos calmer build and installed python on usb. When i tried to
install python-pip, it gives me below error. However, pip is installed. But
when I tried to run it, it says command not found. Could some one help me
on this?

*Version*
*======*
***@OpenWrt:~# cat /etc/openwrt_release
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='Chaos Calmer'
DISTRIB_REVISION='unknown'
DISTRIB_CODENAME='chaos_calmer'
DISTRIB_TARGET='ar71xx/generic'
DISTRIB_DESCRIPTION='OpenWrt Chaos Calmer 15.05'
DISTRIB_TAINTS='no-all'

*Installing Python-pip*

***@OpenWrt:~# opkg install -d usb python-pip
Installing python-pip (1.5.6-1) to usb...
Downloading
http://archive.openwrt.org/chaos_calmer/15.05/ar71xx/generic/packages/packages//python-pip_1.5.6-1_ar71xx.ipk
.
mv: can't rename 'easy-install.pth': No such file or directory
mv: can't rename 'site.py': No such file or directory
Configuring python-pip.
grep: /usr/lib/opkg/info/python-pip.control: No such file or directory
cat: can't open '/usr/lib/opkg/info/python-pip.list': No such file or
directory

***@OpenWrt:~# pi
pidof ping ping6 pip pip2 pip2.7
pivot_root
***@OpenWrt:~# pip
-ash: pip: not found

***@OpenWrt:~# which pip
/usr/bin/pip
***@OpenWrt:~#
***@OpenWrt:~# ls -l /usr/bin/pip
lrwxrwxrwx 1 root root 20 Feb 6 16:05 /usr/bin/pip ->
/mnt/usb/usr/bin/pip

*PATH:*

export USB=/mnt/usb
export PATH=$PATH:$USB/usr/bin:$USB/usr/sbin # This PATH is dependent on
existing $PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$USB/lib:$USB/usr/lib
export PYTHONPATH=$PYTHONPATH:$USB/lib:$USB/usr/lib

Best Regards
Phani
Lars Kruse
2018-02-06 23:50:54 UTC
Permalink
Hello Phani,


Am Tue, 6 Feb 2018 10:14:46 -0600
Post by Phani Siriki
I am using chaos calmer build and installed python on usb. When i tried to
install python-pip, it gives me below error. However, pip is installed. But
when I tried to run it, it says command not found. Could some one help me
on this?
did you take a look at the list of files belonging to the "python-pip"
package?

opkg files python-pip

I could imagine, that the package contains only the python module - and
maybe not a script in /usr/bin.

Maybe "python -m pip ..." works?
(just wild guessing)

Lars
Phani Siriki
2018-02-07 00:11:11 UTC
Permalink
Hi Lars

Thank you for your reply.

Yes. "python -m pip" worked.

Best Regards
Phani
Post by Lars Kruse
Hello Phani,
Am Tue, 6 Feb 2018 10:14:46 -0600
Post by Phani Siriki
I am using chaos calmer build and installed python on usb. When i tried
to
Post by Phani Siriki
install python-pip, it gives me below error. However, pip is installed.
But
Post by Phani Siriki
when I tried to run it, it says command not found. Could some one help me
on this?
did you take a look at the list of files belonging to the "python-pip"
package?
opkg files python-pip
I could imagine, that the package contains only the python module - and
maybe not a script in /usr/bin.
Maybe "python -m pip ..." works?
(just wild guessing)
Lars
_______________________________________________
openwrt-users mailing list
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users
Phani Siriki
2018-02-14 21:00:34 UTC
Permalink
Hi Lars

I am now facing problem with python on a different router. I have installed
python on USB stick and I could not execute it.

***@Mesh-30:~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 4.8M 4.8M 0 100% /rom
tmpfs 61.3M 1012.0K 60.3M 2% /tmp
/dev/mtdblock3 2.0M 756.0K 1.3M 37% /overlay
overlayfs:/overlay 2.0M 756.0K 1.3M 37% /
tmpfs 512.0K 0 512.0K 0% /dev
*/dev/sda1 29.2G 401.1M 27.3G 1% /mnt/usb*

***@Mesh-30:~# opkg files python
Package python (2.7.9-6) is installed on usb and has the following files:
***@Mesh-30:~#
***@Mesh-30:~# which python
/usr/bin/python
***@Mesh-30:~# ls -l /usr/bin/python
lrwxrwxrwx 1 root root 23 Feb 14 14:39 /usr/bin/python ->
/mnt/usb/usr/bin/python

***@Mesh-30:~# python
python python2 python2.7

***@Mesh-30:~# python
-ash: python: not found

Tab autocompletion works, however it says command not found. Could you
please suggest if you have any idea on this?

Best Regards
Phani
Post by Phani Siriki
Hi Lars
Thank you for your reply.
Yes. "python -m pip" worked.
Best Regards
Phani
Post by Lars Kruse
Hello Phani,
Am Tue, 6 Feb 2018 10:14:46 -0600
Post by Phani Siriki
I am using chaos calmer build and installed python on usb. When i tried
to
Post by Phani Siriki
install python-pip, it gives me below error. However, pip is installed.
But
Post by Phani Siriki
when I tried to run it, it says command not found. Could some one help
me
Post by Phani Siriki
on this?
did you take a look at the list of files belonging to the "python-pip"
package?
opkg files python-pip
I could imagine, that the package contains only the python module - and
maybe not a script in /usr/bin.
Maybe "python -m pip ..." works?
(just wild guessing)
Lars
_______________________________________________
openwrt-users mailing list
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users
Lars Kruse
2018-02-14 22:09:38 UTC
Permalink
Hello Phani,


Am Wed, 14 Feb 2018 15:00:34 -0600
Post by Phani Siriki
-ash: python: not found
I guess, this means that one of the libraries that the python binary is linked
against, is missing.
Maybe run "ldd /usr/bin/python" and check if all referenced libraries exist.

Cheers,
Lars
Phani Siriki
2018-02-14 22:19:40 UTC
Permalink
Hi Lars

You are correct. There are some relocation errors, Could you give me some
pointers on how to resolve this?

***@Mesh-30:~# ldd /usr/bin/python
/lib/ld-uClibc.so.0 (0x55566000)
libpython2.7.so.1.0 => /mnt/usb/usr/lib/libpython2.7.so.1.0
(0x77c9e000)
libpthread.so.0 => /lib/ld-uClibc.so.0 (0x55566000)
libdl.so.0 => /lib/ld-uClibc.so.0 (0x55566000)
libutil.so.0 => /lib/ld-uClibc.so.0 (0x55566000)
libz.so.1 => /usr/lib/libz.so.1 (0x77c7e000)
libm.so.0 => /lib/ld-uClibc.so.0 (0x55566000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x77c5a000)
libc.so.0 => /lib/ld-uClibc.so.0 (0x55566000)
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __fgetc_unlocked:
symbol not found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __isinf: symbol not
found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __ctype_toupper:
symbol not found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __fputc_unlocked:
symbol not found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __ctype_tolower:
symbol not found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __ctype_b: symbol
not found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: fcntl64: symbol not
found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __isinff: symbol not
found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __finite: symbol not
found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: tmpnam_r: symbol not
found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __isnan: symbol not
found
Error relocating /usr/bin/python: __uClibc_main: symbol not found

Best Regards
Phani
Post by Lars Kruse
Hello Phani,
Am Wed, 14 Feb 2018 15:00:34 -0600
Post by Phani Siriki
-ash: python: not found
I guess, this means that one of the libraries that the python binary is linked
against, is missing.
Maybe run "ldd /usr/bin/python" and check if all referenced libraries exist.
Cheers,
Lars
_______________________________________________
openwrt-users mailing list
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users
Phani Siriki
2018-04-18 19:04:08 UTC
Permalink
Hi Lars

I am facing new problem while I try to use pip on a different router.

I have installed python and python-pip on usb. python is working fine,
but pip is not working now.

***@OpenWrt:~# which python
/mnt/usb/usr/bin/python
***@OpenWrt:~# which pip
/mnt/usb/usr/bin/pip
***@OpenWrt:~#
***@OpenWrt:~# pip
-ash: pip: not found
***@OpenWrt:~#
***@OpenWrt:~# python -m pip -V
/mnt/usb/usr/bin/python: File not found; 'pip' is a package and cannot
be directly executed
***@OpenWrt:~#
***@OpenWrt:~#
***@OpenWrt:~# opkg files python-pip
Package python-pip (1.5.6-1) is installed on usb and has the following files:
/mnt/usb/usr/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/html5lib/treebuilders/__init__.py
....
/mnt/usb/usr/bin/pip

It is installed in site-packages. Does it have any effect? Could you
please provide some inputs on this?

Best Regards
Phani
Post by Phani Siriki
Hi Lars
You are correct. There are some relocation errors, Could you give me some
pointers on how to resolve this?
/lib/ld-uClibc.so.0 (0x55566000)
libpython2.7.so.1.0 => /mnt/usb/usr/lib/libpython2.7.so.1.0
(0x77c9e000)
libpthread.so.0 => /lib/ld-uClibc.so.0 (0x55566000)
libdl.so.0 => /lib/ld-uClibc.so.0 (0x55566000)
libutil.so.0 => /lib/ld-uClibc.so.0 (0x55566000)
libz.so.1 => /usr/lib/libz.so.1 (0x77c7e000)
libm.so.0 => /lib/ld-uClibc.so.0 (0x55566000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x77c5a000)
libc.so.0 => /lib/ld-uClibc.so.0 (0x55566000)
symbol not found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __isinf: symbol not
found
symbol not found
symbol not found
symbol not found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __ctype_b: symbol not
found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: fcntl64: symbol not
found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __isinff: symbol not
found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __finite: symbol not
found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: tmpnam_r: symbol not
found
Error relocating /mnt/usb/usr/lib/libpython2.7.so.1.0: __isnan: symbol not
found
Error relocating /usr/bin/python: __uClibc_main: symbol not found
Best Regards
Phani
Post by Lars Kruse
Hello Phani,
Am Wed, 14 Feb 2018 15:00:34 -0600
Post by Phani Siriki
-ash: python: not found
I guess, this means that one of the libraries that the python binary is linked
against, is missing.
Maybe run "ldd /usr/bin/python" and check if all referenced libraries exist.
Cheers,
Lars
_______________________________________________
openwrt-users mailing list
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users
Lars Kruse
2018-04-18 22:16:56 UTC
Permalink
Hi Phani,


Am Wed, 18 Apr 2018 14:04:08 -0500
Post by Phani Siriki
/mnt/usb/usr/bin/pip
-ash: pip: not found
I guess, the lines above show the problem: the pip executable can be found, but
its execution fails with "not found".
This is a slightly ambiguous message telling you, that either the executable
or one its linked libraries is missing. Just run "ldd /mnt/usb/usr/bin/pip" in
order to find name of the missing library. Did you adjust the LD_LIBRARY_PATH
in order to use libraries installed outside of your root filesystem?

Cheers,
Lars
Phani Siriki
2018-04-18 23:14:28 UTC
Permalink
Hi Lars

Yes. I have adjusted the LA_LIBRARY_PATH as below. But still pip cant be found.

***@OpenWrt:~# echo $LD_LIBRARY_PATH
/mnt/usb/lib:/mnt/usb/usr/lib
***@OpenWrt:~#
***@OpenWrt:~#
***@OpenWrt:~# ldd /mnt/usb/usr/bin/pip
-ash: /mnt/usb/usr/bin/pip: not found
***@OpenWrt:~#
***@OpenWrt:~#
***@OpenWrt:~# ls -l /mnt/usb/usr/bin/pip
-rwxr-xr-x 1 root root 284 Sep 9 2015 /mnt/usb/usr/bin/pip

Best Regards
Phani
Post by Lars Kruse
Hi Phani,
Am Wed, 18 Apr 2018 14:04:08 -0500
Post by Phani Siriki
/mnt/usb/usr/bin/pip
-ash: pip: not found
I guess, the lines above show the problem: the pip executable can be found, but
its execution fails with "not found".
This is a slightly ambiguous message telling you, that either the executable
or one its linked libraries is missing. Just run "ldd /mnt/usb/usr/bin/pip" in
order to find name of the missing library. Did you adjust the LD_LIBRARY_PATH
in order to use libraries installed outside of your root filesystem?
Cheers,
Lars
_______________________________________________
openwrt-users mailing list
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users
Lars Kruse
2018-04-19 02:51:05 UTC
Permalink
Hello Phani,


Am Wed, 18 Apr 2018 18:14:28 -0500
Post by Phani Siriki
-ash: /mnt/usb/usr/bin/pip: not found
-rwxr-xr-x 1 root root 284 Sep 9 2015 /mnt/usb/usr/bin/pip
another possible cause for the above error message could be a wrong shebang
(the first line in a script indicating its interpreter).
Usually this would expose a different error message - but maybe these
messages are simplified in busybox.

If the shebang is fine, you will need to find another reason, why this file
could be non-executable.

btw.: if you really need a full Python environment (incl. third-party modules),
then maybe an embedded environment like OpenWrt could turn out to complicate
this task a bit too much. Could micropython be an option instead? Or a
distribution that is not targeted at embedded devices?

Cheers,
Lars
Phani Siriki
2018-04-19 14:35:33 UTC
Permalink
Hi Lars

Thanks for your reply.

pip has following code.

***@OpenWrt:~# cat /mnt/usb/usr/bin/pip
#!/usr/bin/python2.7
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.5.6','console_scripts','pip'
__requires__ = 'pip==1.5.6'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
sys.exit(
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
)
***@OpenWrt:~#

***@OpenWrt:~# ls /usr/bin/python2.7
ls: /usr/bin/python2.7: No such file or directory
***@OpenWrt:~#
***@OpenWrt:~#
***@OpenWrt:~# which python2.7
/mnt/usb/usr/bin/python2.7

I will try to use micro python and see if it works for me.

Best Regards
Phani
Post by Lars Kruse
Hello Phani,
Am Wed, 18 Apr 2018 18:14:28 -0500
Post by Phani Siriki
-ash: /mnt/usb/usr/bin/pip: not found
-rwxr-xr-x 1 root root 284 Sep 9 2015 /mnt/usb/usr/bin/pip
another possible cause for the above error message could be a wrong shebang
(the first line in a script indicating its interpreter).
Usually this would expose a different error message - but maybe these
messages are simplified in busybox.
If the shebang is fine, you will need to find another reason, why this file
could be non-executable.
btw.: if you really need a full Python environment (incl. third-party modules),
then maybe an embedded environment like OpenWrt could turn out to complicate
this task a bit too much. Could micropython be an option instead? Or a
distribution that is not targeted at embedded devices?
Cheers,
Lars
_______________________________________________
openwrt-users mailing list
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users
Loading...