microsoft / BatteryML

MIT License
516 stars 109 forks source link

How to use `batteryml` command line tool in Windows? #21

Closed yunqi90 closed 1 year ago

yunqi90 commented 1 year ago

Download the raw data and run the two commands used in the preprocessing script: I type in the Command Prompt and it says 'batteryml' is not recognized as an internal or external command, operable program or batch file. Entering in Windows PowerShell executes successfully but without any action and result. Just skipped it. What is the problem?

fingertap commented 1 year ago

We did not test our tool in Windows. The command batteryml is installed by Python using the setup.py. Can you provide more information of how you install the package and your Python environment?

yunqi90 commented 1 year ago

Hello, where do you enter the command specifically? I entered it in CMD in Windows. image image

fingertap commented 1 year ago

You should use windows powershell and use batteryml instead of BatteryML. The command line is case-sensitive. Also, make sure your python environment is in PATH.

yunqi90 commented 1 year ago

Uppercase and lowercase have the same effect and have no effect. The path has also been added to the system variables. image

fingertap commented 1 year ago

Can you share the output of echo %PATH% in the command prompt? Make sure that the Scripts folder is in your PATH, which holds the custom scripts installed using setup.py.

christosiraklis commented 1 year ago

Same problem here. Working on Windows 10. I have found the batteryml file in the bin folder as well as in my python environment folder. I have tried using both Paths but none worked. Any solution?

fingertap commented 1 year ago

This error indicates the script batteryml is not found. I will test on Windows 10. Please stay tuned.

fingertap commented 1 year ago

After some investigation, I made this work under Windows. The cause was the setup.py. We initially depended on the shebang line, e.g. #!/usr/bin/python, in bin/batteryml to work in Linux. Under Windows, pip cannot determine the correct entry point for this script. I got two solutions to this issue.

  1. (Quick) Use bash under windows. For example, if you installed git, there may be a Git Bash, which you may find in your option menu after right click.
  2. I will create a PR later to fully address this issue. The key is to use entry_points in setup.py.
fingertap commented 1 year ago

23 should address this issue.

fingertap commented 1 year ago

Close this as #23 is merged. Feel free to reopen this if any further problems encountered.