0

So I know this is nearly a duplicate of this ImportError question, but I'm not sure how to use those answers to fix this problem. I installed yahoo-fin package using my conda prompt:

pip install yahoo-fin

So clearly it is installed as Eclipse seems to recognize the package and I can even use cntl-space to autocomplete and F3 to explore the package. However, when I try to run

from yahoo_fin.stock_info import get_data

I get "ImportError: No module named stock_info".

From the SE question above I checked the init.py in the directory and it definitely has the CRLF problem, but even when I use notepad++ to replace "\r\n" with "\n" I still get the same error.

enter image description here

What am I missing?

rhaskett
  • 1,864
  • 3
  • 29
  • 48

1 Answers1

1

Are you able to load the package without using Eclipse? I would try running Python from the command line, and then typing:

from yahoo_fin.stock_info import get_data

to see if that still gives you an error. If it still gives you an error, then we know it's not an Eclipse issue. However, if it does work, then it's probably an issue with Eclipse. In that case, I would maybe look at this other post: How To Make Eclipse Pydev Plugin Recognize Newly Installed Python Modules?.

Please let me know if that helps.

atreadw
  • 289
  • 2
  • 6
  • Interesting. So I can run "from yahoo_fin.stock_info import get_data" in the Anaconda Prompt when in the python environment there, but it still fails in Eclipse. The solutions presented in your link removing and reinstalling the interpreter didn't work unfortunately. Neither did the "Check if interpreters are synchronized with environment". The oddest thing is when I removed the interpreter and tried either "Auto Config" button that didn't detect the Anaconda/envs. Maybe some weird interaction between Anaconda secondary environments and Eclipse? – rhaskett Jan 16 '18 at 03:20
  • Could be. I work more with Anaconda than Eclipse. Have you checked this other link out? https://stackoverflow.com/questions/6070423/adding-python-modules-to-pydev-in-eclipse-results-in-import-error. It looks like some others were having a similar problem. – atreadw Jan 16 '18 at 12:34
  • Yeah, the site-packages directory was already there and the other answers didn't help. I'd like to be able to do this in Eclipse, but it is pretty byzantine. I'll just use Anaconda to gather the data and Eclipse for the full project thanks. – rhaskett Jan 17 '18 at 01:19