2

This is my first post. I run the following: Win 10 Anaconda with Python 3.6.5 Bloomberg Anywhere

I am trying to use the blpapi (bloomberg professional API) for Python. Downloaded the Desktop API package (with C++ libraries), downloaded blpapi-3.9.1-cp36-cp36m-win_amd64.whl installer file and ran it succesfully. Finally I added the C:\..\C++API\v3.11.6.1\bin to my path in both user and environment variables (from earlier query here on stackoverflow): Python 2.7 with Bloomberg API import blpapi failure

My error message when running import blpapi:

>---------------------------------------------------------------------------
>ImportError                               Traceback (most recent call last)
>~\Anaconda3\lib\site-packages\blpapi\internals.py in swig_import_helper()
>     38         try:
>---> 39             return importlib.import_module(mname)
>     40         except ImportError:
>
>~\Anaconda3\lib\importlib\__init__.py in import_module(name, package)
>    125             level += 1
>--> 126     return _bootstrap._gcd_import(name[level:], package, level)
>    127 >>
>
>~\Anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
>
>~\Anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
>
>~\Anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, >import_)
>
>~\Anaconda3\lib\importlib\_bootstrap.py in _load_unlocked(spec)
>
>~\Anaconda3\lib\importlib\_bootstrap.py in module_from_spec(spec)
>
>~\Anaconda3\lib\importlib\_bootstrap_external.py in create_module(self, spec)
>
>~\Anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, >**kwds)
>
>ImportError: DLL load failed: The specified module could not be found.
>
>During handling of the above exception, another exception occurred:
>
>ModuleNotFoundError                       Traceback (most recent call last)
>~\Anaconda3\lib\site-packages\blpapi\__init__.py in <module>()
>      3 try:
>----> 4     from .internals import CorrelationId
>      5 except ImportError as error:
>
>~\Anaconda3\lib\site-packages\blpapi\internals.py in <module>()
>     41             return importlib.import_module('_internals')
>---> 42     _internals = swig_import_helper()
>     43     del swig_import_helper
>
>~\Anaconda3\lib\site-packages\blpapi\internals.py in swig_import_helper()
>     40         except ImportError:
>---> 41             return importlib.import_module('_internals')
>     42     _internals = swig_import_helper()
>
>~\Anaconda3\lib\importlib\__init__.py in import_module(name, package)
>    125             level += 1
>--> 126     return _bootstrap._gcd_import(name[level:], package, level)
>    127 
>
>ModuleNotFoundError: No module named '_internals'
>
>During handling of the above exception, another exception occurred:
>
>ImportError                               Traceback (most recent call last)
><ipython-input-1-ee203a799ece> in <module>()
>----> 1 import blpapi
>
>~\Anaconda3\lib\site-packages\blpapi\__init__.py in <module>()
>     27 
>     28 """ % (str(error), env)
>---> 29     raise ImportError(msg)
>     30 
>     31 from .abstractsession import AbstractSession
>
>ImportError: No module named '_internals'
>
>Could not open the C++ SDK library.
>
>Download and install the latest C++ SDK from:
>
>    http://www.bloomberg.com/professional/api-library
>
>If the C++ SDK is already installed, please ensure that the path to the library
>was added to PATH before entering the interpreter.

Does someone know what the problem might be?

Nipun Thennakoon
  • 3,586
  • 1
  • 18
  • 26
chmith
  • 21
  • 1
  • 6
  • Did you try downloading and installing the latest C++ SDK? – Levi Lesches Jul 10 '18 at 18:27
  • Thanks - the Bloomberg support told me that their Desktop API package would be all I needed, so no. But I'm happy to try! Would that be the entire Visual Studio package I should download and install? – chmith Jul 10 '18 at 18:40
  • I was going to say the link they gave you in the error: http://www.bloomberg.com/professional/api-library – Levi Lesches Jul 10 '18 at 18:48
  • Ah yes, I have. The SDK they link to is already part of the 'Desktop API package' which I've downloaded. I'm not sure if there is another way to change my 'path'.. – chmith Jul 10 '18 at 18:54
  • Hmm, sorry that's all I've got. I don't actually know/use this software, I'm just being Captain obvious – Levi Lesches Jul 10 '18 at 19:13
  • Alright, thanks nonetheless – chmith Jul 10 '18 at 19:35

2 Answers2

1

Having exactly the same issue. Comparability issues.

The solution for me was to roll back the version of python to 3.7.7 64-bit

from: 3.8.3 32-bit
to: 3.7.7 64-bit

The BLPAPI works if the versions are compatible otherwise they fail.

Bloomberg dll files:

blpapi3_32.dll (version 3.14.3.1)
blpapi3_64.dll (version 3.14.3.1)

This solved the issue.

D.L
  • 4,339
  • 5
  • 22
  • 45
0

Solved: I installed Microsoft Build Tools 2017 and added the BLPAPI_ROOT path as described in the linked question in my original post.

chmith
  • 21
  • 1
  • 6