esp-idf: Fail to install on mac OS (IDFGH-1808)
Using latest master(a7e8d87d3e5ccc9e5ffcd701a1bac587ba4f43ea), install.sh fails with:
$ ./install.sh
Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, esp32ulp-elf, openocd-esp32
Skipping xtensa-esp32-elf@esp32-2019r1-8.2.0 (already installed)
Skipping esp32ulp-elf@2.28.51.20170517 (already installed)
Skipping openocd-esp32@v0.10.0-esp32-20190708 (already installed)
Installing Python environment and packages
fatal: The empty string is not a valid path
Traceback (most recent call last):
File "/Users/cyril/esp/esp-idf/tools/idf_tools.py", line 1317, in <module>
main(sys.argv[1:])
File "/Users/cyril/esp/esp-idf/tools/idf_tools.py", line 1313, in main
action_func(args)
File "/Users/cyril/esp/esp-idf/tools/idf_tools.py", line 1112, in action_install_python_env
idf_python_env_path, _, virtualenv_python = get_python_env_path()
File "/Users/cyril/esp/esp-idf/tools/idf_tools.py", line 813, in get_python_env_path
idf_version_str = subprocess.check_output(['git', '--work-tree=', global_idf_path, 'describe', '--tags'], cwd=global_idf_path, env=os.environ).decode()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['git', '--work-tree=', '/Users/cyril/esp/esp-idf', 'describe', '--tags']' returned non-zero exit status 128
Please notice that -C is not a valid command for git (you need the generic --work-tree=). I’ve replaced ${IDF_PATH}/tools/idf_tools.py with this:
diff --git a/tools/idf_tools.py b/tools/idf_tools.py
index 3d23412..ef292cf 100755
--- a/tools/idf_tools.py
+++ b/tools/idf_tools.py
@@ -810,7 +810,7 @@ def get_python_env_path():
with open(version_file_path, "r") as version_file:
idf_version_str = version_file.read()
else:
- idf_version_str = subprocess.check_output(['git', '-C', global_idf_path, 'describe', '--tags'], cwd=global_idf_path, env=os.environ).decode()
+ idf_version_str = subprocess.check_output(['git', '--work-tree=' + global_idf_path, 'describe', '--tags'], cwd=global_idf_path, env=os.environ).decode()
match = re.match(r'^v([0-9]+\.[0-9]+).*', idf_version_str)
idf_version = match.group(1)
And it passed.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (9 by maintainers)
Commits related to this issue
- Git on macos does not have -C option, use correct option Fix #4018 — committed to X-Ryl669/esp-idf by X-Ryl669 5 years ago
- Git on macos does not have -C option, use correct option Fix #4018 — committed to X-Ryl669/esp-idf by X-Ryl669 5 years ago
- idf_tools.py: pass --work-tree instead of -C option to git Older versions of git do not support -C option. Use --work-tree option instead. Closes https://github.com/espressif/esp-idf/issues/4018 Mer... — committed to espressif/esp-idf by X-Ryl669 5 years ago
I had this error even though pip was installed. This resolved the issue for me,
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.pypython get-pip.pyI’ve managed to get it to work by adding a IDF_PATH=~/esp/esp-idf into my user profile.
I’ve followed this step-by-step, more than once and get the same error:
quentinb@Quentins-MacBook-Pro-2 esp-idf % . ./export.sh Adding ESP-IDF tools to PATH... fatal: not a git repository (or any of the parent directories): .git Traceback (most recent call last): File "/Users/quentinb/.espressif/tools/idf_tools.py", line 1349, in <module> main(sys.argv[1:]) File "/Users/quentinb/.espressif/tools/idf_tools.py", line 1345, in main action_func(args) File "/Users/quentinb/.espressif/tools/idf_tools.py", line 980, in action_export idf_python_env_path, idf_python_export_path, virtualenv_python = get_python_env_path() File "/Users/quentinb/.espressif/tools/idf_tools.py", line 840, in get_python_env_path idf_version_str = subprocess.check_output(['git', '--work-tree=' + global_idf_path, 'describe', '--tags'], cwd=global_idf_path, env=os.environ).decode() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 223, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '['git', '--work-tree=/Users/quentinb/.espressif', 'describe', '--tags']' returned non-zero exit status 128running the command works though:
quentinb@Quentins-MacBook-Pro-2 esp-idf % git --work-tree=/Users/quentinb/.espressif describe --tags v4.1-dev-1086-g93a8603c5