Python Connection blpapi issues/inconsistencies

214 Views Asked by At

I've installed python 3.9 venv and install blpapi via:

pip install --index-url=https://bcms.bloomberg.com/pip/simple blpapi

(source)

When I run the following example on this venv I'm getting connection issues:

import blpapi
options = blpapi.SessionOptions()
options.setServerHost('localhost')
options.setServerPort(8194)
session = blpapi.Session(options)
session.start()

Error:

apicm_apiconnector.cpp:389 ApiConnector::socketConnectorCallback localhost: Failed to connect to 127.0.0.1:8194, status=1, error 8 connect event failed

ERROR blpapi_sessionimpl.cpp:2541 blpapi.session.{1} Failed to start session. { ErrorInfo=[ source = "ApiConnector" code = 8 category = "IO_ERROR" errorMessage = "connect event failed" subcategory = NULL ] RequestId=NULL }

The weird issue is when I install the same package on to the local python interpreter it works. Local python is python 3.10 and is able to connect.

Any ideas if I'm missing any critical steps in my installation of the package?

I tried to install it in to a separate local python environment and it works.

2

There are 2 best solutions below

0
wlg On BEST ANSWER

So I just had to restart my server...

When it doubt, restart....

0
Beast Legend Tank On

The latest update broke Blpapi on Python 3.9 and below. Has something to do with the C++ SDK needing to be updated. C++ isn't used in the 3.10+ versions of Blpapi, which is why you're not having issues on 3.10+

You can update the SDK from Bloomberg's website, or update your python environment.