Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to install on mac OS (IDFGH-1808) #4018

Closed
X-Ryl669 opened this issue Sep 4, 2019 · 18 comments
Closed

Fail to install on mac OS (IDFGH-1808) #4018

X-Ryl669 opened this issue Sep 4, 2019 · 18 comments

Comments

@X-Ryl669
Copy link
Contributor

X-Ryl669 commented Sep 4, 2019

Using latest master(a7e8d87), 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.

@github-actions github-actions bot changed the title Fail to install on mac OS Fail to install on mac OS (IDFGH-1808) Sep 4, 2019
X-Ryl669 added a commit to X-Ryl669/esp-idf that referenced this issue Sep 4, 2019
X-Ryl669 added a commit to X-Ryl669/esp-idf that referenced this issue Sep 4, 2019
@Alvin1Zhang
Copy link
Collaborator

@X-Ryl669 Thanks for reporting. Would you please help provide more details as suggested in the issue template? Information like elf, sdk configuration, backtrace, log outputs, commit ID, hardware and etc. would help us debug further. Thanks.

@X-Ryl669
Copy link
Contributor Author

X-Ryl669 commented Sep 5, 2019

Se #4017

@OpenEDF
Copy link

OpenEDF commented Sep 8, 2019

I'm sorry. According to the method you provided, I did not get the correct result and running "./install.sh" still has an error.
`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: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File "/home/macro/esp/esp-idf-master/tools/idf_tools.py", line 1320, in
main(sys.argv[1:])
File "/home/macro/esp/esp-idf-master/tools/idf_tools.py", line 1316, in main
action_func(args)
File "/home/macro/esp/esp-idf-master/tools/idf_tools.py", line 1115, in action_install_python_env
idf_python_env_path, _, virtualenv_python = get_python_env_path()
File "/home/macro/esp/esp-idf-master/tools/idf_tools.py", line 815, 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 "/usr/lib/python2.7/subprocess.py", line 223, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['git', '--work-tree=/home/macro/esp/esp-idf-master', 'describe', '--tags']' returned non-zero exit status 128‘
I would be grateful if you could provide a more detailed solution to this problem.

@igrr
Copy link
Member

igrr commented Sep 8, 2019

@makermuyi, Have you downloaded ESP-IDF as a .zip archive from GitHub and extracted it? This will not work, you need to use Git to clone the repository. Please refer to the steps in the Getting Started guide: https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html#installation-step-by-step

@gabrielantao
Copy link

gabrielantao commented Sep 8, 2019

I followed exactly all the steps described there, but I got this same problem. I'm trying to install on Linux Mint 17.3

@X-Ryl669
Copy link
Contributor Author

X-Ryl669 commented Sep 8, 2019

You must clone the repository (via git clone). If you do so, you'll not get this error:

fatal: not a git repository (or any of the parent directories): .git

@gabrielantao : Please report the error you get exactly.

@gabrielantao
Copy link

@X-Ryl669 I tested those steps here on Ubuntu 18.04 and it worked fine. I got this when I try step 3 when I try on Mint.

gabrielantao@gabriel-antao ~/esp/esp-idf $ ./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
Installing Python packages from /home/gabrielantao/esp/esp-idf/requirements.txt
/home/gabrielantao/.espressif/python_env/idf4.1_py2.7_env/bin/python: No module named pip
Traceback (most recent call last):
File "/home/gabrielantao/esp/esp-idf/tools/idf_tools.py", line 1317, in
main(sys.argv[1:])
File "/home/gabrielantao/esp/esp-idf/tools/idf_tools.py", line 1313, in main
action_func(args)
File "/home/gabrielantao/esp/esp-idf/tools/idf_tools.py", line 1136, in action_install_python_env
subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr)
File "/home/gabrielantao/anaconda2/lib/python2.7/subprocess.py", line 190, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/gabrielantao/.espressif/python_env/idf4.1_py2.7_env/bin/python', '-m', 'pip', 'install', '--no-warn-script-location', '-r', '/home/gabrielantao/esp/esp-idf/requirements.txt']' returned non-zero exit status 1

@X-Ryl669
Copy link
Contributor Author

X-Ryl669 commented Sep 9, 2019

Python error trace are a real pain to decipher. But here, the line that's important is:

/home/gabrielantao/.espressif/python_env/idf4.1_py2.7_env/bin/python: No module named pip

This is not related to this bug. You'd install pip apt-get install pip or port install pip if you are on a Mac

@OpenEDF
Copy link

OpenEDF commented Sep 16, 2019

This problem is caused by the use of macOS.

@X-Ryl669
Copy link
Contributor Author

As the title said?

@igrr
Copy link
Member

igrr commented Sep 16, 2019

@X-Ryl669 what is the version of git when this error happened?

@X-Ryl669
Copy link
Contributor Author

I'll tell you later today. In all cases, --work-tree is working on all versions (it is what you intended, that is, ask git to extract the description of a given work tree) while -C is relatively new and not your intention (it's a base directory that's prependded to all other directory-based optionn like work-tree or git-dir). I'd say that the fact it is working initially is pure luck that git use that path for looking its .git subdirectory instead of $PWD.

@X-Ryl669
Copy link
Contributor Author

git version 1.8.3.4

@igrr igrr closed this as completed in 81ffc87 Sep 30, 2019
igrr pushed a commit that referenced this issue Oct 27, 2019
Older versions of git do not support -C option. Use --work-tree option
instead.

Closes #4018
Merges #4019
@Quentinb
Copy link

Quentinb commented Dec 13, 2019

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 128

running the command works though:
quentinb@Quentins-MacBook-Pro-2 esp-idf % git --work-tree=/Users/quentinb/.espressif describe --tags v4.1-dev-1086-g93a8603c5

@igrr
Copy link
Member

igrr commented Dec 13, 2019

@Quentinb please check that your ESP-IDF directory is a valid Git repository. Does running git describe --tags --always in the ESP-IDF repository show an error? If it does, please make sure that you have downloaded ESP-IDF as explained in the Getting Started guide (git clone --recursive https://github.com/espressif/esp-idf.git).

@Quentinb
Copy link

I've managed to get it to work by adding a IDF_PATH=~/esp/esp-idf into my user profile.

@trentmillar
Copy link

Python error trace are a real pain to decipher. But here, the line that's important is:

/home/gabrielantao/.espressif/python_env/idf4.1_py2.7_env/bin/python: No module named pip

This is not related to this bug. You'd install pip apt-get install pip or port install pip if you are on a Mac

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.py
python get-pip.py

@0mars
Copy link

0mars commented Jun 28, 2020

this worked for me

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
/Users/xxxxx/.espressif/python_env/idf3.3_py2.7_env/bin/python get-pip.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants