Search code examples
pythongitpipenvpipenv-install

How to install a python package from repository with several packages?


Hello I have a repository with a folder called Packages and inside this several python packages with their setup and all needed configuration in order to installe it.

I can install it localy indicating the complete path to the package, but when I try to do the same from the repository I cannot.

How could I install one of that packages witht pipenv?

I tried the following:

pipenv install -e git+https://[email protected]/user/repo#egg=package

pipenv install -e git+https://[email protected]/user/repo/branch/path#egg=package

But dosen't work I got this error:

Error text: Obtaining socks-utils from git+https://****@github.com/............#egg=socks-utils
... has inconsistent name: filename has 'package', but metadata has 'UNKNOWN'

The token is correct I can clone it with that url in another folder.

Thanks


Solution

  • Quoting from the pip documentation:

    If your repository layout is:

    pkg_dir
    ├── setup.py  # setup.py for package "pkg"
    └── some_module.py
    other_dir
    └── some_file
    some_other_file
    

    Then, to install from this repository, the syntax would be:

    python -m pip install -e "vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir"
    

    Hence, you want:

    pipenv install -e "git+https://[email protected]/user/repo#egg=package&subdirectory=path"