1

I have been trying to get either pdblp or pybbg to work in python. I have installed blpapi via pip, and download the experimental c++ version and added it to my PATH environmental variables. When running the following code I get this error for pdblp

Using Anaconda3 64 bit, python 3.7, the latest blp_cpp experemental verision (cpp_3.12.3.1), and pip install was verision 3.12.2. Computer is using windows 10:


import blpapi
import pdblp

Traceback (most recent call last):

  File "<ipython-input-2-af8ae6f76dae>", line 1, in <module>
    import pdblp

  File "C:\ProgramData\Anaconda3\lib\site-packages\pdblp\__init__.py", line 1, in <module>
    from .pdblp import BCon  # NOQA

  File "C:\ProgramData\Anaconda3\lib\site-packages\pdblp\pdblp.py", line 9, in <module>
    _RESPONSE_TYPES = [blpapi.Event.RESPONSE, blpapi.Event.PARTIAL_RESPONSE]

AttributeError: module 'blpapi' has no attribute 'Event'

and this error for pybbg:


import pandas as pd
import numpy as np
import blpapi
import pybbg as pybbg

bb = pybbg.Pybbg()

runfile('C:/Python/BB.py', wdir='C:/Python')
Reloaded modules: pybbg, pybbg.pybbg_k
Traceback (most recent call last):

  File "<ipython-input-4-b339dc11b877>", line 1, in <module>
    runfile('C:/Python/BB.py', wdir='C:/Python')

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 704, in runfile
    execfile(filename, namespace)

  File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:\Python\BB.py", line 14, in <module>
    bb = pybbg.Pybbg()

  File "C:\Python\PYTHONPATH\pybbg\pybbg_k.py", line 27, in __init__
    sessionOptions = blpapi.SessionOptions()

AttributeError: module 'blpapi' has no attribute 'SessionOptions'

Any help on this would be much appreciated.

runccoabcc
  • 11
  • 4
  • Inform us which Win (32, 64), Python and blpapi/pdblp versions you are using. Kinda relevant.Are you using prebuild? (assumin 3.x for python). You might need to install different versions. – ZF007 Mar 23 '19 at 16:07
  • thanks for the formatting tips, tried adding the extra info. thanks again ZF007 – runccoabcc Mar 23 '19 at 16:19
  • Can you check if they are still missing in the prebuild 3.5 and/or 3.6 versions? Might be that someone forgot check-marks in a nightly version or changed names? – ZF007 Mar 23 '19 at 16:21
  • Seems `pip install git+https://github.com/kyuni22/pybbg` isn't working for me. – ZF007 Mar 23 '19 at 16:38
  • how do you check if they are missing in the prebuild? – runccoabcc Mar 23 '19 at 16:43
  • also, to install pybbg i downloaded a copy and added teh folder to site libs, along with adding a pythonpath environment variable pointing to the folder. – runccoabcc Mar 23 '19 at 16:44
  • Based on your comment I'm getting now about 100 Traceback errors with the latest installation... Seems I do something wrong. Not keen to figure out what is wrong in getting it fixed. However, to check for you if the experimental version is missing the modules you uninstall it first and then install a previous version. In this case the 3.5 or 3.6 version. Then run your code again and see if its fixed. If so then the above applies... either "Changed module or def() names" or "missed checkbox" prior compiling the dll's. – ZF007 Mar 23 '19 at 16:50
  • I am prettty sure that it is the blpapi add in that isn't working. I tried a simple blpapi script: from optparse import OptionParser, Option, OptionValueError TICK_DATA = blpapi.Name("tickData") HOST = "localhost" PORT = 8194 sessionOptions = blpapi.SessionOptions() and it is coming up with: Traceback (most recent call last): File "", line 2, in TICK_DATA = blpapi.Name("tickData") AttributeError: module 'blpapi' has no attribute 'Name' will try installing an older verision like you recomended – runccoabcc Mar 23 '19 at 17:18
  • Just to close this out, thanks a lot for the help ZF007. what ended up working was manutally deleting blpapi from the sit libs (using uninstall with pip did not work) and reinstalling it with: python -m pip install --index-url=https://bloomberg.bintray.com/pip/simple blpapi I honestly have no idea why this worked, this was how i installed the version that i thought was on it. – runccoabcc Mar 23 '19 at 17:38
  • you can post your last two commented answer as an answer. It looks like an order of installation. You might what to include that order (with software versions) in your answer as a numbered list. This way you help-out others to solve similar issues in the future. Sometimes it is indeed the best way to remove something manually from the site libs. Glad you got it fixed this way. – ZF007 Mar 23 '19 at 19:23

0 Answers0