idb icon indicating copy to clipboard operation
idb copied to clipboard

Error after install idb

Open gregoryfm opened this issue 5 years ago • 7 comments

Description

I've followed the install steps, but when trying to use the idb command get the error below:

❯ idb list-targets
Traceback (most recent call last):
  File "/usr/local/bin/idb", line 5, in <module>
    from idb.cli.main import main
  File "/usr/local/lib/python3.8/site-packages/idb/cli/__init__.py", line 23, in <module>
    from idb.grpc.client import IdbClient as IdbClientGrpc
  File "/usr/local/lib/python3.8/site-packages/idb/grpc/client.py", line 68, in <module>
    from idb.grpc.crash import (
  File "/usr/local/lib/python3.8/site-packages/idb/grpc/crash.py", line 10, in <module>
    from idb.grpc.idb_pb2 import (
  File "/usr/local/lib/python3.8/site-packages/idb/grpc/idb_pb2.py", line 5, in <module>
    from google.protobuf import descriptor as _descriptor
ModuleNotFoundError: No module named 'google'

Additional Information

macOS 11.4 Xcode 12.5.1

gregoryfm avatar Jul 12 '21 06:07 gregoryfm

Hey, could you check if protobuf is installed with: pip show protobuf?

fgasperij avatar Jul 12 '21 16:07 fgasperij

Hi @fgasperij yes it is.

❯ pip3 show protobuf
Name: protobuf
Version: 3.17.3
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: None
Author-email: None
License: 3-Clause BSD License
Location: /usr/local/lib/python3.9/site-packages
Requires: six
Required-by: fb-idb

gregoryfm avatar Jul 12 '21 21:07 gregoryfm

I am having the same issue. protobuf is installed in /usr/local/lib/python3.9/site-packages, but not in /usr/local/lib/python3.8/site-packages. idb is running with Python 3.8.

Ashoat avatar Jul 19 '21 19:07 Ashoat

I was able to install protobuf for Python 3.8 with the following command:

/usr/local/opt/[email protected]/libexec/bin/pip install protobuf

Pretty hacky, but at least it made the error go away. However, now I'm seeing the following issue in Flipper 0.98:

IDB issue

Here is the original output I got from brew tap facebook/fb && brew install idb-companion:

==> Installing idb-companion from facebook/fb
==> Downloading https://github.com/facebook/idb/releases/download/v1.1.5/idb-companion-1.1.5.big_sur.bottle.tar.gz
==> Downloading from https://github-releases.githubusercontent.com/41870517/5992eb80-e048-11eb-9055-0c42005b8fa1?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210719%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210719T190936Z&X-Amz-Expires=300&X-Amz-Signature=166961fd1571e8f5bb6a8c5fd4a03955655dd61f7379d38130479f13aba3e3e2&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=41870517&response-
######################################################################## 100.0%
==> Pouring idb-companion-1.1.5.big_sur.bottle.tar.gz
==> codesign --force --sign - --timestamp=none /usr/local/Cellar/idb-companion/1.1.5/Frameworks/FBDeviceControl.framework/Versions/A/Resources/libShimulator.dylib
==> codesign --force --sign - --timestamp=none /usr/local/Cellar/idb-companion/1.1.5/Frameworks/FBSimulatorControl.framework/Versions/A/Resources/libShimulator.dylib
==> codesign --force --sign - --timestamp=none /usr/local/Cellar/idb-companion/1.1.5/Frameworks/XCTestBootstrap.framework/Versions/A/Resources/libShimulator.dylib
==> codesign --force --sign - --timestamp=none /usr/local/Cellar/idb-companion/1.1.5/Frameworks/FBControlCore.framework/Versions/A/Resources/libShimulator.dylib
🍺  /usr/local/Cellar/idb-companion/1.1.5: 213 files, 71.2MB

I also tried brew reinstall idb-companion, but the issue still occurred. Here was the output of that command:

==> Downloading https://github.com/facebook/idb/releases/download/v1.1.5/idb-companion-1.1.5.big_sur.bottle.tar.gz
Already downloaded: /Users/ashoat/Library/Caches/Homebrew/downloads/c03536e27690ad8f415a43755412314c46043efb1cdb9f22a664b7cd3155626a--idb-companion-1.1.5.big_sur.bottle.tar.gz
==> Reinstalling facebook/fb/idb-companion
==> Pouring idb-companion-1.1.5.big_sur.bottle.tar.gz
==> codesign --force --sign - --timestamp=none /usr/local/Cellar/idb-companion/1.1.5/Frameworks/FBDeviceControl.framework/Versions/A/Resources/libShimulator.dylib
==> codesign --force --sign - --timestamp=none /usr/local/Cellar/idb-companion/1.1.5/Frameworks/FBSimulatorControl.framework/Versions/A/Resources/libShimulator.dylib
==> codesign --force --sign - --timestamp=none /usr/local/Cellar/idb-companion/1.1.5/Frameworks/XCTestBootstrap.framework/Versions/A/Resources/libShimulator.dylib
==> codesign --force --sign - --timestamp=none /usr/local/Cellar/idb-companion/1.1.5/Frameworks/FBControlCore.framework/Versions/A/Resources/libShimulator.dylib
🍺  /usr/local/Cellar/idb-companion/1.1.5: 213 files, 71.2MB

UPDATE

The issue was an outdated install of the idb client which was using Python 3.8. It seems I had previously installed the idb client when I didn't have Python 3.9, and it was setup to use Python 3.8. At some point something got borked, probably because I didn't run pip install with the --upgrade flag. More details in https://github.com/facebook/flipper/issues/2113

Ashoat avatar Jul 19 '21 19:07 Ashoat

@gregoryfm did reinstalling fb-idb solved the python version mismatch? (as suggested by @Ashoat)

jbardini avatar Jul 23 '21 10:07 jbardini

Sorry for the delay.

Yes, it worked using the following command:

/usr/local/opt/[email protected]/libexec/bin/pip install protobuf

Thanks @Ashoat

gregoryfm avatar Jul 24 '21 03:07 gregoryfm

You have to detect the python version used from the error message you get.

In my case running idb list-targets lead to:

Traceback (most recent call last):
  File "/opt/homebrew/bin/idb", line 5, in <module>
    from idb.cli.main import main
  File "/opt/homebrew/lib/python3.9/site-packages/idb/cli/__init__.py", line 29, in <module>
    from idb.grpc.client import Client as GrpcClient
  File "/opt/homebrew/lib/python3.9/site-packages/idb/grpc/client.py", line 83, in <module>
    from idb.grpc.crash import (
  File "/opt/homebrew/lib/python3.9/site-packages/idb/grpc/crash.py", line 10, in <module>
    from idb.grpc.idb_pb2 import (
  File "/opt/homebrew/lib/python3.9/site-packages/idb/grpc/idb_pb2.py", line 5, in <module>
    from google.protobuf.internal import enum_type_wrapper
ModuleNotFoundError: No module named 'google'

which I fixed (similar to what @gregoryfm did) with

/opt/homebrew/bin/pip3.9 install protobuf

andrekovac avatar Sep 06 '23 12:09 andrekovac