0

I would like to fetch some stocks data via the iexfinance API but can't get the package running.

I installed the iexfinance module (docu)

C:\Users\Jonas\Desktop\CFD\CFD>pip3 install iexfinance
Collecting iexfinance
  Using cached iexfinance-0.4.3-py3-none-any.whl (51 kB)
Installing collected packages: iexfinance
Successfully installed iexfinance-0.4.3

Started a seperate app 'feeder' for the API logic

C:\Users\Jonas\Desktop\CFD\CFD>py manage.py startapp feeder

Included it in my settings

INSTALLED_APPS = [

[...]

    # My Apps
    'calculator',
    'accounts',
    'feeder',
]

And created one first easy query:

from iexfinance.stocks import Stock

aapl = Stock("AAPL")
apple_price = aapl.get_price()
print(apple_price)

and get this error:

C:\Users\Jonas\AppData\Local\Programs\Python\Python38\python.exe C:/Users/Jonas/Desktop/CFD/CFD/feeder/feeder.py
Traceback (most recent call last):
  File "C:/Users/Jonas/Desktop/CFD/CFD/feeder/feeder.py", line 8, in <module>
    from iexfinance.stocks import Stock
ModuleNotFoundError: No module named 'iexfinance'

Process finished with exit code 1

My manage.py file links to the correct settings.py path.

What do i miss?

JSRB
  • 2,492
  • 1
  • 17
  • 48
  • your python version is not able to find iexfinance. try `pip install ...` instead of using pip3. Also, you can use a virtual environments in order to get rid of these kinds of issues. – shivankgtm May 12 '20 at 10:51
  • tried it with pip instead, still can't find the module. I don't use a virtualenv because I only work on one project in this environment which is already deployed live as well. hmh – JSRB May 12 '20 at 10:53
  • 1
    please see if this [help](https://stackoverflow.com/questions/45693420/python-modulenotfounderror-but-module-is-installed) – shivankgtm May 12 '20 at 11:10

1 Answers1

0

After struggling for hours, I found the -probably obvious- solution:

Check your IDEs project interpreter, if it is set to the correct python path, be it a virtualenv or not. Make sure that the module that can't be found is in the list of the packages shown in the interpreters overview within the IDE. Somehow pip installed the packages correctly, but the interpreter searched in the wrong directory for the packages.

enter image description here

JSRB
  • 2,492
  • 1
  • 17
  • 48