Installing module from GitHub through Jupyter notebook

My first time trying to install something from GitHub, but couldn't find a simple solution after searching here and on google.

I'm using Jupyter notebook and trying to install this module:

https://github.com/Expt-David/NumSchrodingerEq

i've tried to write this inside the notebook:

!pip install git+git://github.com/Expt-David/NumSchrodingerEq.git

but i'm getting the following error:

Collecting git+git://github.com/Expt-David/NumSchrodingerEq.git
  Cloning git://github.com/Expt-David/NumSchrodingerEq.git to c:\users\greatg~1\appdata\local\temp\pip-1w_dpw43-build
  Error [WinError 2] The system cannot find the file specified while executing command git clone -q git://github.com/Expt-David/NumSchrodingerEq.git C:\Users\GREATG~1\AppData\Local\Temp\pip-1w_dpw43-build
Cannot find command 'git'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

EDIT

Seems that installing git again and manually delete the path and edit myself worked for that issue, but now i'm getting:

Collecting git+https://github.com/Expt-David/NumSchrodingerEq.git
  Cloning https://github.com/Expt-David/NumSchrodingerEq.git to c:\users\greatg~1\appdata\local\temp\pip-zpuki8tu-build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "d:\anaconda3\lib\tokenize.py", line 454, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\GREATG~1\\AppData\\Local\\Temp\\pip-zpuki8tu-build\\setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\GREATG~1\AppData\Local\Temp\pip-zpuki8tu-build\

And I have setuptools installed and updated.

What am I doing wrong ?

Thanks!


Solution 1:

Make sure you run your Jupyter Notebook from a session where PATH does include the path to your Git installation.

And check out pip issue 2109:

In my case the problem was the way I had the path to git defined in my path environment on windows.

the function find_command declared in pip.util fails in handle paths with quote, like:

PATH=...;c:\python27\scripts;"c:\Program Files\git\cmd";C:\Tcl\bin;...

when it appends the git.exe filename to check its existence it keeps the " symbol and the check fails.

That should be fixed in recent version of pip, but again, double-check your %PATH%.


If that still fails, try with a simplified path, and Git installed in a short PATH without space:

  • use the latest Git for Windows (uncompress Git 2.13 PortableGit-2.13.2-64-bit.7z.exe anywhere you want, for instance in C:\Git2.13.2)
  • set a simplified PATH.

Regarding the PATH issue, type (in a CMD):

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\Git2.13.2
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%

Add to that PATH what you need for python/pip.
Then try again.


For your second error message, consider "pip installation error “No such file or directory: setup.py”", and double-check your version of Python: pip is for python 2. pip3 is for python 3.