3

I am trying to run the yml file but fail to solve the environment. The error is

ResolvePackageNotFound:

libgcc-ng
libstdcxx-ng

Then I tried conda installs

conda install -c anaconda libgcc-ng 
conda install -c conda-forge libstdcxx-ng

but the following error occurs:

PackagesNotFoundError: The following packages are not available from current channels:

libgcc-ng
libstdcxx-ng

Current channels:

  - https://conda.anaconda.org/conda-forge/osx-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch

Edit: I tried (PackagesNotFoundError: The following packages are not available from current channels:)

conda config --append channels conda-forge 

and then tried

conda install -c conda-forge <package>

as well as pip install. Still does not work as my goal is to download libgcc-ng and libstdcxx-ng packages

Zhang Yongheng
  • 125
  • 2
  • 10
  • This might help. You may have to use pip or install the channels you want: https://stackoverflow.com/questions/48493505/packagesnotfounderror-the-following-packages-are-not-available-from-current-cha – Anish Sinha Aug 18 '21 at 23:32
  • Tried conda config --append channels conda-forge and then tried conda install -c conda-forge , as well as pip install. Still does not work – Zhang Yongheng Aug 19 '21 at 01:13
  • What is your ultimate goal? What are you trying to compile? – merv Aug 19 '21 at 18:08
  • @merv My goal is to download libgcc-ng and libstdcxx-ng packages so that I can run the set up part – Zhang Yongheng Aug 20 '21 at 00:57
  • 1
    YAML files are not meant to transfer across platforms, so you should not insist on installing exactly the same packages on your **osx-64** machine as were installed on a **linux-64** machine. If you can, ask whoever has access to the original environment to export using this command: `conda env export --from-history`. That is less prone to include platform-specific packages (though not guaranteed). – merv Aug 20 '21 at 16:03
  • merv is right. You just can't install them on macOS from the `environment.yml` file. The yml is not cross-platform compatible. `libgcc-ng`, `libstdcxx-ng` are only libraries for `gcc`. The following answers help you get these libraries from other approaches. – Simba Aug 21 '21 at 07:11
  • Hi @merv and @Simba, thank you so much for your message. I am trying to follow the github repo, build up a conda environment with `conda env create --force -f ../mimic_extract_env_py36.yml`. However those two libraries make me cannot make the environment working. Do you have any suggestions? – Zhang Yongheng Aug 24 '21 at 21:16
  • 1
    Edit the YAML file to remove what is not compatible with your platform ([as suggested here](https://stackoverflow.com/q/39280638/570918)). Otherwise, run a Docker or something equivalent where you can run Linux. – merv Aug 24 '21 at 21:28

2 Answers2

4

libgcc-ng, libstdcxx-ng do exist in conda-forge. But they're for Linux only, not for macOS, Windows.

These two packages include libraries for gcc. For macOS, install gcc with homebrew. They are contained by the gcc package already.

brew install gcc
Simba
  • 23,537
  • 7
  • 64
  • 76
  • Hi, are there other methods to download those two packages? Once I use your command, the error shows that gcc: the bottle needs the Xcode CLT to be installed. However Xcode is too big for my computer – Zhang Yongheng Aug 19 '21 at 17:53
  • @ZhangYongheng Xcode command line tool is not Xcode. Xcode CLT is more lightweight. Use `sudo xcode-select --install` to install it. – Simba Aug 20 '21 at 08:44
2

As @Simba correctly points out those packages are for linux-* platforms only. If your goal is simply to have a C/C++ compiler (not specifically GCC), consider instead using

conda install -c conda-forge compilers

This will install a platform-appropriate compiler on each platform, and populates the environment variables CC, CXX and GFORTRAN with paths to the respective compilers.

merv
  • 67,214
  • 13
  • 180
  • 245
  • Hello, I used your command and still wondering what is the next step if I want to download libgcc-ng and libstdcxx-ng packages? Thank you! – Zhang Yongheng Aug 19 '21 at 17:46
  • @ZhangYongheng if you want those particular packages, then my answer is not what you should follow. My answer addresses if you just need a compiler and not specifically GCC. Maybe you could expound upon your end goal (edit original question), not just the particular problem. – merv Aug 19 '21 at 18:06