Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 1 1 3

ModuleNotFoundError: No module named 'eikon'

I'm currently following the quick guides for setting up the API, and I have ran into a small issue that I can't figure out. I would be very grateful if I can get some help resolving this.

This is the code I'm running, which is just from the guide:
1650635318265.png


Here's the full terminal output:

(base) PS C:\Users\user\Miniconda3\envs\refinitiv>  & 'C:\Users\user\Miniconda3\envs\refinitiv\python.exe' 'c:\Users\user\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy\launcher' '57854' '--' 'c:\Users\user\Miniconda3\envs\refinitiv\APItest2.py'
Traceback (most recent call last):
  File "C:\Users\user\Miniconda3\envs\refinitiv\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\user\Miniconda3\envs\refinitiv\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\Users\user\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
    cli.main()
  File "c:\Users\user\.vscode\extensions\ms-python.python-2022.4.1\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
    run()
\server\cli.py", line 285, in run_file
     runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
  File "C:\Users\user\Miniconda3\envs\refinitiv\lib\runpy.py", line 269, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "C:\Users\user\Miniconda3\envs\refinitiv\lib\runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "C:\Users\user\Miniconda3\envs\refinitiv\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "c:\Users\user\Miniconda3\envs\refinitiv\APItest2.py", line 1, in <module>
    import eikon as ek
ModuleNotFoundError: No module named 'eikon'


Here's the result of 'pip list' in the same directory:

