Search code examples
pythongithubimportpip

Why can I not pip install this one specific github project when others work fine?


I want to use this github project as a library in my own project: https://github.com/cubrink/Toornament.com-API

I tried py -3.8 -m pip install git+https://github.com/cubrink/Toornament.com-API.git but I get the following output:

Collecting git+https://github.com/cubrink/Toornament.com-API.git
  Cloning https://github.com/cubrink/Toornament.com-API.git to c:\users\oliver\appdata\local\temp\pip-req-build-5s91hvbw
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\Oliver\AppData\Local\Programs\Python\Python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Oliver\\AppData\\Local\\Temp\\pip-req-build-5s91hvbw\\setup.py'"'"'; __file__='"'"'C:\\Users\\Oliver\\AppData\\Local\\Temp\\pip-req-build-5s91hvbw\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Oliver\AppData\Local\Temp\pip-pip-egg-info-lk3f8w3n'
         cwd: C:\Users\Oliver\AppData\Local\Temp\pip-req-build-5s91hvbw\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Oliver\AppData\Local\Programs\Python\Python38\lib\tokenize.py", line 392, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Oliver\\AppData\\Local\\Temp\\pip-req-build-5s91hvbw\\setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I have also tried py -3.8 -m pip install git+ssh://[email protected]:cubrink/Toornament.com-API.git but I get this output:

Collecting git+ssh://****@github.com:cubrink/Toornament.com-API.git
  Cloning ssh://****@github.com:cubrink/Toornament.com-API.git to c:\users\oliver\appdata\local\temp\pip-req-build-p71m2041
ERROR: Command errored out with exit status 128: git clone -q 'ssh://****@github.com:cubrink/Toornament.com-API.git' 'C:\Users\Oliver\AppData\Local\Temp\pip-req-build-p71m2041' Check the logs for full command output.

I can successfully install other github projects like this - but not the one I want to use. I have a feeling the "." period sign in the project name "Toornament.com-API" could cause problems but I am not sure.

Am I missing something? Is there another way I can import this as a library in my own project? Including it as a submodule seems like a bad workaround and a bit of an overkill for what I'm trying to do.


Solution

  • You can't "install" that repo with pip because it's lacking a setup.py file. https://packaging.python.org/tutorials/packaging-projects/

    A workaround would be cloning the code and using it more manually. Best practice in this case would be treating it as a submodule within your own repo. https://git-scm.com/book/en/v2/Git-Tools-Submodules