mamba icon indicating copy to clipboard operation
mamba copied to clipboard

Put micromamba v2 on homebrew, currently latest version there is 1.5.10

Open corneliusroemer opened this issue 1 year ago • 5 comments

I'd like to install micromamba v2 via homebrew, but so far only 1.5.10 is available there.

https://github.com/Homebrew/homebrew-core/blob/45656b5b8833aa5a0f26fdcf4318324c756fb994/Formula/m/micromamba.rb

Do you have plans to add it there?

corneliusroemer avatar Oct 03 '24 06:10 corneliusroemer

I created a PR to point this out in docs while homebrew doesn't have v2.

Once homebrew has v2, this PR should be reverted: https://github.com/mamba-org/mamba/pull/3499

corneliusroemer avatar Oct 03 '24 07:10 corneliusroemer

See https://github.com/Homebrew/homebrew-core/pull/192460 and https://github.com/Homebrew/homebrew-core/pull/191869.

henryiii avatar Oct 23 '24 16:10 henryiii

I made PR https://github.com/Homebrew/homebrew-core/pull/195371 - advice welcome on how to proceed - it seems "micromamba" now requires static linkage so the micromamba recipe can't build it, shared linkage is required on homebrew.

henryiii avatar Oct 25 '24 18:10 henryiii

Anyone know why macOS 13 reports:

 /tmp/micromamba-20241025-6758-psgcn7/mamba-micromamba-2.0.1/libmamba/src/core/transaction.cpp:703:36: error: no viable constructor or deduction guide for deduction of template arguments of 'packaged_task'
                  std::packaged_task task{ [=] { return it->run(); } };

I plan to try:

diff --git a/libmamba/src/core/transaction.cpp b/libmamba/src/core/transaction.cpp
index 7d2f7668..1b1c5fba 100644
--- a/libmamba/src/core/transaction.cpp
+++ b/libmamba/src/core/transaction.cpp
@@ -698,7 +698,7 @@ namespace mamba
                  it != extract_tasks.end();
                  ++it)
             {
-                std::packaged_task task{ [=] { return it->run(); } };
+                std::packaged_task<mamba::PackageExtractTask::Result ()> task{ [=] { return it->run(); } };
                 extract_trackers.push_back(task.get_future());
                 MainExecutor::instance().schedule(std::move(task));
             }

henryiii avatar Oct 26 '24 03:10 henryiii

And linux:

Error: /usr/include/c++/11/bits/hashtable_policy.h:1004:12:   required from ‘struct std::__detail::_Insert<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, mamba::specs::Channel>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, mamba::specs::Channel> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true>, false>’
  /usr/include/c++/11/bits/hashtable.h:180:11:   required from ‘class std::_Hashtable<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, mamba::specs::Channel>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, mamba::specs::Channel> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char> >, std::hash<std::__cxx11::basic_string<char> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >’
  /usr/include/c++/11/bits/unordered_map.h:105:18:   required from ‘class std::unordered_map<std::__cxx11::basic_string<char>, mamba::specs::Channel, std::hash<std::__cxx11::basic_string<char> >, std::equal_to<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, mamba::specs::Channel> > >’
  /tmp/micromamba-20241025-5716-906661/mamba-micromamba-2.0.1/libmamba/include/mamba/util/weakening_map.hpp:26:11:   required from ‘class mamba::util::weakening_map<std::unordered_map<std::__cxx11::basic_string<char>, mamba::specs::Channel, std::hash<std::__cxx11::basic_string<char> >, std::equal_to<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, mamba::specs::Channel> > >, mamba::specs::ChannelResolveParams::NameWeakener>’
  /tmp/micromamba-20241025-5716-906661/mamba-micromamba-2.0.1/libmamba/include/mamba/specs/channel.hpp:56:40:   required from here
  /usr/include/c++/11/bits/stl_pair.h:218:11: error: ‘std::pair<_T1, _T2>::second’ has incomplete type
    218 |       _T2 second;                ///< The second member
        |           ^~~~~~
  In file included from /tmp/micromamba-20241025-5716-906661/mamba-micromamba-2.0.1/libmamba/src/specs/channel.cpp:11:
  /tmp/micromamba-20241025-5716-906661/mamba-micromamba-2.0.1/libmamba/include/mamba/specs/channel.hpp:25:11: note: forward declaration of ‘class mamba::specs::Channel’
     25 |     class Channel;
        |           ^~~~~~~
  /tmp/micromamba-20241025-5716-906661/mamba-micromamba-2.0.1/libmamba/src/specs/channel.cpp: In function ‘mamba::specs::Channel::channel_list mamba::specs::{anonymous}::resolve_name(mamba::specs::UnresolvedChannel&&, mamba::specs::ChannelResolveParamsView)’:
  /tmp/micromamba-20241025-5716-906661/mamba-micromamba-2.0.1/libmamba/src/specs/channel.cpp:471:103: error: could not convert ‘{<expression error>}’ from ‘<brace-enclosed initializer list>’ to ‘mamba::specs::Channel::channel_list’ {aka ‘std::vector<mamba::specs::Channel>’}
    471 |                 return { resolve_name_in_custom_channel(std::move(uc), params, it->first, it->second) };
        |                                                                                                       ^
        |                                                                                                       |
        |                                                                                                       <brace-enclosed initializer list>

Other builds are fine, like macOS 14.

Trying this locally (WIP):

docker run -v $PWD:/mamba -w /mamba --rm -it homebrew/brew
brew install fmt libarchive libsolv lz4 openssl@3 reproc simdjson xz yaml-cpp zstd cmake cli11 nlohmann-json spdlog tl-expected curl pkgconfig python bzip2 krb5 zlib
cmake -S. -Bbuild -DBUILD_LIBMAMBA=ON -DBUILD_MAMBA=ON -DBUILD_SHARED=ON -DBUILD_STATIC=OFF  -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build build -j8

If Python is not found, it just crashes when building, probably should be marked REQURIED.

This does repro. :)

henryiii avatar Oct 26 '24 03:10 henryiii

2.0.4 is on homebrew!

henryiii avatar Nov 25 '24 18:11 henryiii

@henryiii Wow, thank you! I just got a new laptop, and it's a neat coincidence that I can install micromamba from Homebrew.

Two minor issues I noticed:

  1. brew install micromamba produces this terminal output on my machine (M3 Pro ARM64):

    ==> Pouring micromamba--2.0.4.arm64_sonoma.bottle.tar.gz
    ==> Caveats
    Please run the following to setup your shell:
    /opt/homebrew/opt/micromamba/bin/mamba shell init -s <your-shell> -p ~/mamba
    and restart your terminal.
    

    This isn't true for micromamba, which should be initialized via /opt/homebrew/bin/micromamba shell init -s zsh -r micromamba.

  2. I think the docs page needs to be updated to remove the hint that micromamba v2 is unavailable on Homebrew: https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html#homebrew

dlqqq avatar Nov 26 '24 21:11 dlqqq