-3

im trying to test Machine Learning codes from this site :https://github.com/lyuboraykov/flight-genie im really new to machine learning and im using windows.

i already installed the requirements to run the code (python, virtualenv, numpy, sklearn, scipy, etc) but i got stuck when i try to run the main code, it shows notification like this : enter image description here

please help, thanks

gilang
  • 15
  • 4
  • This question would be better if you showed the folder structure. I doubt this has anything to do with the specific code, just where python looks for modules. – kutschkem Mar 20 '18 at 12:03

3 Answers3

0

If you run a python script as

python dir_name/script.py

... then python will execute the file named script.py inside the folder dir_name. What will happen here is python program will go inside dir_name folder first and then run the script.
In your case if you type python flight_genie/main.py, it will go inside the folder flight_genie and will execute the file. Then python can't find a folder (actually the module) named flight_genie there because python program is already inside that folder. That's why you get this error.

So one way of fixing this issue is replacing all import flight_genie.xxxx with just import xxxx. (Also from flight_genie.xxxx import yyyy with from xxxx import yyyy)

But it is so time consuming if you have a large project. (And sometime it won't even work). So best way is to run the project as a whole module.
If you look at here you can see how to run python modules as scripts. You just have to type the following command in console.

python -m flight_genie.main

ps: I assume that you have python3 installed in windows and configured to run python3 when you type python in command line.

Ramesh-X
  • 4,853
  • 6
  • 46
  • 67
-1

Have you made installation steps described on author's page? I'm afraid that you didn't read this...

sh
# you have to have python 3 installed
pyenv env
source env/bin/activate
pip install -r requirements.txt
python flight_genie/main.py
Qex
  • 317
  • 1
  • 3
  • 9
  • i have, for some reason i cant install pyenv (i guess bcs im using windows) so i installed virtualenv instead – gilang Mar 20 '18 at 12:24
-1

Based on the error message I think your problem is with your import. I'm guessing it should be something like:

from flight import Flight

Instead of:

from flight_genie.flight import Flight

If that doesn't work try to post your code so we can try to find the problem.

paul41
  • 576
  • 7
  • 17