{"id":32358617,"url":"https://github.com/btjanaka/cpp-conda","last_synced_at":"2026-07-11T02:31:19.932Z","repository":{"id":55410925,"uuid":"325684677","full_name":"btjanaka/cpp-conda","owner":"btjanaka","description":"Template for ML/AI research in C++ using Conda for dependency management.","archived":false,"fork":false,"pushed_at":"2021-01-03T01:23:23.000Z","size":55,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-08-23T08:51:42.079Z","etag":null,"topics":["abseil","ai","cmake","conda","cpp","machine-learning","protobuf","research","template","xtensor"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/btjanaka.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-31T01:26:54.000Z","updated_at":"2023-08-23T05:35:43.000Z","dependencies_parsed_at":"2022-08-14T23:50:10.676Z","dependency_job_id":null,"html_url":"https://github.com/btjanaka/cpp-conda","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/btjanaka/cpp-conda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btjanaka%2Fcpp-conda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btjanaka%2Fcpp-conda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btjanaka%2Fcpp-conda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btjanaka%2Fcpp-conda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btjanaka","download_url":"https://codeload.github.com/btjanaka/cpp-conda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btjanaka%2Fcpp-conda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35349259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abseil","ai","cmake","conda","cpp","machine-learning","protobuf","research","template","xtensor"],"created_at":"2025-10-24T13:08:48.440Z","updated_at":"2026-07-11T02:31:19.922Z","avatar_url":"https://github.com/btjanaka.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C++ Project with Conda\n\n[![Build and Check](https://github.com/btjanaka/cpp-conda/workflows/Build%20and%20Check/badge.svg)](https://github.com/btjanaka/cpp-conda/actions?query=workflow%3A\"Build+and+Check\")\n\n**Status: In Development**\n\nThis is a template for using C++ with Conda, geared towards those working in\nmachine learning / AI / data science. Currently, it has an example of an app (in\n`src/main.cpp`) and a library (in `include/libraryname/library.h`).\n\n## Contents\n\n\u003c!-- vim-markdown-toc GFM --\u003e\n\n* [Features](#features)\n* [Instructions](#instructions)\n  * [Environment](#environment)\n  * [Build](#build)\n  * [Dev Tools](#dev-tools)\n* [Motivation](#motivation)\n  * [Why Conda?](#why-conda)\n  * [Conclusions](#conclusions)\n* [References](#references)\n\n\u003c!-- vim-markdown-toc --\u003e\n\n## Features\n\nCurrently, this template has only been set up and run on Linux systems, though\nit _might_ work on other systems.\n\n- Conda environment eliminates system dependencies\n- GitHub Actions integration\n- Build system with cmake, make, and gcc (all installed with `conda`; see\n  [here](https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html))\n  for details on the compilers available through Anaconda\n- Libraries\n  - [Abseil](https://abseil.io)\n  - [xtensor](https://xtensor.readthedocs.io/en/latest/)\n  - [nlohmann/json](https://github.com/nlohmann/json#serialization--deserialization)\n  - [protobuf](https://github.com/protocolbuffers/protobuf)\n- Dev tools\n  - Formatting (Google style) with\n    [clang-format](https://clang.llvm.org/docs/ClangFormat.html)\n  - Linting with [clang-tidy](http://clang.llvm.org/extra/clang-tidy/)\n    - This is not integrated directly into CMake because doing so will result in\n      clang-tidy linting generated libraries like those from protobuf\n\n## Instructions\n\n### Environment\n\nFor development and building, this project runs within a Conda environment named\n`cpp-conda`. If you do not have Conda installed, I recommend getting\n[Miniconda](https://docs.conda.io/en/latest/miniconda.html). To create the\nenvironment, run:\n\n```bash\nconda env create -f environment.yaml\nconda activate cpp-conda\n```\n\nAlternatively, use [Mamba](https://github.com/mamba-org/mamba), a faster\nalternative to Conda implemented in C++. Mamba primarily accelerates package\ninstallation, so you will still need to use Conda to activate the environment.\n\n```bash\nconda install -c conda-forge mamba\nmamba env create -f environment.yaml\nconda activate cpp-conda\n```\n\n### Build\n\n**Within the Conda environment,** build the project with:\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake\n```\n\nThen run the `main` app with:\n\n```bash\n./bin/main\n```\n\nThe binary should work both inside and outside the Conda env.\n\n### Dev Tools\n\nTo set up the dev environment, first run a build as described above, then run:\n\n```bash\nmake setup-clang-tools\n```\n\nTo lint, run:\n\n```bash\nmake lint\n```\n\n## Motivation\n\n\u003e \"If all you have is a hammer, everything looks like a nail.\" - A Python user\n\u003e looking for better performance.\n\nModern machine learning typically depends on Python, but with that comes many\nlimitations. For example:\n\n- As it is interpreted, Python is inherently slow.\n- Due to its dynamic nature, there is a slew of errors that would easily be\n  detected in a static language. For instance, one might run a long training\n  loop, only to have the entire script crash due to an undefined variable.\n\nC++ solves these problems, but it has a much higher learning curve than Python.\nThus, I wanted to answer the question: Is it feasible to do machine learning\nresearch with C++? After all, many machine learning libraries are written in C++\nwith Python bindings, so there is a potentially large ecosystem waiting to be\ntapped. Thus, I decided to build a project template that I could later leverage\nin my research, whether for implementing algorithms, or for creating a library\n(maybe with Python bindings).\n\nPersonally, I wanted to become more familiar with the open source C++ ecosystem,\nparticularly tools such as cmake and libraries such as abseil. In the past, I\nhave primarily used Python in my projects, and while it works well, there are\nmany inherent limitations, particularly with regard to performance and dynamic\ntyping.\n\n### Why Conda?\n\nIn setting up this project, I found that a major problem with C++ is simply\ngetting set up. It is difficult to consistently set up the same libraries and\ntools. There are several solutions. The first is to rely mainly on the system,\nand do everything in a container such as with Docker or Singularity. However, I\nfind containers rather heavy, and they do not integrate well with development\nenvironments (i.e. my vim setup :wink:). I came across a much simpler solution\nwhile exploring\n[xtensor](https://xtensor.readthedocs.io/en/latest/installation.html), which\nsuggested installing via Conda.\n\nConda is a prime choice for C++ dependency management because it is already\npopular in ML and data science, and many powerful C++ libraries (abseil,\nxtensor,...) and tools (cmake, make, clang,...) are available as Conda packages.\nFurthermore, using primarily Conda dependencies may help if one wishes to deploy\ntheir C++ project to Conda in the future. Finally, Conda makes it easy if one\nneeds to pull in Python libraries to perform functions not available in C++\n(i.e. matplotlib, since C++ does not have a primary plotting library).\n\n### Conclusions\n\nTo conclude, I am beginning to think the answer to my question is \"yes, machine\nlearning research is possible with C++, but it takes a bit to get things set\nup.\" I'll have to run a full project with this template to find out :D.\n\n## References\n\n- [cmake examples](https://github.com/ttroy50/cmake-examples)\n- [cpp starter project](https://github.com/lefticus/cpp_starter_project)\n- [awesome-cpp](https://github.com/fffaraz/awesome-cpp#artificial-intelligence)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtjanaka%2Fcpp-conda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtjanaka%2Fcpp-conda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtjanaka%2Fcpp-conda/lists"}