Conda - Install a PyPi Package

1 - About

How to install a PyPi distribution package in the conda repository.

3 - Steps

3.1 - Install and update the environment


conda install -y conda-build
conda update -y conda
conda update -y conda-build

3.2 - From PyPi

3.2.1 - Create the meta.yaml

  • The skeleton command get the PyPI package metadata and create the Conda - meta.yaml.

cd userHomeDirectory
conda skeleton pypi packageName
# ''pypi'' is the location of the PyPi package
# Example
conda skeleton pypi pyinstrument

  • Check that the skeleton file Conda - meta.yaml was created in the subdirectory packageName

ls packageName/packageNam

3.2.2 - Create the recipe

To create a build recip, we need the file:

Steps:

  • Go to the sub-directory named packageName

cd packageName

  • Download the build file for your platform

3.2.3 - Build

  • The last argument is the location of the recipe

conda-build .
# or
conda build meta.yaml --cache-dir /data/conda-cache/

# Optional
# Build for python 3.3
conda-build --python 3.3 .
# Build for an other platform
# Windows
conda convert -f --platform all C:\Users\jsmith\Miniconda\conda-bld\win-64\pyinstrument-0.13.1-py27_0.tar.bz2 -o outputdir\
# Linux / Macos
conda convert --platform all /home/jsmith/miniconda/conda-bld/linux-64/pyinstrument-0.13.1-py27_0.tar.bz2 -o outputdir/

The build output stream shows the build path with the following pattern


conda_home/conda-bld/$ARCH/packageName-packageVersion-PythonVersion.bz2

where $ARCH is one of osx-64, linux-32, linux-64, win-32 or win-64

Example of path

  • Windows: Miniconda_home\conda-bld\win-64\pyinstrument-0.13.1-py27_0.tar.bz2
  • macOS: miniconda_home/conda-bld/osx-64/pyinstrument-0.13.1-py27_0.tar.bz2
  • Linux: miniconda_home/conda-bld/linux-64/pyinstrument-0.13.1-py27_0.tar.bz2

3.2.4 - Install

  • Install the build in the local repo

conda install --use-local packageName
# example with pyinstrument
conda install --use-local pyinstrument

  • Verify

conda list

3.2.5 - Upload to Anaconda.org

4 - Documentation / Reference


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap