Conda & Miniconda Repositories
This section provides comprehensive documentation for using CloudRepo with Conda and Miniconda, the package and environment management systems widely used in data science, machine learning, and scientific computing.
Introduction to Conda
What is Conda?
Conda is a powerful, open-source package and environment management system that runs on Windows, macOS, and Linux. Originally developed for Python programs, Conda has evolved into a language-agnostic package manager that can install and manage packages from any language. Miniconda is a minimal installer that includes only Conda, Python, and their dependencies, providing a lightweight starting point for creating custom environments.
Conda’s Role in Scientific Python and Data Science
Conda has become the de facto standard in scientific computing and data science for several compelling reasons:
Binary package management: Unlike pip which primarily handles pure Python packages, Conda excels at managing complex binary dependencies including C/C++ libraries, CUDA toolkits, and system-level packages
Cross-language support: Seamlessly manages packages from Python, R, Julia, Scala, Java, JavaScript, C/C++, FORTRAN, and more
Environment isolation: Creates truly isolated environments with their own Python interpreters and system libraries
Reproducible science: Enables exact environment replication across different machines and operating systems
Optimized packages: Conda-forge and defaults channels provide pre-compiled, optimized binaries for scientific libraries like NumPy, SciPy, and TensorFlow
Dependency solver: Advanced SAT solver handles complex dependency graphs that often challenge pip
Why Teams Need Private Package Management
Data science and research teams increasingly require private package management for:
Proprietary algorithms: Protecting intellectual property in custom ML models and analysis tools
Internal libraries: Sharing data processing pipelines, feature engineering tools, and domain-specific utilities
Compliance and security: Maintaining control over package distribution in regulated industries (healthcare, finance, government)
Version control: Ensuring reproducibility of experiments and analyses across team members
Performance optimization: Distributing custom-compiled packages optimized for specific hardware
Data connectors: Securely sharing database connectors and API clients with embedded credentials
CloudRepo’s Conda Strategy
CloudRepo provides a comprehensive solution for Conda users through a two-phase approach:
- Currently Available: PyPI Integration
CloudRepo fully supports Python packages that can be installed in Conda environments using pip. This covers the majority of custom Python packages that data science teams develop, including pure Python libraries, data processing tools, and ML model packages.
- Coming Soon: Native Conda Channels
Native Conda channel support is on our near-term roadmap, which will enable hosting of conda packages with complex binary dependencies, multi-language packages, and custom-compiled scientific libraries. This positions CloudRepo as a complete alternative to Anaconda Enterprise and JFrog Artifactory for Conda users.
Prerequisites
Before configuring Conda to work with CloudRepo, ensure you have:
CloudRepo Account and Repository
An active CloudRepo organization account
A Python repository created in the CloudRepo Admin Portal
A repository user with appropriate permissions (read for downloading, write for uploading)
Note
Your admin user cannot access repositories directly for security reasons. Always create dedicated repository users in the CloudRepo Admin Portal.
For setup instructions, see:
Conda or Miniconda Installation
Conda (via Anaconda) or Miniconda installed on your system
Verify installation:
conda --version
Repository URL Format
Your CloudRepo PyPI repository URL follows this pattern:
https://[organization-id].mycloudrepo.io/repositories/[repository-id]/simple
You can find the exact URL in the CloudRepo Admin Portal under your repository’s settings.
Using CloudRepo with Conda for PyPI Packages
Configuring pip within Conda Environments
CloudRepo seamlessly integrates with Conda environments for Python packages. Here’s how to configure pip to use your private CloudRepo repository:
Method 1: Environment-Specific Configuration
# Create and activate a new environment
conda create -n myproject python=3.11
conda activate myproject
# Configure pip to use CloudRepo
pip config set global.index-url https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
pip config set global.extra-index-url https://pypi.org/simple
# Verify configuration
pip config list
# Set environment variables (add to .bashrc/.zshrc for persistence)
export PIP_INDEX_URL=https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
export PIP_EXTRA_INDEX_URL=https://pypi.org/simple
# Install packages
pip install your-private-package
Method 2: Per-Project Configuration with pip.conf
# .pip/pip.conf or pip.ini (Windows)
[global]
index-url = https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
extra-index-url = https://pypi.org/simple
[install]
trusted-host = [org-id].mycloudrepo.io
Mixing Conda-Forge and Private PyPI Packages
Data science projects often require packages from both conda-forge (for optimized binaries) and private PyPI repositories (for proprietary code). Here’s the recommended approach:
1name: data-science-project
2channels:
3 - conda-forge
4 - defaults
5dependencies:
6 # Conda packages for optimized binaries
7 - python=3.11
8 - numpy=1.24.*
9 - pandas=2.0.*
10 - scikit-learn=1.3.*
11 - matplotlib=3.7.*
12 - jupyter=1.0.*
13 - pytorch=2.0.*
14 - cudatoolkit=11.8 # For GPU support
15
16 # Pip packages including private CloudRepo packages
17 - pip
18 - pip:
19 # Private packages from CloudRepo
20 - --index-url https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
21 - --extra-index-url https://pypi.org/simple
22 - your-private-ml-library==2.1.0
23 - internal-data-connectors==1.5.3
24 - proprietary-feature-engine==3.0.1
25
26 # Public packages better installed via pip
27 - transformers==4.30.0
28 - langchain==0.0.200
# Create environment from file
conda env create -f environment.yml
# Activate environment
conda activate data-science-project
# Verify private packages installed
pip list | grep your-private
Authentication Setup
CloudRepo supports multiple authentication methods for different scenarios:
Secure Credential Storage with keyring
# Install keyring in your conda environment
conda activate myproject
pip install keyring
# Store credentials securely
keyring set https://[org-id].mycloudrepo.io/repositories/[repo-id]/simple username
# Enter your password when prompted
# Configure pip to use keyring
pip config set global.index-url https://[org-id].mycloudrepo.io/repositories/[repo-id]/simple
Using .netrc for Authentication
machine [org-id].mycloudrepo.io
login your-username
password your-password
chmod 600 ~/.netrc
Environment Variables for CI/CD
# Set in your CI/CD system's secret management
export CLOUDREPO_USERNAME=your-username
export CLOUDREPO_PASSWORD=your-password
# Use in pip commands
pip install --index-url https://${CLOUDREPO_USERNAME}:${CLOUDREPO_PASSWORD}@[org-id].mycloudrepo.io/repositories/[repo-id]/simple your-package
Publishing Python Packages for Conda Users
Building Conda-Compatible Wheels
When publishing Python packages for Conda users, ensure compatibility by following these best practices:
1from setuptools import setup, find_packages
2import sys
3
4# Detect if running in conda environment
5is_conda = sys.prefix != sys.base_prefix or 'conda' in sys.prefix
6
7setup(
8 name='your-data-science-library',
9 version='1.0.0',
10 packages=find_packages(),
11 python_requires='>=3.8,<3.12',
12 install_requires=[
13 'numpy>=1.20,<2.0',
14 'pandas>=1.3,<3.0',
15 'scikit-learn>=1.0',
16 ],
17 extras_require={
18 'viz': ['matplotlib>=3.5', 'seaborn>=0.12'],
19 'gpu': ['cupy>=10.0'],
20 'dev': ['pytest>=7.0', 'black>=22.0', 'mypy>=1.0'],
21 },
22 # Metadata
23 author='Your Team',
24 author_email='team@company.com',
25 description='Internal data science utilities',
26 long_description=open('README.md').read(),
27 long_description_content_type='text/markdown',
28 classifiers=[
29 'Development Status :: 4 - Beta',
30 'Intended Audience :: Science/Research',
31 'Programming Language :: Python :: 3.8',
32 'Programming Language :: Python :: 3.9',
33 'Programming Language :: Python :: 3.10',
34 'Programming Language :: Python :: 3.11',
35 ],
36)
1[build-system]
2requires = ["setuptools>=61.0", "wheel"]
3build-backend = "setuptools.build_meta"
4
5[project]
6name = "your-data-science-library"
7version = "1.0.0"
8description = "Internal data science utilities"
9readme = "README.md"
10requires-python = ">=3.8,<3.12"
11dependencies = [
12 "numpy>=1.20,<2.0",
13 "pandas>=1.3,<3.0",
14 "scikit-learn>=1.0",
15]
16
17[project.optional-dependencies]
18viz = ["matplotlib>=3.5", "seaborn>=0.12"]
19gpu = ["cupy>=10.0"]
20dev = ["pytest>=7.0", "black>=22.0", "mypy>=1.0"]
21
22[tool.setuptools.packages.find]
23include = ["your_package*"]
Publishing to CloudRepo’s PyPI Index
Upload your packages to CloudRepo using standard Python packaging tools:
# Install build tools in conda environment
conda activate myproject
pip install build twine
# Build your package
python -m build
# Upload to CloudRepo
twine upload \
--repository-url https://[org-id].mycloudrepo.io/repositories/[repo-id] \
--username your-username \
--password your-password \
dist/*
# Legacy method (still widely used)
python setup.py sdist bdist_wheel upload \
-r https://[org-id].mycloudrepo.io/repositories/[repo-id] \
--username your-username \
--password your-password
Version Management for Data Science Packages
Data science packages often require careful version management due to model compatibility:
1# your_package/__version__.py
2__version__ = "2.1.0"
3
4# Version components:
5# MAJOR.MINOR.PATCH
6# 2 - Major model architecture changes
7# 1 - New features, backward compatible
8# 0 - Bug fixes, performance improvements
9
10# Model versioning
11MODEL_VERSION = "2.1" # Tracks trained model compatibility
12API_VERSION = "v2" # Tracks API compatibility
# Beta releases for team testing
python setup.py sdist bdist_wheel
# Creates: your-package-2.1.0b1-py3-none-any.whl
# Upload beta to CloudRepo
twine upload --repository-url https://[org-id].mycloudrepo.io/repositories/[repo-id] dist/*2.1.0b1*
# Install beta version explicitly
pip install your-package==2.1.0b1
Platform-Specific Packages
Data science teams often need platform-specific builds for performance:
1name: Build and Publish Platform Wheels
2
3on:
4 push:
5 tags:
6 - 'v*'
7
8jobs:
9 build_wheels:
10 strategy:
11 matrix:
12 os: [ubuntu-latest, windows-latest, macos-latest]
13 python-version: ['3.8', '3.9', '3.10', '3.11']
14
15 runs-on: ${{ matrix.os }}
16
17 steps:
18 - uses: actions/checkout@v3
19
20 - uses: conda-incubator/setup-miniconda@v2
21 with:
22 python-version: ${{ matrix.python-version }}
23 activate-environment: build-env
24
25 - name: Install dependencies
26 run: |
27 conda install -c conda-forge numpy cython
28 pip install build twine
29
30 - name: Build platform wheel
31 run: python -m build --wheel
32
33 - name: Upload to CloudRepo
34 env:
35 CLOUDREPO_USER: ${{ secrets.CLOUDREPO_USER }}
36 CLOUDREPO_PASS: ${{ secrets.CLOUDREPO_PASS }}
37 run: |
38 twine upload \
39 --repository-url https://[org-id].mycloudrepo.io/repositories/[repo-id] \
40 --username $CLOUDREPO_USER \
41 --password $CLOUDREPO_PASS \
42 dist/*.whl
Conda Environment Management with CloudRepo
Environment.yml with pip Dependencies from CloudRepo
Create reproducible environments that combine conda and CloudRepo packages:
1name: ml-pipeline-prod
2channels:
3 - conda-forge
4 - pytorch
5 - nvidia
6dependencies:
7 # Core scientific stack
8 - python=3.10.*
9 - numpy=1.24.*
10 - pandas=2.0.*
11 - scipy=1.10.*
12
13 # Machine Learning
14 - scikit-learn=1.3.*
15 - xgboost=1.7.*
16 - lightgbm=4.0.*
17 - pytorch=2.0.*
18 - pytorch-cuda=11.8.*
19
20 # Deep Learning
21 - tensorflow=2.12.*
22 - keras=2.12.*
23
24 # Data Visualization
25 - matplotlib=3.7.*
26 - seaborn=0.12.*
27 - plotly=5.14.*
28 - bokeh=3.1.*
29
30 # Jupyter Ecosystem
31 - jupyter=1.0.*
32 - jupyterlab=4.0.*
33 - ipywidgets=8.0.*
34 - nbconvert=7.4.*
35
36 # Development Tools
37 - black=23.3.*
38 - pylint=2.17.*
39 - pytest=7.3.*
40 - pytest-cov=4.1.*
41
42 # Pip for CloudRepo packages
43 - pip
44 - pip:
45 # CloudRepo configuration
46 - --index-url https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
47 - --extra-index-url https://pypi.org/simple
48
49 # Internal packages
50 - company-ml-core==3.2.1
51 - feature-pipeline==2.0.0
52 - model-registry-client==1.5.0
53 - data-quality-tools==1.1.0
54
55 # Additional PyPI packages
56 - mlflow==2.3.0
57 - wandb==0.15.0
58 - dvc==3.0.0
59
60# Environment variables
61variables:
62 PYTHONPATH: /opt/custom/libs:$PYTHONPATH
63 CUDA_HOME: /usr/local/cuda-11.8
Reproducible Environments
Ensure perfect reproducibility across team members and deployments:
# Export current environment with exact versions
conda list --explicit > conda-packages.txt
pip freeze > pip-packages.txt
# Create combined lock file
conda env export --no-builds > environment-lock.yml
1name: ml-pipeline-prod
2channels:
3 - conda-forge
4 - pytorch
5dependencies:
6 - python=3.10.11
7 - numpy=1.24.3
8 - pandas=2.0.2
9 - pytorch=2.0.1
10 - pip:
11 - --index-url https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
12 - company-ml-core==3.2.1
13 - feature-pipeline==2.0.0
Mixing Conda and pip Packages
Best practices for combining conda and pip packages:
1#!/usr/bin/env python
2"""Verify conda/pip environment setup."""
3
4import sys
5import importlib
6import subprocess
7from pathlib import Path
8
9def check_conda_packages():
10 """Verify conda-installed packages."""
11 required_conda = ['numpy', 'pandas', 'scipy', 'sklearn']
12
13 result = subprocess.run(['conda', 'list'],
14 capture_output=True, text=True)
15 conda_packages = result.stdout
16
17 missing = []
18 for pkg in required_conda:
19 if pkg not in conda_packages:
20 missing.append(pkg)
21
22 return missing
23
24def check_pip_packages():
25 """Verify pip-installed CloudRepo packages."""
26 required_pip = {
27 'company_ml_core': '3.2.1',
28 'feature_pipeline': '2.0.0',
29 }
30
31 missing = []
32 wrong_version = []
33
34 for pkg, required_version in required_pip.items():
35 try:
36 module = importlib.import_module(pkg)
37 if hasattr(module, '__version__'):
38 if module.__version__ != required_version:
39 wrong_version.append(f"{pkg} (found: {module.__version__}, required: {required_version})")
40 except ImportError:
41 missing.append(pkg)
42
43 return missing, wrong_version
44
45def main():
46 print("Checking environment setup...")
47
48 # Check conda packages
49 missing_conda = check_conda_packages()
50 if missing_conda:
51 print(f"❌ Missing conda packages: {', '.join(missing_conda)}")
52 print(" Run: conda install " + ' '.join(missing_conda))
53 else:
54 print("✅ All conda packages installed")
55
56 # Check pip packages
57 missing_pip, wrong_version = check_pip_packages()
58 if missing_pip:
59 print(f"❌ Missing CloudRepo packages: {', '.join(missing_pip)}")
60 if wrong_version:
61 print(f"❌ Wrong versions: {', '.join(wrong_version)}")
62
63 if not missing_pip and not wrong_version:
64 print("✅ All CloudRepo packages correctly installed")
65
66 # Check Python version
67 python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
68 print(f"📊 Python version: {python_version}")
69
70 return len(missing_conda) + len(missing_pip) + len(wrong_version)
71
72if __name__ == "__main__":
73 sys.exit(main())
Lock Files with conda-lock
Use conda-lock for advanced dependency locking across platforms:
# Install conda-lock
conda install -c conda-forge conda-lock
# Generate lock file from environment.yml
conda-lock lock --file environment.yml --platform linux-64 --platform osx-64 --platform win-64
1# Generated by conda-lock
2version: 1
3metadata:
4 content_hash:
5 linux-64: abc123...
6 osx-64: def456...
7 win-64: ghi789...
8 channels:
9 - conda-forge
10 - pytorch
11 platforms:
12 - linux-64
13 - osx-64
14 - win-64
15package:
16 - name: python
17 version: 3.10.11
18 manager: conda
19 platform: linux-64
20 url: https://conda.anaconda.org/conda-forge/linux-64/python-3.10.11-h7a1cb2a_2.tar.bz2
21 hash:
22 md5: abc123...
23 - name: company-ml-core
24 version: 3.2.1
25 manager: pip
26 url: https://[org-id].mycloudrepo.io/repositories/[repo-id]/simple
# Install from conda-lock file
conda-lock install --name ml-pipeline-prod conda-lock.yml
# Or render to platform-specific file
conda-lock render --platform linux-64
conda env create --file conda-linux-64.lock.yml
Advanced Topics
Using Mamba for Faster Dependency Resolution
Mamba is a drop-in replacement for conda with 10-100x faster dependency resolution:
# Install mamba in base environment
conda install -n base -c conda-forge mamba
# Use mamba instead of conda
mamba env create -f environment.yml
mamba activate ml-pipeline-prod
# Mamba handles complex dependencies much faster
mamba install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
channels:
- conda-forge
- pytorch
- nvidia
channel_priority: strict
pip_interop_enabled: true
# CloudRepo pip configuration
pip_args: |
--index-url https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
--extra-index-url https://pypi.org/simple
Docker Containers with Conda and CloudRepo
Create reproducible Docker containers for deployment:
1FROM continuumio/miniconda3:latest
2
3# Set working directory
4WORKDIR /app
5
6# Copy environment file
7COPY environment.yml .
8
9# Create conda environment
10RUN conda env create -f environment.yml && \
11 conda clean -afy && \
12 find /opt/conda/ -follow -type f -name '*.a' -delete && \
13 find /opt/conda/ -follow -type f -name '*.pyc' -delete && \
14 find /opt/conda/ -follow -type f -name '*.js.map' -delete
15
16# Activate environment by default
17SHELL ["conda", "run", "-n", "ml-pipeline-prod", "/bin/bash", "-c"]
18
19# Install CloudRepo packages with credentials
20ARG CLOUDREPO_USER
21ARG CLOUDREPO_PASS
22RUN pip install \
23 --index-url https://${CLOUDREPO_USER}:${CLOUDREPO_PASS}@[org-id].mycloudrepo.io/repositories/[repo-id]/simple \
24 --extra-index-url https://pypi.org/simple \
25 company-ml-core==3.2.1 \
26 feature-pipeline==2.0.0
27
28# Copy application code
29COPY src/ ./src/
30COPY models/ ./models/
31
32# Set entrypoint
33ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "ml-pipeline-prod"]
34CMD ["python", "src/main.py"]
1version: '3.8'
2
3services:
4 model-training:
5 build:
6 context: .
7 args:
8 CLOUDREPO_USER: ${CLOUDREPO_USER}
9 CLOUDREPO_PASS: ${CLOUDREPO_PASS}
10 environment:
11 - CUDA_VISIBLE_DEVICES=0
12 - MLFLOW_TRACKING_URI=http://mlflow:5000
13 volumes:
14 - ./data:/app/data
15 - ./outputs:/app/outputs
16 deploy:
17 resources:
18 reservations:
19 devices:
20 - driver: nvidia
21 count: 1
22 capabilities: [gpu]
23
24 jupyter:
25 build:
26 context: .
27 dockerfile: Dockerfile.jupyter
28 ports:
29 - "8888:8888"
30 volumes:
31 - ./notebooks:/app/notebooks
32 environment:
33 - JUPYTER_ENABLE_LAB=yes
Jupyter Notebooks with Private Packages
Configure Jupyter to use CloudRepo packages:
1import os
2import sys
3
4# Add CloudRepo authentication to notebook environment
5c.NotebookApp.env_vars = {
6 'PIP_INDEX_URL': 'https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple',
7 'PIP_EXTRA_INDEX_URL': 'https://pypi.org/simple'
8}
1# Cell 1: Install private packages from CloudRepo
2import sys
3!{sys.executable} -m pip install \
4 --index-url https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple \
5 --extra-index-url https://pypi.org/simple \
6 company-ml-core==3.2.1
7
8# Cell 2: Import and use
9import company_ml_core
10from company_ml_core import FeatureEngine, ModelRegistry
11
12# Initialize feature engine
13engine = FeatureEngine()
14features = engine.generate_features(df)
# Install useful extensions
conda activate ml-pipeline-prod
# Variable inspector
jupyter labextension install @lckr/jupyterlab_variableinspector
# Git integration
pip install jupyterlab-git
# Code formatting
pip install jupyterlab-code-formatter black isort
Multi-Environment Projects
Manage multiple environments for different stages:
1name: project-dev
2channels:
3 - conda-forge
4dependencies:
5 - python=3.11 # Latest for development
6 - numpy
7 - pandas
8 - jupyter
9 - pytest
10 - black
11 - mypy
12 - pip:
13 - --index-url https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
14 - -e ../company-ml-core # Editable local install
1name: project-prod
2channels:
3 - conda-forge
4dependencies:
5 - python=3.10.11 # Pinned for production
6 - numpy=1.24.3
7 - pandas=2.0.2
8 - pip:
9 - --index-url https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
10 - company-ml-core==3.2.1 # Pinned version
1#!/bin/bash
2
3# Environment management script
4
5create_env() {
6 local env_name=$1
7 local env_file=$2
8
9 echo "Creating environment: $env_name from $env_file"
10 mamba env create -f $env_file
11 echo "✅ Environment $env_name created"
12}
13
14update_env() {
15 local env_name=$1
16 local env_file=$2
17
18 echo "Updating environment: $env_name"
19 mamba env update -n $env_name -f $env_file --prune
20 echo "✅ Environment $env_name updated"
21}
22
23# Create all environments
24create_all() {
25 create_env project-dev environments/dev.yml
26 create_env project-test environments/test.yml
27 create_env project-prod environments/prod.yml
28}
29
30# Main script
31case "$1" in
32 create)
33 create_env $2 $3
34 ;;
35 update)
36 update_env $2 $3
37 ;;
38 create-all)
39 create_all
40 ;;
41 *)
42 echo "Usage: $0 {create|update|create-all} [env-name] [env-file]"
43 exit 1
44esac
Future: Native Conda Channel Support
CloudRepo’s upcoming native Conda channel support will enable:
- Binary Package Hosting
Host compiled packages with C/C++ extensions, CUDA libraries, and platform-specific optimizations directly as conda packages.
- Custom Conda Channels
Create private conda channels alongside conda-forge and defaults:
Future: Native conda channel configurationchannels: - https://[org-id].mycloudrepo.io/conda/[channel-name] - conda-forge - defaults
- Conda Package Building
Build and publish conda packages directly:
Future: Publishing conda packages# Build conda package conda build recipe/ # Upload to CloudRepo conda channel anaconda upload --channel cloudrepo package.tar.bz2
- Mixed Language Packages
Support packages that combine Python with R, Julia, or other languages in a single conda package.
This roadmap ensures CloudRepo remains the most cost-effective and feature-complete solution for teams using Conda in production.
CI/CD Integration
GitHub Actions with Conda
Integrate CloudRepo with GitHub Actions for automated testing and deployment:
1name: Conda CI/CD Pipeline
2
3on:
4 push:
5 branches: [main, develop]
6 pull_request:
7 branches: [main]
8
9jobs:
10 test:
11 runs-on: ${{ matrix.os }}
12 strategy:
13 matrix:
14 os: [ubuntu-latest, windows-latest, macos-latest]
15 python-version: ['3.9', '3.10', '3.11']
16
17 steps:
18 - uses: actions/checkout@v3
19
20 - name: Setup Miniconda
21 uses: conda-incubator/setup-miniconda@v2
22 with:
23 python-version: ${{ matrix.python-version }}
24 miniforge-version: latest
25 activate-environment: test-env
26 environment-file: environment.yml
27 auto-activate-base: false
28
29 - name: Configure CloudRepo
30 shell: bash -l {0}
31 run: |
32 pip config set global.index-url https://${{ secrets.CLOUDREPO_USER }}:${{ secrets.CLOUDREPO_PASS }}@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
33 pip config set global.extra-index-url https://pypi.org/simple
34
35 - name: Install dependencies
36 shell: bash -l {0}
37 run: |
38 conda info
39 conda list
40 pip install -e .[dev]
41
42 - name: Run tests
43 shell: bash -l {0}
44 run: |
45 pytest tests/ -v --cov=your_package --cov-report=xml
46
47 - name: Upload coverage
48 uses: codecov/codecov-action@v3
49 with:
50 file: ./coverage.xml
51
52 publish:
53 needs: test
54 runs-on: ubuntu-latest
55 if: github.event_name == 'push' && github.ref == 'refs/heads/main'
56
57 steps:
58 - uses: actions/checkout@v3
59
60 - name: Setup Python
61 uses: actions/setup-python@v4
62 with:
63 python-version: '3.10'
64
65 - name: Build package
66 run: |
67 pip install build
68 python -m build
69
70 - name: Publish to CloudRepo
71 run: |
72 pip install twine
73 twine upload \
74 --repository-url https://[org-id].mycloudrepo.io/repositories/[repo-id] \
75 --username ${{ secrets.CLOUDREPO_USER }} \
76 --password ${{ secrets.CLOUDREPO_PASS }} \
77 dist/*
GitLab CI
Configure GitLab CI for Conda and CloudRepo:
1image: continuumio/miniconda3:latest
2
3variables:
4 PIP_INDEX_URL: https://${CLOUDREPO_USER}:${CLOUDREPO_PASS}@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
5 PIP_EXTRA_INDEX_URL: https://pypi.org/simple
6
7before_script:
8 - conda env create -f environment.yml
9 - conda activate ml-pipeline
10
11stages:
12 - test
13 - build
14 - deploy
15
16test:unit:
17 stage: test
18 script:
19 - conda activate ml-pipeline
20 - pytest tests/unit -v --junitxml=report.xml
21 artifacts:
22 reports:
23 junit: report.xml
24
25test:integration:
26 stage: test
27 script:
28 - conda activate ml-pipeline
29 - pytest tests/integration -v
30
31build:package:
32 stage: build
33 script:
34 - conda activate ml-pipeline
35 - python -m build
36 artifacts:
37 paths:
38 - dist/
39 expire_in: 1 week
40
41deploy:cloudrepo:
42 stage: deploy
43 only:
44 - main
45 - tags
46 script:
47 - pip install twine
48 - twine upload \
49 --repository-url https://[org-id].mycloudrepo.io/repositories/[repo-id] \
50 --username ${CLOUDREPO_USER} \
51 --password ${CLOUDREPO_PASS} \
52 dist/*
Azure ML Pipelines
Integrate with Azure Machine Learning pipelines:
1trigger:
2 branches:
3 include:
4 - main
5 - develop
6
7pool:
8 vmImage: 'ubuntu-latest'
9
10variables:
11 - group: cloudrepo-credentials
12
13stages:
14- stage: Build
15 jobs:
16 - job: CondaBuild
17 strategy:
18 matrix:
19 Python39:
20 python.version: '3.9'
21 Python310:
22 python.version: '3.10'
23 Python311:
24 python.version: '3.11'
25
26 steps:
27 - task: UsePythonVersion@0
28 inputs:
29 versionSpec: '$(python.version)'
30
31 - bash: |
32 wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
33 bash miniconda.sh -b -p $HOME/miniconda
34 export PATH="$HOME/miniconda/bin:$PATH"
35 conda env create -f environment.yml
36 displayName: 'Setup Conda Environment'
37
38 - bash: |
39 source $HOME/miniconda/bin/activate ml-pipeline
40 pip config set global.index-url https://$(CLOUDREPO_USER):$(CLOUDREPO_PASS)@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
41 pip install -e .[dev]
42 displayName: 'Install Dependencies'
43
44 - bash: |
45 source $HOME/miniconda/bin/activate ml-pipeline
46 pytest tests/ --junitxml=junit/test-results.xml --cov --cov-report=xml
47 displayName: 'Run Tests'
48
49 - task: PublishTestResults@2
50 inputs:
51 testResultsFiles: '**/test-results.xml'
52
53 - task: PublishCodeCoverageResults@1
54 inputs:
55 codeCoverageTool: 'Cobertura'
56 summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
57
58- stage: Deploy
59 condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
60 jobs:
61 - job: PublishPackage
62 steps:
63 - bash: |
64 pip install build twine
65 python -m build
66 twine upload \
67 --repository-url https://[org-id].mycloudrepo.io/repositories/[repo-id] \
68 --username $(CLOUDREPO_USER) \
69 --password $(CLOUDREPO_PASS) \
70 dist/*
71 displayName: 'Publish to CloudRepo'
Troubleshooting Common Issues
Authentication Issues
Problem: 401 Unauthorized errors when installing packages
# Check current pip configuration
pip config list
# Verify URL format (note the /simple suffix for PyPI)
# Correct: https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]/simple
# Wrong: https://username:password@[org-id].mycloudrepo.io/repositories/[repo-id]
# Test authentication
curl -u username:password https://[org-id].mycloudrepo.io/repositories/[repo-id]/simple
Problem: Credentials visible in conda environment export
# Use environment variables
export CLOUDREPO_INDEX=https://[org-id].mycloudrepo.io/repositories/[repo-id]/simple
# In environment.yml, reference without credentials
dependencies:
- pip:
- --index-url ${CLOUDREPO_INDEX}
Package Resolution Conflicts
Problem: Conda and pip package versions conflict
# Best practice order
conda install numpy pandas scikit-learn
pip install your-private-package
# Never do this (pip first, then conda)
pip install numpy
conda install numpy # May downgrade or conflict
Problem: Dependency resolver timeout with complex requirements
# Install mamba for faster resolution
conda install -c conda-forge mamba
# Use mamba instead
mamba env create -f environment.yml
# Or simplify by pinning major versions only
dependencies:
- numpy=1.24.* # Instead of exact version
- pandas=2.*
SSL/TLS Certificate Issues
Problem: SSL verification errors with corporate proxies
# Export corporate certificate
export REQUESTS_CA_BUNDLE=/path/to/corporate-ca-bundle.crt
export SSL_CERT_FILE=/path/to/corporate-ca-bundle.crt
# Or configure in pip
pip config set global.cert /path/to/corporate-ca-bundle.crt
# For conda
conda config --set ssl_verify /path/to/corporate-ca-bundle.crt
Environment Reproducibility
Problem: Different team members get different package versions
# Generate exact environment snapshot
conda list --explicit > conda-explicit.txt
pip freeze > requirements-lock.txt
# Recreate exact environment
conda create --name myenv --file conda-explicit.txt
conda activate myenv
pip install -r requirements-lock.txt
Problem: Builds fail in CI but work locally
# Export local environment
conda env export --no-builds > ci-environment.yml
# In CI, use exact same environment
conda env create -f ci-environment.yml
Performance Issues
Problem: Slow package downloads from CloudRepo
# Enable pip cache
pip config set global.cache-dir /path/to/cache
# Use parallel downloads (pip 20.3+)
pip install --use-feature=fast-deps your-package
# For conda, use mamba
mamba install your-packages
Problem: Large conda environments taking too much space
# Clean package cache
conda clean --all
# Use hard links to save space
conda config --set allow_softlinks false
# Pack environment for distribution
conda pack -n myenv -o myenv.tar.gz
Common Error Messages
ERROR: Could not find a version that satisfies the requirement
→ Check package name spelling and version availability
→ Verify repository URL includes /simple for PyPI
ERROR: No matching distribution found
→ Package might not exist in CloudRepo
→ Check if package supports your Python version/platform
CondaHTTPError: HTTP 401 UNAUTHORIZED
→ Invalid credentials or expired token
→ Create new repository user in CloudRepo admin
ResolvePackageNotFound
→ Package not available in specified channels
→ Add appropriate channel or install via pip
InvalidVersionSpec
→ Version specification syntax error
→ Use correct syntax: ==, >=, ~=, etc.
Summary
CloudRepo provides robust support for Conda and Miniconda users through its PyPI repository functionality, enabling data science teams to:
Securely host and share proprietary Python packages within Conda environments
Combine the best of both worlds by using conda-forge for optimized binaries and CloudRepo for private packages
Maintain reproducible environments across development, testing, and production
Integrate seamlessly with existing CI/CD pipelines and MLOps workflows
Save significantly on infrastructure costs compared to enterprise alternatives
With native Conda channel support on the roadmap, CloudRepo is positioned to become the complete package management solution for data science and research teams, offering enterprise-grade features at a fraction of the cost of competitors.
For additional support or questions about using CloudRepo with Conda, please contact our support team at support@cloudrepo.io.
See also
Python Repositories - Core Python repository documentation
Poetry Repositories - Using Poetry with CloudRepo
Pixi Repositories - Pixi package management
UV Repositories - Ultra-fast UV package installer
Continuous Integration and Deployment - CI/CD setup guides