Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install on mac not working #22

Open
bhuffaker opened this issue Mar 6, 2020 · 6 comments
Open

pip install on mac not working #22

bhuffaker opened this issue Mar 6, 2020 · 6 comments
Labels
version issue Issues related to using incompatible versions of PyBGPStream and libBGPStream

Comments

@bhuffaker
Copy link
Member

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
Copy link
Contributor

digizeph commented Mar 6, 2020

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:

  • No issues doing pip3 install --upgrade --force-reinstall pybgpstream and import pybgpstream on 10.14.5.
  • No issues doing that on 10.14.6
  • I don't have a machine that runs catalina on hand, so cannot verify that yet.

@digizeph
Copy link
Contributor

digizeph commented Mar 6, 2020

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

@digizeph digizeph added the version issue Issues related to using incompatible versions of PyBGPStream and libBGPStream label Mar 6, 2020
@digizeph
Copy link
Contributor

digizeph commented Mar 9, 2020

@bhuffaker were you able to fix the issue?

@digizeph
Copy link
Contributor

ping

@bhuffaker
Copy link
Member Author

bhuffaker commented Mar 31, 2020 via email

@snarfed
Copy link

snarfed commented Jul 26, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
version issue Issues related to using incompatible versions of PyBGPStream and libBGPStream
Projects
None yet
Development

No branches or pull requests

3 participants