2

This question is no longer relevant as Bloomberg now provides 64 bit binaries


I am trying, unsuccessfully, to compile the 64-bit Python API library for the Bloomberg terminal, as I need >4gig address space and Bloomberg only provides 32 bit binaries.

I am running standard Python 2.7 64-bit that was compiled with MS VS 2008 as can be seen from the header when I run Python:

Y:\>python
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

I have downloaded the latest API on WAPI page API download centre, and have strictly followed the instructions on this page on how to compile 64 bit exensions for Python, first by downloading Visual C++ 2008 Express, then installing the SDK 3.5 SPI, then going into the SDK command prompt, then doing:

setenv /Release /x64
set DISTUTILS_USE_SDK=1

The command prompt turns green as expected.

I have set the correct environment variables to find the C++ API namely the BLPAPI_ROOT:

C:\Program Files\Microsoft SDKs\Windows\v7.0>set
ALLUSERSPROFILE=C:\ProgramData
AMDAPPSDKROOT=C:\Program Files (x86)\AMD APP SDK\2.9\
APPDATA=C:\Users\thomas\AppData\Roaming
APPVER=6.1
asl.log=Destination=file
BLPAPI_ROOT=C:\blp\API\APIv3\C++API\v3.7.5.1
CLASSPATH=.;C:\Program Files (x86)\Java\jre7\lib\ext\QTJava.zip
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
.......

Which as you can see exists:

C:\Program Files\Microsoft SDKs\Windows\v7.0>cd %BLPAPI_ROOT%

C:\blp\API\APIv3\C++API\v3.7.5.1>

But….

C:\blp\API\APIv3\Python\v3.5.2.0>python setup.py install
running install
running build
running build_py
running build_ext
building 'blpapi._internals' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Bin\amd64\cl.exe /c /nolog
o /Ox /MD /W3 /GS- /DNDEBUG -IC:\blp\API\APIv3\C++API\v3.7.5.1\include -Ic:\pyth
on27\include -Ic:\python27\PC /Tpblpapi/internals_wrap.cxx /Fobuild\temp.win-amd
64-2.7\Release\blpapi/internals_wrap.obj
internals_wrap.cxx
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\Include\xlocale(342) : war
ning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
blpapi/internals_wrap.cxx(3892) : warning C4244: 'argument' : conversion from 'b
lpapi_Float64_t' to 'blpapi_Float32_t', possible loss of data
blpapi/internals_wrap.cxx(3906) : warning C4244: 'argument' : conversion from 'b
lpapi_Float64_t' to 'blpapi_Float32_t', possible loss of data
blpapi/internals_wrap.cxx(3925) : warning C4244: 'argument' : conversion from 'b
lpapi_Float64_t' to 'blpapi_Float32_t', possible loss of data
blpapi/internals_wrap.cxx(3989) : warning C4244: 'argument' : conversion from 'b
lpapi_Float64_t' to 'blpapi_Float32_t', possible loss of data
blpapi/internals_wrap.cxx(4006) : warning C4244: 'argument' : conversion from 'b
lpapi_Float64_t' to 'blpapi_Float32_t', possible loss of data
blpapi/internals_wrap.cxx(16170) : warning C4244: '=' : conversion from 'Py_ssiz
e_t' to 'unsigned int', possible loss of data
blpapi/internals_wrap.cxx(16246) : error C2664: 'blpapi_ServiceRegistrationOptio
ns_getGroupId' : cannot convert parameter 2 from 'const char *' to 'char *'
        Conversion loses qualifiers
error: command 'cl.exe' failed with exit status 2

I have been fighting this compilation battle for 2 days. I have uninstalled all the C compilers, re-installed them. Uninstalled Anaconda Python, re-installed bog-standard Python 64 clean (directories erased in between). Re-installed the Bloomberg API. Basically tried to get my machine as clean as possible before starting from clean. No joy.

Anybody done this? Am I missing something in the above?

Googling around I have heard a lot about vcvarsall.bat and how you're supposed to copy it to a vcvarsall amd64 file, but I am led to understand that this is not necessary if you run the steps above from the SDK3.5 command line (namely set the correct environment variables so that the correct 64 bit compiler will be used), which I believe I successfully did. I do not think the problem is there.


UPDATE

There is a bug in the Python code posted on the terminal's WAPI page (version 3.5.2). Instead use the one on the website (3.5.5). Compiles to 64 bit no problems, using the recipe above.

Community
  • 1
  • 1
Thomas Browne
  • 23,824
  • 32
  • 78
  • 121
  • Are you sure that those APIs are anyhow meant to work with x64 Python? – Zaur Nasibov Feb 10 '14 at 08:57
  • Yes. This is the response from Bloomberg help desk when I asked a few weeks ago: "There currently is no binary installer for Python 64-bit. Only 32-bit. You would have to compile yourself, by downloading the C++ API SDK and the Python API SDK. You will need a 64-bit Visual C++ compiler and Python 2.6/2.7 (64-bit)". Additionally, I am relaying your request to the relevant product manager so that the details of your request are seen by the appropriate parties. However, they are unfortunately not in the office today, so I am unable to communicate the request directly at this time." – Thomas Browne Feb 10 '14 at 10:07
  • I think I followed what they said to the letter. – Thomas Browne Feb 10 '14 at 10:08

0 Answers0