Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use conda skeleton with packages that are not uploaded to pypi?

I am trying to use conda skeleton to build conda packages for some python packages that were not uploaded to pypi.

I cannot upload them to pypi and I don't want to have to deploy a local pypi server. They are stored on the local machine, being the results of a recent build and now I want to also build their conda packages.

How can I do this? I tried various options for --pypi-url but I get a OSError: unsupported XML-RPC protocol which tells me that skeleton expects a real PYPI and that it cannot really deal with local repositories. PIP can work with local directories without problems.

What would be the way to overcome this?

like image 312
sorin Avatar asked Apr 25 '16 11:04

sorin


People also ask

Does conda use PyPI?

If you want to build conda packages for PyPI packages, the recommended way is to use conda skeleton pypi package and use conda build package on the recipe that it creates. To install the package, use conda install --use-local package (here and elsewhere, package is the name of the PyPI package you wish to install).

Can I use conda instead of pip?

Because Conda introduces a new packaging format, you cannot use pip and Conda interchangeably; pip cannot install the Conda package format. You can use the two tools side by side (by installing pip with conda install pip ) but they do not interoperate either.

Can pip install conda packages?

You can install pip in the current conda environment with the command conda install pip , as discussed in Using pip in an environment. If there are instances of pip installed both inside and outside the current conda environment, the instance of pip installed inside the current conda environment is used.


1 Answers

you do not actually have to use conda skeleton. I believe you have a module/package built within a conda env and you want to package it. if that is so then building a meta.yaml file and a build.sh (macOS) would be sufficient.

For example: say you have a project called condabuild_sample.

cd condabuild_sample

use your preferable editor and create a new file meta.yaml I use vim

vi meta.yaml

*Update the meta.yaml:

package:
     name: <your package name>
     version: <ideally your git version>

source:
     git_path: <git link> 
requirements:
     run:
         - <a list of project import requirements>
about:
     home: <project home>
     license: <custom license file>*

Actually, only the tag: package is required. Rest all you can customize per your project needs.

then create another file build.sh, and provide your build instructions for your package. build.sh is executed as a bash. But you can keep it empty to learn and test.

Once you have your meta.yaml and bash.sh, run the following

conda build condabuild_sample

If there are no mistakes, the package gets added to a directory within your conda set up. Once this step completes successfully,

conda install --use-local condabuild_sample

This would add to the list of conda packages, that are available locally. Now run, to confirm,

conda list

You would find the package listed with a channel = local.

You can also upload to anaconda using an anaconda client.

Reference Links that I used: Conda Skeleton Example

like image 167
karthik r Avatar answered Sep 24 '22 15:09

karthik r