I have a few python projects that are dependent on each other. I have different release versions for each project and different projects might be dependent on different release versions of a particular project. I would like to create my own conda repository on an internal server where I can push the releases of these projects as conda packages and the other projects can install the required version from there. Is this possible? If so how?
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.
Conda is an open-source package management system and environment management system that runs on Windows, macOS, and Linux. Conda quickly installs, runs and updates packages and their dependencies. Conda easily creates, saves, loads, and switches between environments on your local computer.
You can use a conda custom channel as your private repo. The essential steps are to use "conda build" to create a conda package, then copy that package into your custom channel (a directory), and now run conda index on that directory. You can then install packages from this channel by using the "conda install -c ".
An example, in more detail, let's assume linux-64:
mkdir -p /tmp/my-conda-channel/linux-64
Now assuming you have some project named "abc" with a meta.yaml and build.sh with some version X. Now you build it:
conda build abc
This will build a tar.bz2 file in your conda-bld directory. For example: ~/miniconda3/conda-bld/linux-64/abc-X-py35_0.tar.bz2. Copy that file to your channel:
cp ~/miniconda3/conda-bld/linux-64/abc-X-py35_0.tar.bz2 /tmp/my-conda-channel/linux-64/
Now index it:
conda index /tmp/my-conda-channel/linux-64/
You've now uploaded that package to your custom channel. You can install it in any of your conda environments by doing:
conda install -c file://tmp/my-conda-channel/ abc=X
Where, recall, the X is the version so, once you've placed more versions in your channel, you can install specific versions.
If you have a project that depends on the X version of "abc" then we simply add it to that projects meta.yaml. Example:
package: name: some-other-project version: 0.1 requirements: build: - abc X ...
Once you have created this channel it's probably a good idea to add it to your .condarc file so that it will get automatically searched. For example:
channels: - file://tmp/my-conda-channel/ - defaults
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With