question

Upvotes
Accepted
20 1 1 4

Error getting started with Reuters dataplatfom in Python

I am following this tutorial as best as I can: https://developers.refinitiv.com/en/article-catalog/article/getting-start-with-refinitiv-data-platform


I have installed Eikon like so:

pip install eikon


and I have installed Refinitiv dataplatform like so:

pip install refinitiv.dataplatform


and when running pip list I see the following installations (and many more)

pip list
Package                Version
---------------------- --------------
...
eikon                  1.1.14
...
refinitiv-dataplatform 1.0.0a11.post1
...


in this (miniconda) environment I launch jupyter notebook and run the following to commands in a notebook cell:

import eikon as ek
import refinitiv.dataplatform as rdp


which fails like this - sorry for the long traceback

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-8ef34ae7a676> in <module>
      1 import eikon as ek
----> 2 import refinitiv.dataplatform as rdp

~.conda\envs\rdptut\lib\site-packages\refinitiv\dataplatform\__init__.py in <module>
      7 
      8 from .errors import *
----> 9 from .core import *  # noqa
     10 from .content import *  # noqa
     11 from .delivery import *  # noqa

~.conda\envs\rdptut\lib\site-packages\refinitiv\dataplatform\core\__init__.py in <module>
      2 
      3 # from . import session
----> 4 from .session import Session  # noqa
      5 from .session import DesktopSession  # noqa
      6 from .session import PlatformSession  # noqa

~.conda\envs\rdptut\lib\site-packages\refinitiv\dataplatform\core\session\__init__.py in <module>
     10 # from . import global_settings
     11 
---> 12 from .session import *  # noqa
     13 from .grant_refresh import *  # noqa
     14 from .grant_password import *  # noqa

~.conda\envs\rdptut\lib\site-packages\refinitiv\dataplatform\core\session\session.py in <module>
     27 from refinitiv.dataplatform.tools._common import urljoin
     28 
---> 29 from refinitiv.dataplatform.delivery.stream.omm_stream_connection import (
     30     OMMStreamConnection,
     31 )

~.conda\envs\rdptut\lib\site-packages\refinitiv\dataplatform\delivery\__init__.py in <module>
      2 
      3 from .stream import *  # noqa
----> 4 from .data import *  # noqa
      5 
      6 del stream

~.conda\envs\rdptut\lib\site-packages\refinitiv\dataplatform\delivery\data\__init__.py in <module>
      3 # from ...tools import module_helper
      4 
----> 5 from .endpoint import Endpoint  # noqa
      6 
      7 # from .data_accessor import DataAccessor

~.conda\envs\rdptut\lib\site-packages\refinitiv\dataplatform\delivery\data\endpoint.py in <module>
     13 from refinitiv.dataplatform.tools._common import urljoin, get_response_reason
     14 from refinitiv.dataplatform.errors import EndpointError
---> 15 from refinitiv.dataplatform.legacy import get_default_session
     16 
     17 

~.conda\envs\rdptut\lib\site-packages\refinitiv\dataplatform\legacy\__init__.py in <module>
      1 # coding: utf-8
      2 
----> 3 from .data_grid import get_data, TR_Field  # noqa
      4 from .json_requests import send_json_request  # noqa
      5 from .news_request import get_news_headlines, get_news_story  # noqa

~.conda\envs\rdptut\lib\site-packages\refinitiv\dataplatform\legacy\data_grid.py in <module>
      5 import pandas as pd
      6 import numpy
----> 7 import refinitiv.dataplatform.legacy.json_requests
      8 from .tools import (
      9     get_json_value,

~.conda\envs\rdptut\lib\site-packages\refinitiv\dataplatform\legacy\json_requests.py in <module>
      6 import time
      7 
----> 8 import refinitiv.dataplatform.vendor.requests_async as requests
      9 
     10 from refinitiv.dataplatform.tools._common import get_response_reason

AttributeError: module 'refinitiv' has no attribute 'dataplatform'


If I keep the import Eikon line only, then it works, however as soon as I add the second line with the refinitiv.dataplatform import, then it fails with the above error message.


Any ideas or suggestions on what to check next would be appreciated - and apologies if this is a basic question, it's the first time I'm trying to use the API.


refinitiv-dataplatform-eikon
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

@henrik.karlsson

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Thank you for the follow-up Jirapong, yes, all satisfactory. Have a great holiday period!

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,
AHS

Upvote
Accepted
24.7k 54 17 14

Hello @henrik.karlsson

If you are using the Refinitiv Data Platform Libraries, the Python version of the libraries already has the Eikon Data API for you. You do not need to install the Eikon Data API separately.

Please find more detail regarding how to use the Eikon Data API module of the RDP Libraries from this thread.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
20 1 1 4

I changed my setup to using these versions:

pip list
Package                Version
---------------------- --------------
...
eikon                  1.1.14
...
refinitiv-dataplatform 1.0.0a8.post1
...


and after that it works. Not 100% sure why this happens, but at least the problem is solved for now.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
24.7k 54 17 14

Hello @henrik.karlsson

Additionally, I cannot replicate the issue in my environment with my local Jupyter Lab and Jupyter Notebook.

eikon-code.png

Note: I have installed Jupyter with the following command.

conda install -c conda-forge jupyterlab

eikon-code.png (67.0 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.