Package                Version
---------------------- ---------
anyio                  3.5.0
appdirs                1.4.4
argon2-cffi            21.3.0
argon2-cffi-bindings   21.2.0
asttokens              2.0.5
attrs                  21.4.0
backcall               0.2.0
beautifulsoup4         4.10.0
bleach                 4.1.0
Bottleneck             1.3.4
brotlipy               0.7.0
certifi                2021.10.8
cffi                   1.15.0
chardet                3.0.4
charset-normalizer     2.0.4
colorama               0.4.4
conda                  4.12.0
conda-package-handling 1.8.1
cryptography           36.0.0
cycler                 0.11.0
DateTime               4.4
debugpy                1.5.1
decorator              5.1.1
defusedxml             0.7.1
deprecation            2.1.0
eikon                  1.1.14
entrypoints            0.4
executing              0.8.3
fastjsonschema         2.15.1
fonttools              4.25.0
h11                    0.12.0
h2                     3.2.0
hpack                  3.0.0
httpcore               0.14.7
httpx                  0.22.0
hyperframe             5.2.0
idna                   2.10
ipykernel              6.9.1
ipython                8.2.0
ipython-genutils       0.2.0
ipywidgets             7.6.5
jedi                   0.18.1
Jinja2                 3.0.3
jsonschema             4.4.0
jupyter                1.0.0
jupyter-client         7.1.2
jupyter-console        6.4.3
jupyter-core           4.9.2
jupyterlab-pygments    0.1.2
jupyterlab-widgets     1.0.0
kiwisolver             1.3.2
MarkupSafe             2.0.1
matplotlib             3.5.1
matplotlib-inline      0.1.2
menuinst               1.4.18
mistune                0.8.4
mkl-fft                1.3.1
mkl-random             1.2.2
mkl-service            2.4.0
munkres                1.1.4
nbclient               0.5.11
nbconvert              6.4.4
nbformat               5.3.0
nest-asyncio           1.5.5
notebook               6.4.8
numexpr                2.8.1
numpy                  1.21.5
packaging              21.3
pandas                 1.4.1
pandocfilters          1.5.0
parso                  0.8.3
pickleshare            0.7.5
Pillow                 9.0.1
pip                    21.2.4
prometheus-client      0.13.1
prompt-toolkit         3.0.20
pure-eval              0.2.2
pycosat                0.6.3
pycparser              2.21
Pygments               2.11.2
pyOpenSSL              22.0.0
pyparsing              3.0.4
pyrsistent             0.18.0
PySocks                1.7.1
python-dateutil        2.8.2
pytz                   2021.3
pywin32                302
pywinpty               2.0.2
pyzmq                  22.3.0
qtconsole              5.3.0
QtPy                   2.0.1
requests               2.27.1
rfc3986                1.5.0
ruamel-yaml-conda      0.15.100
Send2Trash             1.8.0
setuptools             61.2.0
sip                    4.19.13
six                    1.16.0
sniffio                1.2.0
soupsieve              2.3.1
stack-data             0.2.0
terminado              0.13.1
testpath               0.5.0
tornado                6.1
tqdm                   4.63.0
traitlets              5.1.1
typing_extensions      4.1.1
urllib3                1.26.8
wcwidth                0.2.5
webencodings           0.5.1
websocket-client       1.3.2
wheel                  0.37.1
widgetsnbextension     3.5.2
win-inet-pton          1.1.0
wincertstore           0.2
zope.interface         5.4.0
apipython apierror
1650635318265.png (38.6 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.

Hi @nathen.gildow,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.


Thanks,

AHS

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

Thanks,
AHS

Upvotes
Accepted
24.7k 54 17 14

Hello @nathen.gildow

I noticed that your active Conda is the base environment but your code is in the refinitiv environment.

conda-logs.png

Which Conda environment you have installed the Eikon Data API? If you have installed Eikon Data API library in the refinitiv environment, please change the active Conda environment to be refinitiv and re-test.

(base) $> conda activate refinitiv
(refinitive) $> python APITest2.py

You can press the F1 button and select the "Python: Select Interpreter" option to choose the Conda's refinitiv environment in VS Code.

conda-vs-code.png



conda-logs.png (34.6 KiB)
conda-vs-code.png (23.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.

Upvotes
5.8k 21 2 6

Hi @nathen.gildow, May I ask if you've tried (i) uninstalling and re-installing the eikon data API? (ii) trying out the refinitiv data platform python library which allows for the same get_data function or (iii) using another version of eikon data api (==1.1.13)?

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.

Thanks for the response Jonathan!

(i) uninstalling and re-installing the eikon data API?
- Tried this with no success already.

(ii) trying out the refinitiv data platform python library which allows for the same get_data function.
- I’m not exactly sure what this means or how to do it. This is the first time I’ve set up an API, so I may need detailed instructions.

(iii) using another version of eikon data api (==1.1.13).
- I’m unsure of how to do this as well.

Upvotes
1.3k 3 2 4

Hi @nathen.gildow ,

To be sure you're using same Python environment with your script and your terminal, you should check python version :

1. in your script with

import sys
print(sys.version)

2. in your shell with

>python -c "import sys; print(sys.version)"

Then compare results.

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.

Thanks for the response pf, both the script and terminal python versions show 3.10.4

Upvotes
79.2k 251 52 74

@nathen.gildow

You can run help('modules') before importing eikon to list all available modules in the current environment.

help('modules')
import eikon as ek

Then, check if there is an eikon module installed.

1650860251743.png


1650860251743.png (26.3 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.

Okay, this seems to be the issue! I don't see eikon in my list. What do I need to do to resolve this?

Never mind, I was able to just run pip install again within the terminal in VScode. but now have received another error:


EikonError: Error code 401 | Eikon Proxy not running or cannot be reached. Please read the documentation on troubleshooting.

I've walked a bit through the troubleshooting document and have found that i cannot currently connect to http://localhost:9000/ping?all


Hello @nathen.gildow

Did you run the Eikon/Workspace desktop application? Please note that the Refinitiv Workspace/Eikon application integrates a Data API proxy that acts as an interface between the Eikon Data API Python library and the Eikon Data Platform. For this reason, the Refinitiv Workspace/Eikon application must be running when you use the Eikon Data API Python library.

Upvotes
1 1 1 3

This has been solved, thank you everyone!

I was unaware that you need to install eikon within the VScode python terminal as well.

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.

Hello @nathen.gildow

I think you can just switch the Python Env in VS Code from Base to the one that you have installed Eikon Data API.

You can find more detail in the following resources:

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.