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 0 0 0

No Module named 'requests'

Hi all, I am hoping for a little help. In Visual Studio I am running some code and am getting an error with import requests, when I run the code, it tells me no module named 'requests'. However, if I run the same code in Jupyter notebook it works fine. I have run pip install requests in my environment and it is already satisfied. Any ideas on why it would work in one notebook vs. the other?
eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apirequest
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.

Unlocking this post, since it does not contain any confidential information.

Upvotes
Accepted
1 0 0 0

0 Like Reply Share

More...


Initially I used pip install requests within VS. The request came back, all requirements satisfied. I restarted VS with a new terminal and tried pip install requests again. This time it installed requests and then everything worked fine.

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
18.2k 21 13 21

Hi @milan.hedstrom

I have never used Visual Studio but from your question, it seems to be a Visual Studio environment issue.

So I google "visual studio pip install python" and I got this url,

https://docs.microsoft.com/en-us/visualstudio/python/tutorial-working-with-python-in-visual-studio-step-05-installing-packages?view=vs-2019

Hope this help.

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
25.3k 87 12 25

Hi @milan.hedstrom

I had similar issues myself when I was trying out VS and for me, it was as explained in the link above - my VS and Jupyter were using different Python environments.

the missing package was installed in the Jupyter used env but not in the VS env

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, I had that thought as well. I then opened a terminal within VS and did pip install requests and it comes up as already satisfied...

Upvotes
1 0 0 0

it is working now, I have figured it out. Many thanks for the replies.

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 @milan.hedstrom

Any chance you can share how you fixed it and then accept your own answer as the solution - could help others in the future with the same dilemma?

Thanks

Initially I used pip install requests within VS. The request came back, all requirements satisfied. I restarted VS with a new terminal and tried pip install requests again. This time it installed requests and then everything worked fine.

Upvotes
1 0 0 0

The "ImportError: No module named requests" error occurs when you try to import the "requests" module in Python, but it's not installed in your environment. To fix this, you should install the "requests" library using pip, a package manager for Python. Open your command prompt or terminal and run the command "pip install requests." This will download and install the "requests" module, allowing you to use it in your Python scripts. Ensure that pip is properly installed and configured in your Python environment before running the installation command.



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.