Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bloomberg API Python 3.5.5 with C++ 3.8.1.1. on Mac OS X import blpapi referencing

I am trying to install and run successfully Bloomberg API Python 3.5.5 and I have also downloaded and unpacked C++ library 3.8.1.1., both for the Mac OS X. I'm running Mac OS X 10.10.2. I am using the Python native to Mac OS X, Python 2.7.6 and I had already installed, via Xcode, the Command line gcc compiler, GCC 4.2.1.

I did, on an administrator account, sudo python setup.py install. I also had changed the setup.py ENVIRONMENT variable BLPAPI_ROOT to the directory for the C++ headers, blpapi_cpp_3.8.1.1. The setup was successful.

I changed to another directory as suggested by the Python's README file, to avoid 'Import Error: No module named _internals'.

When I go to python and enter the command import blpapi, I obtain the following error:

import blpapi Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.7/site-packages/blpapi/init.py", line 5, in from .internals import CorrelationId File "/Library/Python/2.7/site-packages/blpapi/internals.py", line 50, in _internals = swig_import_helper() File "/Library/Python/2.7/site-packages/blpapi/internals.py", line 46, in swig_import_helper _mod = imp.load_module('_internals', fp, pathname, description) ImportError: dlopen(/Library/Python/2.7/site-packages/blpapi/_internals.so, 2): Library not loaded: libblpapi3_64.so Referenced from: /Library/Python/2.7/site-packages/blpapi/_internals.so Reason: image not found

I check the directory for /Library/Python.../blpapi/ and there is no _internals.so only *.py files. Is that the problem? I don't know how to proceed.

like image 810
ernestyalumni2014 Avatar asked Feb 02 '26 16:02

ernestyalumni2014


1 Answers

There is a missing step in the Python SDK README file; it instructs you to set BLPAPI_ROOT in order to build the API wrapper, but this doesn't provide the information needed at runtime to be able to load it.

If you unpacked the C/C++ SDK into '/home/foo/blpapi-sdk' (for example), you will need to set DYLD_LIBRARY_PATH to allow the runtime dynamic linker to locate the BLPAPI library. This can be done as so:

$ export DYLD_LIBRARY_PATH=/home/foo/blpapi-sdk/Darwin

like image 96
Kevin P. Fleming Avatar answered Feb 04 '26 06:02

Kevin P. Fleming



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!