Search code examples
pythonpipcondaartifactorypypi

Can conda be configured to use a private pypi repo?


I have users that create both conda and pip packages- I have no control over this

I use artifactory to host private conda and pip repos, for example this is how a private pip repo works: https://www.jfrog.com/confluence/display/JFROG/PyPI+Repositories

Sometimes there is a private pip package a conda environment or package needs. How can I configure conda to get my private pip packages from my private repo?

I haven't found documentation on this. I would like for this to be transparent for users as much as possible- so they set up their config once and in their conda environment they can easily specify a private pip package and it just works


Solution

  • Conda won't search PyPI or alternative pip-compatible indexes automatically, but one can still use the --index-url or --extra-index-url flags when using pip install. E.g.,

    Ad Hoc Installation

    # activate environment
    conda activate foo
    
    # ensure it has `pip` installed
    conda list pip
    
    # install with `pip`
    pip install --extra-index-url http://localhost:8888 bar
    

    YAML-based environments

    foo.yaml

    name: foo
    channels:
      - defaults
    dependencies:
      - python
      - pip
      - pip:
        - --extra-index-url http://localhost:8888
        - bar
    

    Environment creation

    conda env create -f foo.yaml