facebook / idb

idb is a flexible command line interface for automating iOS simulators and devices
https://fbidb.io
MIT License
4.5k stars 432 forks source link

Unable to install idb with homebrew Python 3 (protobuf issue) #612

Closed thibmaek closed 4 years ago

thibmaek commented 4 years ago

--- Please use this template, and delete everything above this line before submitting your issue ---

Description

Tried to install fb-idb via pip3 from Python 3.7 all installed with homebrew and correctly linked for all other pip installed packages. Seems like an issue with protobuf compiler.

Reproduction

brew install python
pip3 install fb-idb

Collecting fb-idb
  Using cached fb_idb-1.0.12-py3-none-any.whl (125 kB)
Requirement already satisfied: aiofiles in /usr/local/lib/python3.7/site-packages (from fb-idb) (0.5.0)
Requirement already satisfied: protobuf in /usr/local/lib/python3.7/site-packages (from fb-idb) (3.11.3)
Requirement already satisfied: grpclib>=0.3.2 in /usr/local/lib/python3.7/site-packages (from fb-idb) (0.3.2)
Requirement already satisfied: treelib in /usr/local/lib/python3.7/site-packages (from fb-idb) (1.6.1)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from protobuf->fb-idb) (46.0.0)
Requirement already satisfied: six>=1.9 in /usr/local/lib/python3.7/site-packages (from protobuf->fb-idb) (1.12.0)
Requirement already satisfied: multidict in /usr/local/lib/python3.7/site-packages (from grpclib>=0.3.2->fb-idb) (4.7.6)
Requirement already satisfied: h2 in /usr/local/lib/python3.7/site-packages (from grpclib>=0.3.2->fb-idb) (3.2.0)
Requirement already satisfied: future in /usr/local/lib/python3.7/site-packages (from treelib->fb-idb) (0.18.2)
Requirement already satisfied: hyperframe<6,>=5.2.0 in /usr/local/lib/python3.7/site-packages (from h2->grpclib>=0.3.2->fb-idb) (5
.2.0)
Requirement already satisfied: hpack<4,>=3.0 in /usr/local/lib/python3.7/site-packages (from h2->grpclib>=0.3.2->fb-idb) (3.0.0)
Installing collected packages: fb-idb
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/protoc_compiler_template.p
y'
Consider using the `--user` option or check the permissions.
psdewar commented 4 years ago

+1, for me this happens with python3.8

ezhiljohnson7 commented 4 years ago

Pip is trying to install this package to a system folder that the current user doesn't have access to. Try below steps to fix this -

pip3.7 uninstall fb-idb pip3.7 install --user fb-idb

This should give you

Successfully installed fb-idb-1.0.12

'idb' will be available in /Users/<user>/Library/Python/3.7/bin, just add this to your PATH variable.

then idb list-targets, should list down all the devices connected.

thibmaek commented 4 years ago

@ezhiljohnson7 I know but why? The whole reason I use Python + pip via brew is to avoid having permission issues. No other pip package has any issues with permissions

thibmaek commented 4 years ago

Furthermore, installing with the --user flag results in Flipper not recognising the idb binary: Current setting: /Users/<user>/Library/Python/3.7/bin/idb isn't a valid IDB installation.

image

Trying to invoke the binary at the path throws a Python (and protobuf related) error:

image
thibmaek commented 4 years ago

Upgrading protobuf via pip seems to solve this issue but will introduce issues for other packages…

Screenshot 2020-08-04 at 19 50 08
ezhiljohnson7 commented 4 years ago

@thibmaek, I did go through some trouble when I faced the same issue, closest to solving the problem at its root was discussed here -

https://github.com/pypa/pip/issues/7440 see if this helps you.

So far, I haven't faced any issues except for this compromise of having the 'idb' installed in my user account - '<>/Python/3.x/bin' instead of the '<>/site-packages'.

But, have set the idb path explicitly on my Flipper, here's a snapshot

Screenshot 2020-08-04 at 11 40 06 PM