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

Question:

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:usersoliverappdatalocaltemppip-req-build-5s91hvbw
    ERROR: Command errored out with exit status 1:
     command: 'C:UsersOliverAppDataLocalProgramsPythonPython38python.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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:UsersOliverAppDataLocalTemppip-pip-egg-info-lk3f8w3n'
         cwd: C:UsersOliverAppDataLocalTemppip-req-build-5s91hvbw
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersOliverAppDataLocalProgramsPythonPython38libtokenize.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:usersoliverappdatalocaltemppip-req-build-p71m2041
ERROR: Command errored out with exit status 128: git clone -q 'ssh://****@github.com:cubrink/Toornament.com-API.git' 'C:UsersOliverAppDataLocalTemppip-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.

Asked By: olpohl

||

Answers:

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

Answered By: effprime

As @effprime says, it’s missing a setup.py file

Adding the repo as a submodule works, but pollutes your repository and is annoying if you want to use this dependency in multiple projects.
Which you’ve since added to your question

Including it as a submodule seems like a bad workaround and a bit of an overkill for what I’m trying to do

You can easily fork the repository, commit a minimal setup.py yourself and pip install from your fork

from setuptools import setup, find_packages

setup(name='tourny',
      version='0.1.0',
      packages=find_packages())
Answered By: Robbie
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.