ImportError: Bad git executable.
- Dominant language
- Python
- Stars
- 337
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I'm very knew to micropy, I may have missed something important, nut i'm struggling with creating a project'
**Context**
I use Vscode, I installed PyMaker (as told in this article : [link](https://lemariva.com/blog/2019/08/micropython-vsc-ide-intellisense))
I installed micropy-cli as explained in the article and README. The bug occurs when I try to search for stubs (see the article : `micropy stubs search esp32`) or when I try to creayte a micropy projet (see README : `micropy init `)
**Describe the bug**
The program tries to reach Github in Both situation and raises an errror I don't understand.
**Expected Behavior**
**Current Behavior**
First case : give a list of stubs
Second case : create a micropy project
**Steps to Reproduce**
1. Vscode (version 1.96)
2. Python 3.8.9 - pip 24.3.1
3. pip install --upgrade micropy-cli
4. `micropy`or `micropy ini testProject`or `micropy stubs search esp32`
**Possible Solution**
No Idea xC
**Logs**
```Traceback (most recent call last):
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\git\__init__.py", line 89, in
refresh()
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\git\__init__.py", line 76, in refresh
if not Git.refresh(path=path):
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\git\cmd.py", line 392, in refresh
raise ImportError(err)
ImportError: Bad git executable.
The git executable must be specified in one of the following ways:
- be included in your $PATH
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- explicitly set via git.refresh()
All git commands will error until this is rectified.
This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
- quiet|q|silence|s|none|n|0: for no warning or exception
- warn|w|warning|1: for a printed warning
- error|e|raise|r|2: for a raised exception
Example:
export GIT_PYTHON_REFRESH=quiet
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\bros2671\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\bros2671\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\bros2671\Documents\GitHub\Starget\.venv\Scripts\micropy.exe\__main__.py", line 4, in
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\micropy\__init__.py", line 18, in
from micropy.main import MicroPy
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\micropy\main.py", line 11, in
from micropy.project import Project, modules
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\micropy\project\__init__.py", line 3, in
from . import modules
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\micropy\project\modules\__init__.py", line 5, in
from .packages import DevPackagesModule, PackagesModule
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\micropy\project\modules\packages.py", line 10, in
from micropy.packages import (
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\micropy\packages\__init__.py", line 14, in
from .source_package import PackageDependencySource, VCSDependencySource
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\micropy\packages\source_package.py", line 6, in
from git import Repo
File "c:\users\bros2671\documents\github\starget\.venv\lib\site-packages\git\__init__.py", line 91, in
raise ImportError("Failed to initialize: {0}".format(exc)) from exc
ImportError: Failed to initialize: Bad git executable.
The git executable must be specified in one of the following ways:
- be included in your $PATH
- be set via $GIT_PYTHON_GIT_EXECUTABLE
- explicitly set via git.refresh()
All git commands will error until this is rectified.
This initial warning can be silenced or aggravated in the future by setting the
$GIT_PYTHON_REFRESH environment variable. Use one of the following values:
- quiet|q|silence|s|none|n|0: for no warning or exception
- warn|w|warning|1: for a printed warning
- error|e|raise|r|2: for a raised exception
Example:
export GIT_PYTHON_REFRESH=quiet
```
**Context (Environment)**
* OS: Windows 11 Education
* Micropy Version: 4.2.2
* Python Version: 3.8.9
* VSCode Version: 1.96
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing `micropy init` and `micropy stubs search esp32` in the reported Windows and Python environment. Read the traceback locations `micropy/project/modules/packages.py` and `micropy/packages/source_package.py`, then verify how the Git dependency is initialized. Done means the commands work with the documented setup or the failure clearly identifies the required Git configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100