Edward K. Ream
Edward K. Ream

Reputation: 189

Can't import on Windows/Anaconda

Windows 10, Anaconda 2 or 3

c:\leo.repo\leo-editor>c:\apps\Git\bin\git.exe --version

yields:

git version 2.8.2.windows.1

sys.path contains C:\apps\Git, C:\apps\Git\bin and C:\apps\Git\cmd, but I am getting the dreaded GitCommandNotFound exception. What am I doing wrong?

Executing:

from git import Repo

yields:

[snip]

File "c:\Anaconda3\lib\site-packages\git\cmd.py", line 602, in execute raise GitCommandNotFound(command, err)

git.exc.GitCommandNotFound: Cmd('git') not found due to: FileNotFoundError('[WinError 2] The system cannot find the file specified') cmdline: git version

Edward

Upvotes: 0

Views: 611

Answers (1)

Edward K. Ream
Edward K. Ream

Reputation: 189

It appears that installs are different on Anaconda.

Per this page the proper installation procedure is:

conda install -c conda-forge gitpython=2.1.1

Installation on Python 2 was straightforward.

Update: I had to add the following to sys.path for Python 3:

C:\Anaconda3\pkgs\gitdb-0.6.4-py35_1\Lib\site-packages

I have no idea why python 2 installs in site-packages as expected, while python 3 installs in the path shown above.

Update2: I also had to update the Windows PATH variable (not just sys.path) to point to the directory containing git.exe.

Upvotes: 0

Related Questions