CAIDA / pybgpstream

Python bindings for BGPStream
https://bgpstream.caida.org
BSD 2-Clause "Simplified" License
29 stars 23 forks source link

pip install on mac not working #22

Open bhuffaker opened 4 years ago

bhuffaker commented 4 years ago

os: macOS 10.15.3 > python3 temp.py

==> Installing dependencies for bgpstream: wandio
==> Installing bgpstream dependency: wandio
==> Downloading https://homebrew.bintray.com/bottles/wandio-4.2.2.catalina.bottle.tar.gz
######################################################################## 100.0%
==> Pouring wandio-4.2.2.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/wandio/4.2.2: 12 files, 189.9KB
==> Installing bgpstream
==> Downloading https://homebrew.bintray.com/bottles/bgpstream-1.2.3.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/26/26f6a06267aa23f01fa2b625b1d5ae61d54a9f792707227892c38e30999bb456?__gda__=exp=1583478500~hmac=da78f5c5ac37c10dd59aa7732fe8aaf49fbefa6f5e1ece
######################################################################## 100.0%
==> Pouring bgpstream-1.2.3.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/bgpstream/1.2.3: 29 files, 657.7KB

> pip3 install --upgrade --force-reinstall pybgpstream

Collecting pybgpstream
  Using cached https://files.pythonhosted.org/packages/b5/38/f840650dff11932eb5166e3b67fb0d62f66cf8cfe79b99b71a3d38cc76ed/pybgpstream-2.0.0-cp37-cp37m-macosx_10_14_x86_64.whl
Collecting python-dateutil
  Using cached https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl
Collecting six>=1.5
  Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, pybgpstream
  Found existing installation: six 1.13.0
    Uninstalling six-1.13.0:
      Successfully uninstalled six-1.13.0
  Found existing installation: python-dateutil 2.8.1
    Uninstalling python-dateutil-2.8.1:
      Successfully uninstalled python-dateutil-2.8.1
  Found existing installation: pybgpstream 2.0.0
    Uninstalling pybgpstream-2.0.0:
      Successfully uninstalled pybgpstream-2.0.0
Successfully installed pybgpstream-2.0.0 python-dateutil-2.8.1 six-1.14.0

>>> import pybgpstream

Traceback (most recent call last):
  File "temp.py", line 1, in <module>
    import pybgpstream
  File "/usr/local/lib/python3.7/site-packages/pybgpstream/__init__.py", line 27, in <module>
    from .pybgpstream import *
  File "/usr/local/lib/python3.7/site-packages/pybgpstream/pybgpstream.py", line 29, in <module>
    import _pybgpstream
ImportError: dlopen(/usr/local/lib/python3.7/site-packages/_pybgpstream.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/lib/libbgpstream.3.dylib
  Referenced from: /usr/local/lib/python3.7/site-packages/_pybgpstream.cpython-37m-darwin.so
  Reason: image not found
digizeph commented 4 years ago

Judging from your first quote block, you seems to be installing bgpstream version 1 using home brew. The pip version of pybgpstream (2.0) supports only libbgpstream v2 (see release note). You should try install v2 bgpstream then try again. Also, the homebrew version is not maintained by CAIDA (yet).

With that, I can't reproduce the issue on Mojave where I have libbgpstream v2 installed:

digizeph commented 4 years ago

Try this most recent release of libbgpstream v2 rc3 here: https://github.com/CAIDA/libbgpstream/releases/tag/v2.0-rc3

digizeph commented 4 years ago

@bhuffaker were you able to fix the issue?

digizeph commented 4 years ago

ping

bhuffaker commented 4 years ago

no

On Mar 31, 2020, at 2:29 AM, Mingwei Zhang notifications@github.com wrote:

ping

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CAIDA/pybgpstream/issues/22#issuecomment-606135653, or unsubscribe https://github.com/notifications/unsubscribe-auth/AECPT7LLJ2ZWYRBKKFJTPX3RKDJHZANCNFSM4LC2EHNQ.

snarfed commented 2 years ago

I managed to successfully brew install bgpstream and then pip install pybgpstream on macOS 12.5 just now by setting C_INCLUDE_PATH and LIBRARY_PATH:

$ brew install bgpstream
...
==> Installing bgpstream
==> Pouring bgpstream--2.2.0.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/bgpstream/2.2.0: 47 files, 1.1MB
...
$ brew list bgpstream
/opt/homebrew/Cellar/bgpstream/2.2.0/bin/bgpreader
/opt/homebrew/Cellar/bgpstream/2.2.0/bin/parsebgp
/opt/homebrew/Cellar/bgpstream/2.2.0/include/ (33 files)
/opt/homebrew/Cellar/bgpstream/2.2.0/lib/libbgpstream.3.dylib
/opt/homebrew/Cellar/bgpstream/2.2.0/lib/libparsebgp.2.dylib
/opt/homebrew/Cellar/bgpstream/2.2.0/lib/ (4 other files)
$ C_INCLUDE_PATH=/opt/homebrew/Cellar/bgpstream/2.2.0/include LIBRARY_PATH=/opt/homebrew/Cellar/bgpstream/2.2.0/lib/ pip install pybgpstream
...
$ python
>>> import pybgpstream
>>> stream = pybgpstream.BGPStream(
    collectors=["route-views.sg", "route-views.eqix"],
    ...
)
>>>

Note that Homebrew does now happily install libbgpstream 2. Maintainers, you may want to update the "Coming Soon" on https://bgpstream.caida.org/docs/install/bgpstream#osx to say that it works!