Conda and Miniconda
CloudRepo hosts Python packages rather than conda packages or a conda channel. A conda user installs them with pip inside the conda environment. This page shows how to do that without letting a package from PyPI replace one of yours.
Before you start
Section titled “Before you start”- A Python repository to install from and publish to. Creating a Repository shows how to make one.
- A repository token that reaches it, and Download and publish packages access if you will publish. Repository Tokens: Create One and Authenticate shows how to mint one. pip sends the email address of the account that minted it as the username, and the token as the password.
- conda or Miniconda, installed from conda’s own instructions.
Install private packages into an environment
Section titled “Install private packages into an environment”Make the environment with pip in it, activate it, and install your private packages from CloudRepo alone, in a pip step of their own. Anyone can publish a package on PyPI under your private package’s name, and a pip step that can also read PyPI may install theirs instead.
conda create --name myproject python=3.12 pipconda activate myprojectWrite requirements-private.txt as in
Install private and public packages together:
its first line names the CloudRepo index, and pip finds the login for the host in your ~/.netrc, which that page
also shows how to write, so the file stores no secret and can be committed. Then, with the environment active:
pip install -r requirements-private.txtEverything that applies to pip applies here, because the install is pip’s. Public packages go in a step of their
own (pip install -r requirements.txt, from PyPI), nothing in that step may depend on a private package, and
the public packages your private packages depend on go in requirements.txt too: the CloudRepo step does not look
for them on PyPI, and fails if one is missing. The full rules, the three-step order and what a hash file does are
on Python Repositories. If an earlier
setup put CloudRepo and PyPI together in pip.conf, pip config or PIP_EXTRA_INDEX_URL, remove that: every
pip install reads such a pair as one index.
Combine conda packages and private packages in environment.yml
Section titled “Combine conda packages and private packages in environment.yml”conda installs the pip: section of environment.yml with a single pip install that covers every line in
it. So keep that section for public packages, and install your private packages in the second step above,
after the environment exists. Do not put the CloudRepo URL or a token in environment.yml:
name: data-science-projectchannels: - conda-forgedependencies: - python=3.12 - numpy - pip - pip: - requestsconda env create --file environment.ymlconda activate data-science-projectpip install -r requirements-private.txtPublish from a conda environment
Section titled “Publish from a conda environment”Publishing is pip’s side again: install twine in the environment and upload with it, as in Publish Python packages to CloudRepo. A wheel built inside a conda environment is an ordinary wheel, and CloudRepo stores it like any other Python file.
When pip answers 401, 403 or 404
Section titled “When pip answers 401, 403 or 404”The step that reaches CloudRepo is the pip install -r requirements-private.txt above, so that is where a refused
token shows. pip does not print a 401 for a token it read from ~/.netrc. It asks who you are instead:
User for your-org.mycloudrepo.io:
A revoked or expired token does this, and so does a machine or login line that does not match. With no one at the
terminal to answer, as in CI, the install ends there with EOFError: EOF when reading a line.
The other messages are pip’s, and they mean what they mean outside conda: see Install Python packages from CloudRepo. If the CloudRepo step stops because a public package is missing, install that package in the public step first: the CloudRepo step does not look for it on PyPI.
See also Repository tokens, which covers the credential each client uses, and Python Repositories, which covers pip, twine and the Python repository settings.