Protobuf with Python - MAC OSX

557 views
Skip to first unread message

Glen-Erik Cortes

unread,
Apr 14, 2017, 2:29:57 PM4/14/17
to Protocol Buffers
Hello,

I am trying to use protobuf with Python 3.6 or 2.7. Python cannot find protobuf, but I see the files under: /usr/local/Cellar/gdbm/1.13/lib/

I also see a file called protoc in /usr/local/Cellar/protobuf/3.2.0_1/bin/protoc.

Right now Python3.6 can see Numpy and Pandas but not Protobuf. Python 2.7 can't see any of them.

These are the steps I followed:

1. brew install python
2. pip install pandas protobuf jedi

That didnt work so I downloaded Python 3.6 and installed it like any app.

Then tried again in the terminal.

Here is the terminal code:

Last login: Mon Apr 10 15:35:14 on ttys000
GEC-Macbook-Air:~ GEC$ brew install python
==> Installing dependencies for python: readline, sqlite, gdbm, openssl
==> Installing python dependency: readline
######################################################################## 100.0%
==> Pouring readline-7.0.3_1.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.


For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/readline/lib
    CPPFLAGS: -I/usr/local/opt/readline/include

==> Summary
🍺  /usr/local/Cellar/readline/7.0.3_1: 46 files, 1.5MB
==> Installing python dependency: sqlite
######################################################################## 100.0%
==> Pouring sqlite-3.18.0.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

macOS provides an older sqlite3.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/sqlite/lib
    CPPFLAGS: -I/usr/local/opt/sqlite/include

==> Summary
🍺  /usr/local/Cellar/sqlite/3.18.0: 11 files, 3.0MB
==> Installing python dependency: gdbm
######################################################################## 100.0%
==> Pouring gdbm-1.13.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/gdbm/1.13: 19 files, 554.4KB
==> Installing python dependency: openssl
######################################################################## 100.0%
==> Pouring openssl-1.0.2k.el_capitan.bottle.tar.gz
==> Using the sandbox
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2k: 1,696 files, 12MB
==> Installing python 
######################################################################## 100.0%
==> Pouring python-2.7.13.el_capitan.bottle.1.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/2to3
Target /usr/local/bin/2to3
already exists. You may want to remove it:
  rm '/usr/local/bin/2to3'

To force the link and overwrite all conflicting files:
  brew link --overwrite python

To list all files that would be deleted:
  brew link --overwrite --dry-run python

Possible conflicting files are:
/usr/local/bin/2to3 -> /Library/Frameworks/Python.framework/Versions/3.6/bin/2to3
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg install
==> Caveats
Pip and setuptools have been installed. To update them
  pip install --upgrade pip setuptools

You can install Python packages with
  pip install <package>

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

==> Summary
🍺  /usr/local/Cellar/python/2.7.13: 3,526 files, 48MB
GEC-Macbook-Air:~ GEC$ pip install pandas protobuf jedi
Collecting pandas
  Using cached pandas-0.19.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Requirement already satisfied: protobuf in /usr/local/Cellar/protobuf/3.2.0_1/libexec/lib/python2.7/site-packages
Collecting jedi
  Using cached jedi-0.10.2-py2.py3-none-any.whl
Collecting numpy>=1.7.0 (from pandas)
  Downloading numpy-1.12.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (4.4MB)
    100% |████████████████████████████████| 4.4MB 270kB/s 
Collecting python-dateutil (from pandas)
  Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 2.3MB/s 
Collecting pytz>=2011k (from pandas)
  Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
    100% |████████████████████████████████| 491kB 863kB/s 
Collecting six>=1.9 (from protobuf)
  Using cached six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/site-packages (from protobuf)
Installing collected packages: numpy, six, python-dateutil, pytz, pandas, jedi
Successfully installed jedi-0.10.2 numpy-1.12.1 pandas-0.19.2 python-dateutil-2.6.0 pytz-2017.2 six-1.10.0
GEC-Macbook-Air:~ GEC$ python -V
Python 2.7.10
GEC-Macbook-Air:~ GEC$ protoc --version
libprotoc 3.2.0
GEC-Macbook-Air:~ GEC$ 

Thanks for your help.
Reply all
Reply to author
Forward
0 new messages