conda-lock icon indicating copy to clipboard operation
conda-lock copied to clipboard

Trying to install private GitHub repo as pip package.

Open seanyboi opened this issue 2 years ago • 6 comments

Hi there,

I am trying to perform conda lock -p osx-64 -p osx-arm64 -p linux-64 -p linux-aarch64 -f environment.yml --filename-template 'x-{platform}.lock' with an evironment.yml file like so that contains a private pip package hosted in a private GitHub repo:

name: xxxx
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.9
  - scikit-learn=1.0.0
  - pip
  - boto3
  - slackclient
  - conda-lock
  - pip:
    - git+ssh://[email protected]/xxxxxxxxxx
    - pytz

But I get the error pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'+ssh://g'": Expected string_end.

I can easily install the private repo by running the normal conda env create --prefix ./env -f environment.yml. So just wondering what I'm doing wrong here :)

seanyboi avatar Jun 01 '22 12:06 seanyboi

possibly relating to this issue here: 187

seanyboi avatar Jun 01 '22 13:06 seanyboi

FWIW, I've found something of a workaround for now. An example from my own code:

dependencies:
  - python
  - pip:
      - pymatbridge @ https://github.com/arokem/python-matlab-bridge/archive/51c0e79aa6ecb9ae11d02ad367c1bfa0b27c2caa.zip#sha256=

The package @ url form (https://pip.pypa.io/en/stable/reference/requirement-specifiers/) seems to be key. Note that it only seems to work with zips or tarballs, not git specifiers (does that even work with private repos?). The md5 or sha256 key must also be present but seems not to be checked. Not sure if the package's dependencies will be locked with this approach.

A lot of disclaimers, as you see. :)

ovidner avatar Jun 09 '22 15:06 ovidner

Requesting this as well. We're using conda-lock and would love to be able to easily manage our private pip dependencies with it 👍

nealstewart avatar Jul 11 '22 12:07 nealstewart

As @ovidner alluded to, this is not only an issue with private repos; it seems to affect all pip packages installed through git.

zmbc avatar Jul 22 '22 20:07 zmbc

I ran into exactly the same problem

emsrc avatar Aug 05 '22 11:08 emsrc

Support for git+x:// pip specifications was mentioned in #4 which is marked as complete, but that was either not implemented or has broken since. Would be great to be able to use git+https://, etc!

srstsavage avatar Sep 14 '22 21:09 srstsavage