Conda - Install a PyPi Package

Card Puncher Data Processing

About

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

Steps

Install and update the environment

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

From PyPi

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

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

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

Install

  • Install the build in the local repo
conda install --use-local packageName
# example with pyinstrument
conda install --use-local pyinstrument
  • Verify
conda list

Upload to Anaconda.org

see Anaconda.org (Anaconda Cloud)

Documentation / Reference





Discover More
Card Puncher Data Processing
Conda - Package

in the context of the conda application Conda packages are downloaded from remote channels, which are URLs to directories containing conda packages. The conda command searches a default set of channels,...



Share this page:
Follow us:
Task Runner