microsoft / BatteryML

MIT License
480 stars 101 forks source link

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

Closed yunqi90 closed 9 months ago

yunqi90 commented 10 months 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 10 months 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 10 months ago

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

fingertap commented 10 months 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 10 months 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 9 months 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 9 months 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 9 months ago

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

fingertap commented 9 months 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 9 months ago

23 should address this issue.

fingertap commented 9 months ago

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