ish-app / ish

Linux shell for iOS
https://ish.app
Other
16.86k stars 886 forks source link

Pip fails #1107

Open ifuchs opened 3 years ago

ifuchs commented 3 years ago

I am trying to install several python packages using pip. All attempts to use pip (even pip list) result in:

pip list Traceback (most recent call last): File "/usr/bin/pip", line 6, in from pip._internal.cli.main import main File "/usr/lib/python3.8/site-packages/pip/_internal/init.py", line 40, in from pip._internal.cli.autocompletion import autocomplete File "/usr/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 8, in from pip._internal.cli.main_parser import create_main_parser File "/usr/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 11, in from pip._internal.commands import ( File "/usr/lib/python3.8/site-packages/pip/_internal/commands/init.py", line 6, in from pip._internal.commands.completion import CompletionCommand File "/usr/lib/python3.8/site-packages/pip/_internal/commands/completion.py", line 6, in from pip._internal.cli.base_command import Command File "/usr/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 26, in from pip._internal.index import PackageFinder ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/usr/lib/python3.8/site-packages/pip/_internal/index/init.py)

62f commented 3 years ago

What's the output of apk list py3-pip?

ifuchs commented 3 years ago

Null. (Even after apk add py3-pip).

On Tue, Dec 8, 2020 at 12:36 PM 62f notifications@github.com wrote:

What's the output of apk list py3-pip?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ish-app/ish/issues/1107#issuecomment-740787277, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLDPSB4752DIXIEWSHI5B3STZPZPANCNFSM4URGAABQ .

62f commented 3 years ago

I suppose by your verbiage of "even" that you consider apk not to be of primary importance, or perhaps consider it an unrelated bug, but I must disagree to the latter. I would not have said 'even' unless I was applying some extraneous force, such as including sudo as part of the apk command. Regardless, getting pip itself to function could be academic because I am preparing to file my own issue- my pip install runs but crashes iSH. If you still demand pursuit of pip as your primary objective, try sudo python3 -m pip install foo.

ifuchs commented 3 years ago

I have no preference to using a APK or PIP. I just want to be able to install pure python modules for use with python. PIP is not working for me and APK doesn't seem to have the modules I need.I tried sudo python3 -m pip install foo. Sudo does not exist and without it I get the same error as reported above.

tbodt commented 3 years ago

What is the output of apk info py3-pip?

ifuchs commented 3 years ago

apk info py3-pip python3-3.8.2-r1 description: A high-level scripting language

python3-3.8.2-r1 webpage: https://www.python.org/

python3-3.8.2-r1 installed size: 58535936

On Tue, Dec 8, 2020 at 2:31 PM Theodore Dubois notifications@github.com wrote:

What is the output of apk info py3-pip?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ish-app/ish/issues/1107#issuecomment-740904863, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLDPSBOJLXKSD5GARWD6A3STZ5J7ANCNFSM4URGAABQ .

62f commented 3 years ago

Well that's just odd. Ask for py3-pip's info and it gets Python's? Mine says:

`py3-pip-20.1.1-r0 description:pip Tool for installing and managing Python packages

py3-pip-20.1.1-r0 webpage: http://www.pip-installer.org

py3-pip-20.1.1-r0 installed size: 2285568`

62f commented 3 years ago

`apk info python3 python3-3.8.5-r0 description: A high-level scripting language

python3-3.8.5-r0 webpage: https://www.python.org/

python3-3.8.5-r0 installed size: 46739456`

In general, later versions of most programs take up more space than their predecessor. Ergo your 'installed size' seems paradoxical. https://alpine.pkgs.org/3.11/alpine-main-x86/python3-3.8.2-r1.apk.html Reports the correct installed size of that to be 55.82MB; which size shouldn't be off by more than a factor of 1024/1000, which at 59.94, your python3's filesize seems off by a staggering amount.

ifuchs commented 3 years ago

What can I say? I’ve merely run the commands and cut/pasted the result. Perhaps I should delete and reinstall ish.

On Tue, Dec 8, 2020 at 9:51 PM 62f notifications@github.com wrote:

`apk info python3 python3-3.8.5-r0 description: A high-level scripting language

python3-3.8.5-r0 webpage: https://www.python.org/

python3-3.8.5-r0 installed size: 46739456`

In general, later versions of most programs take up more space than their predecessor. Ergo your 'installed size' seems paradoxical.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ish-app/ish/issues/1107#issuecomment-741491855, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLDPSE2LKLXFTTYLW57IFTST3Q4NANCNFSM4URGAABQ .

tbodt commented 3 years ago

@62f I can only assume the apk for python3 includes pip.

ifuchs commented 3 years ago

@tbodt what do you recommend I do to get pip working so that I can install python modules?

tbodt commented 3 years ago

Dunno, apk add py3-pip has always worked for me. Could you export your filesystem and send it to me so I can debug?

ifuchs commented 3 years ago

That would be tricky as there are some files with confidential information. Is there a way to leave out a directory?

On Tue, Dec 8, 2020 at 10:37 PM Theodore Dubois notifications@github.com wrote:

Dunno, apk add py3-pip has always worked for me. Could you export your filesystem and send it to me so I can debug?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ish-app/ish/issues/1107#issuecomment-741505332, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLDPSH2G4YZP2QU7TQ5MODST3WHJANCNFSM4URGAABQ .

tbodt commented 3 years ago

Not easily. I think the best you can do is export the filesystem, reimport it (making a copy), delete anything confidential, and export it again. Definitely don't send me anything confidential.

ifuchs commented 3 years ago

How to send it to you (it will presumably be a large file).

On Dec 8, 2020, at 10:48 PM, Theodore Dubois notifications@github.com wrote:

Not easily. I think the best you can do is export the filesystem, reimport it (making a copy), delete anything confidential, and export it again. Definitely don't send me anything confidential.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ish-app/ish/issues/1107#issuecomment-741508095, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLDPSASN3QFKQ76RHT3OC3ST3XQFANCNFSM4URGAABQ.

62f commented 3 years ago

I must disagree with that solution. It sounds much too cumbersome and far too involved. There is another way... if you can see it.

ifuchs commented 3 years ago

And what might that be? On Wed, Dec 9, 2020 at 3:51 AM 62f notifications@github.com wrote:

I must disagree with that solution. It sounds much too cumbersome and far too involved. There is another way... if you can see it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ish-app/ish/issues/1107#issuecomment-741628430, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLDPSABEQK22LFF2SWFXMLST4273ANCNFSM4URGAABQ .

gitdev-bash commented 3 years ago

Try: apk verify py3-pip If something is off try: apk del py3-pip Then apk add py3-pip If that does not help apk del python3 Then apk add python3

ifuchs commented 3 years ago

Thanks but none of that helped. Each of those commands simply returns with OK:653Mib in 131 packages. I think my only remaining option is to delete and reinstall the app. Hopefully I can export the filesystem and after reinstalling get my personal files back.

62f commented 3 years ago

Here's a hint for that path: export the fs and recheck the tar.gz TWICE by reimporting it BEFORE launching your iSH-reinstall nuke. I've had bad fs-exports before. Along with a wipe and reload, you may consider switching to the new AppStore version which now includes apk, and then clone your file system into that.

ifuchs commented 3 years ago

I decided that I would uninstall the ish app and reinstall the appstore version. I was able to 'apk add py3-pip' to get python3 and pip. Then I tried to 'pip3 install alpha_vantage' and got errors as follows:

Building wheel for yarl (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/lib/python3.8/site-packages/pep517/_in_process.py build_wheel /tmp/tmpk_12e5fe
       cwd: /tmp/pip-install-7z1y34xr/yarl
  Complete output (38 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-i686-3.8
  creating build/lib.linux-i686-3.8/yarl
  copying yarl/_url.py -> build/lib.linux-i686-3.8/yarl
  copying yarl/_quoting_py.py -> build/lib.linux-i686-3.8/yarl
  copying yarl/__init__.py -> build/lib.linux-i686-3.8/yarl
  copying yarl/_quoting.py -> build/lib.linux-i686-3.8/yarl
  running egg_info
  writing yarl.egg-info/PKG-INFO
  writing dependency_links to yarl.egg-info/dependency_links.txt
  writing requirements to yarl.egg-info/requires.txt
  writing top-level names to yarl.egg-info/top_level.txt
  reading manifest file 'yarl.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files matching '*.cache' found anywhere in distribution
  warning: no previously-included files found matching 'yarl/*.html'
  warning: no previously-included files found matching 'yarl/*.so'
  warning: no previously-included files found matching 'yarl/*.pyd'
  no previously-included directories found matching 'docs/_build'
  writing manifest file 'yarl.egg-info/SOURCES.txt'
  copying yarl/__init__.pyi -> build/lib.linux-i686-3.8/yarl
  copying yarl/_quoting_c.c -> build/lib.linux-i686-3.8/yarl
  copying yarl/_quoting_c.pyi -> build/lib.linux-i686-3.8/yarl
  copying yarl/_quoting_c.pyx -> build/lib.linux-i686-3.8/yarl
  copying yarl/py.typed -> build/lib.linux-i686-3.8/yarl
  running build_ext
  building 'yarl._quoting_c' extension
  creating build/temp.linux-i686-3.8
  creating build/temp.linux-i686-3.8/yarl
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.8 -c yarl/_quoting_c.c -o build/temp.linux-i686-3.8/yarl/_quoting_c.o
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ----------------------------------------
  ERROR: Failed building wheel for multidict
  Building wheel for yarl (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/lib/python3.8/site-packages/pep517/_in_process.py build_wheel /tmp/tmpnijky6ss
       cwd: /tmp/pip-install-d9vc1bw2/yarl
  Complete output (38 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-i686-3.8
  creating build/lib.linux-i686-3.8/yarl
  copying yarl/_url.py -> build/lib.linux-i686-3.8/yarl
  copying yarl/_quoting_py.py -> build/lib.linux-i686-3.8/yarl
  copying yarl/__init__.py -> build/lib.linux-i686-3.8/yarl
  copying yarl/_quoting.py -> build/lib.linux-i686-3.8/yarl
  running egg_info
  writing yarl.egg-info/PKG-INFO
  writing dependency_links to yarl.egg-info/dependency_links.txt
  writing requirements to yarl.egg-info/requires.txt
  writing top-level names to yarl.egg-info/top_level.txt
  reading manifest file 'yarl.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files matching '*.cache' found anywhere in distribution
  warning: no previously-included files found matching 'yarl/*.html'
  warning: no previously-included files found matching 'yarl/*.so'
  warning: no previously-included files found matching 'yarl/*.pyd'
  no previously-included directories found matching 'docs/_build'
  writing manifest file 'yarl.egg-info/SOURCES.txt'
  copying yarl/__init__.pyi -> build/lib.linux-i686-3.8/yarl
  copying yarl/_quoting_c.c -> build/lib.linux-i686-3.8/yarl
  copying yarl/_quoting_c.pyi -> build/lib.linux-i686-3.8/yarl
  copying yarl/_quoting_c.pyx -> build/lib.linux-i686-3.8/yarl
  copying yarl/py.typed -> build/lib.linux-i686-3.8/yarl
  running build_ext
  building 'yarl._quoting_c' extension
  creating build/temp.linux-i686-3.8
  creating build/temp.linux-i686-3.8/yarl
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.8 -c yarl/_quoting_c.c -o build/temp.linux-i686-3.8/yarl/_quoting_c.o
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for yarl
Failed to build multidict yarl
ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly
62f commented 3 years ago

You're lucky, in my one device in which pip actually got (others didn't) as far as trying for PEP 517, all it did is crash after depletion (see issue) of resources CPU/RAM (memory?), and since it was taking a couple of days to process per attempt, I gave up trying.

dontbanmeplz commented 3 years ago

The command is now pip3

62f commented 3 years ago

Not quite. @dontbanmeplz the command is now pip3.8

62f commented 3 years ago

Not quite. sudo python3 -m pip3 foo doesn’t function. pip3 worked when py3 and py2 coexisted. Now they’re both present, but since py2 has been deprecated, pip3 no longer works as it once did. They’re mostly the same script, & yet function a tad different. A tiny, but significant smidgen.

62f commented 3 years ago

@gitdev-bash I tried your suggestion myself, even though pip ‘runs’ in my system, but I don’t even get as far as the issue’s OP did.


ERROR: py3-pip: No such file or directory
ifuchs commented 3 years ago

Can anyone suggest a way past the above error while installing alpha_vantage:

Failed to build multidict yarl ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly

62f commented 3 years ago

gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.8 -c yarl/_quoting_c.c -o build/temp.linux-i686-3.8/yarl/_quoting_c.o yarl/_quoting_c.c:4:10: fatal error: Python.h: No such file or directory 4 | #include "Python.h" | ^~~~~~ compilation terminated. error: command 'gcc' failed with exit status 1 Building wheel for yarl (PEP 517) ... error ERROR: Failed building wheel for yarl Failed to build multidict yarl ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly Exception information: Traceback (most recent call last): File "/home/ish/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 224, in _main status = self.run(options, args) File "/home/ish/.local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper return func(self, options, args) File "/home/ish/.local/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 361, in run raise InstallationError( pip._internal.exceptions.InstallationError: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly (06:06 ish /~)-> dmesg (13:45 ish /~)-> I don't see any problem c. iSH itself & suggest closing the issue.

ifuchs commented 3 years ago

I don’t understand. Are you saying this can’t be done and it has nothing to do with ish? It works on Pythonista, Pyto, and Carnet so if it’s not an ish issue, what is it?

On Tue, Dec 22, 2020 at 9:22 AM 62f notifications@github.com wrote:

gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.8 -c yarl/_quoting_c.c -o build/temp.linux-i686-3.8/yarl/_quoting_c.o yarl/_quoting_c.c:4:10: fatal error: Python.h: No such file or directory 4 | #include "Python.h" | ^~~~~~ compilation terminated. error: command 'gcc' failed with exit status 1 Building wheel for yarl (PEP 517) ... error ERROR: Failed building wheel for yarl Failed to build multidict yarl ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly Exception information: Traceback (most recent call last): File "/home/ish/.local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 224, in _main status = self.run(options, args) File "/home/ish/.local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper return func(self, options, args) File "/home/ish/.local/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 361, in run raise InstallationError( pip._internal.exceptions.InstallationError: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly (06:06 ish /)-> dmesg (13:45 ish /)-> I don't see any problem c. iSH itself & suggest closing the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ish-app/ish/issues/1107#issuecomment-749563287, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLDPSFAJWU77M4OFZKXR5DSWCTRJANCNFSM4URGAABQ .

62f commented 3 years ago

PyPI contains binary wheels for Linux, Windows and MacOS. If you want to install yarl on another operating system (like Alpine Linux, which is not manylinux-compliant because of the missing glibc and therefore, cannot be used with our wheels) the the tarball will be used to compile the library from the source code. ItREQUIRES a C COMPILERand and Python headers installed. from https://libraries.io/conda/yarl sudo apk add g++ py3-ruamel.std.pathlib py3-urllib3 py3-rtslib py3-requests-oauthlib py3-jsonrpclib py3-contextlib2 py3-html5lib py3-hglib py3-ruamel.yaml.clib py3-liblarch py3-importlib-metadata py3-xlib py3-libmount py3-libblockdev py3-matplotlib py3-apache-libcloud py3-polib py3-pyftpdlib py3-libgpiod py3-pathlib2 py3-libvirt py3-openzwave-lib py3-google-auth-httplib2 py3-ufolib2 py3-libplist py3-sgmllib3k py3-httplib2 py3-flask-oauthlib py3-libpwquality py3-oauthlib py3-distlib py3-pyutilib py3-libproxy py3-libxml2 py3-libteam Right lib ought to be in there somewheres, but if not: apk search py3| grep lib

62f commented 3 years ago

Since multidict is a dependency of yarl, there's no need to include it in the pip3.8 install foo. Pypi automates that, and updates foo if necessary even if foo was installed by apk.

chawittt commented 3 years ago

Bot

chawittt commented 3 years ago

I am trying to install several python packages using pip. All attempts to use pip (even pip list) result in:

pip list Traceback (most recent call last): File "/usr/bin/pip", line 6, in from pip._internal.cli.main import main File "/usr/lib/python3.8/site-packages/pip/_internal/init.py", line 40, in from pip._internal.cli.autocompletion import autocomplete File "/usr/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 8, in from pip._internal.cli.main_parser import create_main_parser File "/usr/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 11, in from pip._internal.commands import ( File "/usr/lib/python3.8/site-packages/pip/_internal/commands/init.py", line 6, in from pip._internal.commands.completion import CompletionCommand File "/usr/lib/python3.8/site-packages/pip/_internal/commands/completion.py", line 6, in from pip._internal.cli.base_command import Command File "/usr/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 26, in from pip._internal.index import PackageFinder ImportError: cannot import name 'PackageFinder' from 'pip._internal.index' (/usr/lib/python3.8/site-packages/pip/_internal/index/init.py)

bot

62f commented 3 years ago

I don’t understand. Are you saying this can’t be done and it has nothing to do with ish? It works on Pythonista, Pyto, and Carnet so if it’s not an ish issue, what is it?

try '''python -m pip3 install alpha_vantage --user''' to solve "cannot be installed directly". That's about he most indirect way to install that I can think of. @ifuchs

ifuchs commented 3 years ago

@62f

python3 -m pip3 install alpha_vantage --user /usr/bin/python3: No module named pip3

62f commented 3 years ago

From https://gitmemory.com/issue/zeromq/pyzmq/1510/783219808

Looks like I need to regen the platform.hpps. In the meantime, it should work to apk add zeromq-dev to your apk add prior to pip install and it should work.

<details>In your case tho, ```apk add py3-multidict-dev g++``` 

But the problem is that NONE of the multidict apks show up in the alpine repositories!

http://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86/py3-multidict-dev-5.1.0-r0.apk

http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86/py3-multidict-dev-4.3.1-r0.apk

Both apk package files exist but do not appear as searchable text in the webpage listings http://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86/

So users're being tricked into installing them with pip3.8, which in turn complains about PEP-517, without even any idea that it's available for download. This is an ALPINE PROBLEM, not iSH

62f commented 3 years ago

Furthermore, idna Also has an unlisted existence!

62f commented 3 years ago

@62f I can only assume the apk for python3 includes pip. @tbodt according to python, it should, but for Alpine it doesn't, which from a support perspective sounds awful, but conveniently makes pip's removal possible after using pip to install pipx. Absolute-genius.

Js2m commented 2 years ago

@62f

python3 -m pip3 install alpha_vantage --user /usr/bin/python3: No module named pip3