21

I am trying to install pysam.

After excecuting:

python path/to/pysam-master/setup.py build

This error is produced:

unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory
error: command 'x86_64-conda_cos6-linux-gnu-gcc' failed with exit status 1

There are similar threads, but they all seem to address the problem assumig administriator rights, which I do not have. Is there a way around to install the needed files?

DISCLAIMER: This question derived from a previous post of mine. manually installing pysam error: "ImportError: No module named version" But since it might require a different approach, I made it a question of its own.

Sergio.pv
  • 1,380
  • 4
  • 14
  • 23
  • This has started appearing a couple of days ago and still seems to be an issue. – NirIzr Sep 28 '17 at 00:18
  • Had the same problem. Doing `conda update anaconda` solves the problem. Effectivelly it needed to upgrade both Python to version `3.6.2-hdfe5801_15 ` and Anaconda to `5.0.0.1-py36hfb0b618_1 ` – adonese Oct 02 '17 at 13:18

6 Answers6

26

You can also receive the same error while installing some R packages if R was installed using conda (as I had).

Then just install the package by executing: conda install gxx_linux-64 to have that command available.

Source: https://github.com/RcppCore/Rcpp/issues/770#issuecomment-346716808

MF.OX
  • 2,366
  • 1
  • 24
  • 28
  • 3
    Thanks for this, I am on Anaconda 4.4.7, recently installed, a full update showed nothing new, your answer solved my problem. (needed to `conda install gfortran_linux-64` as well for the package I was installing) – JimLohse Jan 23 '18 at 23:20
  • On macOS this doesn't work. What should i install for macOS? The error message is: "x86_64-apple-darwin13.4.0-clang" not found – NeoZoom.lua Apr 13 '23 at 16:09
15

It looks like Anaconda had a new release (4.3.27) that sets the C compiler path to a non-existing executable (quite an embarrassing bug; I'm sure they'll fix it soon). I had a similar issue with pip installing using the latest Miniconda, which I fixed by using the 4.3.21 version and ensuring I was not doing something like conda update conda.

See https://repo.continuum.io/miniconda/ which has release dates and versions.

Jon Riehl
  • 331
  • 2
  • 4
  • Can confirm this worked for me. I installed what was giving me issues first, then reinstalled spyder and all the other tools I did not have trouble installing since I was forced to update after the first time I ran `conda install` – jamzsabb Sep 28 '17 at 19:22
  • This is correct. Thanks Jon. The problem is that python bakes several compiler-related variables in at build time. We are using new compilers, and they are "prefixed." gcc doesn't exist - only x86_64-conda_cos6-linux-gnu-gcc. This is done to avoid conflicts, but comes at the cost of complication (and risk of bugs) New python packages will be available soon. This issue is being tracked at https://github.com/conda/conda/issues/6030 – msarahan Sep 29 '17 at 05:07
  • 1
    One additional comment: you can download the new compilers as the gcc_linux-64 package. There's also gxx_linux-64 and gfortran_linux-64 - they are split up. That might get you further. It's really meant to be used with conda-build 3, but it'll probably work fine outside of conda-build, too. Just make sure you activate your environment. Activation sets a lot of important environment variables that make the compiler work. You can activate the root environment - just type ``source activate root`` – msarahan Sep 29 '17 at 05:11
3

It should now be safe to update conda. This is fixed in the following python packages for linux-64:

  • python-3.6.2-h0b30769_14.tar.bz2
  • python-2.7.14-h931c8b0_15.tar.bz2
  • python-2.7.13-hac47a24_15.tar.bz2
  • python-3.5.4-hc053d89_14.tar.bz2

The issue was as Jon Riehl described - we (Anaconda, formerly Continuum) build all of our packages with a new GCC package that we created using crosstool-ng. This package does not have gcc, it has a prefixed gcc - the missing command you're seeing, x86_64-conda_cos6-linux-gnu-gcc. This gets baked into python, and any extension built with that python goes looking for that compiler. We have fixed the issue using the _PYTHON_SYSCONFIGDATA_NAME variable that was added to python 3.6. We have backported that to python 2.7 and 3.5. You'll now only ever see python using default compilers (gcc), and you must set the _PYTHON_SYSCONFIGDATA_NAME to the appropriate filename to have the new compilers used. Setting this variable is something that we'll put into the activate scripts for the compiler package, so you'll never need to worry about it. It may take us a day or two to get new compiler packages out, though, so post issues on the conda-build issue tracker if you'd like to use the new compilers and need help getting started.

Relevant code changes are at:

msarahan
  • 1,081
  • 9
  • 20
  • 1
    Miniconda has not yet been updated. It will be versioned as 4.3.27.1. We'll have new installers up when we can. For now, if you always do ``conda update conda && conda update python`` you should get a good version. – msarahan Sep 29 '17 at 23:44
  • I'm getting the same error: `unable to execute 'x86_64-conda_cos6-linux-gnu-gcc': No such file or directory` with the latest version of miniconda (from https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh). The error is generated when installing 'ggplot2' in R (r-base v3.4.2 installed via conda). I'm using conda v4.3.30 and python v3.6.3. I tried using conda v4.3.21, but that didn't help. Any ideas on what's going wrong? – sharchaea Oct 31 '17 at 10:08
  • 3
    `conda create -n renv r-essentials=1.7.0 gcc_linux-64` then `source activate renv` and away you go. We didn't make the compilers a dependency of r-base because not everyone wants to compile stuff from source. – Ray Donnelly Oct 31 '17 at 14:57
  • 2
    Also, you should prefer `conda` packages since we build them for you. `conda install r-ggplot2` gets you the `ggplot2` we built. here you can see the R packages we have built binaries of: https://docs.anaconda.com/anaconda/packages/r-language-pkg-docs – Ray Donnelly Oct 31 '17 at 15:23
  • I've had issues trying to recreate conda environments from *.yaml files that contain R packages installed through conda (mainly "package version not found" issues), which is why I've moved away from installing R packages via conda. I was hoping that `conda install gcc_linux-64` would allow me to install `ggplot2` and other packages via R, but I still get `... miniconda3/bin/x86_64-conda_cos6-linux-gnu-c++: not found` when installing plyr. – sharchaea Nov 11 '17 at 08:20
  • Also, `r-essentials` has a bunch of packages that my lab never uses for bioinformatics, so it just bloats the number of files in the anaconda or miniconda install, and we have inode limits for computational projects at our institute. Note that each project must be self-contained, so each must have its own miniconda or anaconda install. A bunch of projects means 100s of 1000s of files on the file server just from the miniconda/anaconda installs – sharchaea Nov 11 '17 at 08:26
  • @sharchaea, there's no requirement to use `r-essentials`, it is purely a convenience and this inode limit you face is I think, far from common. You can use `r-base` and whatever `r-*` packages you actually need. We have set dependencies up between them so the right ones should get used. Here your problem with `x86_64-conda_cos6-linux-gnu-c++` is that you are trying to compile an R package that uses C++ so you need to install `gxx_linux-64` too. – Ray Donnelly Nov 11 '17 at 12:08
2

After upgrading Golang to 1.19.1, I started to get:

# runtime/cgo 
cgo: C compiler "x86_64-conda-linux-gnu-cc" not found: exec: "x86_64-conda-linux-gnu-cc": executable file not found in $PATH

Installing gcc_linux-64 from the same channel, has resolved it:

conda install -c anaconda gcc_linux-64
Noam Manos
  • 15,216
  • 3
  • 86
  • 85
  • On macOS this doesn't work. What should i install for macOS? The error message is: "x86_64-apple-darwin13.4.0-clang" not found – NeoZoom.lua Apr 13 '23 at 16:09
0

The solution that worked for me was to use the conda to install the r packages:

conda install -c r r-tidyverse 

or r-gggplot2, r-readr

Also ensure that the installation is not failing because of admin privileges.

It will save you a great deal of pain

-1

Somewhere in your $PATH (e.g., ~/bin), do

ln -sf $(which gcc) x86_64-conda_cos6-linux-gnu-gcc

Don't put this in a system directory or conda's bin directory, and remember to remove the link when the problem is resolved upstream. gcc --version should be version 6.

EDIT: I understand the sentiment in the comments against manipulating system paths, but maybe we can use a little critical thinking for the actual case in hand before reciting doctrine. What actually have we done with the command above? Nothing more than putting an executable (symlink) called x86_64-conda_cos6-linux-gnu-gcc in one's personal ~/bin directory.

If putting something in one's personal ~/bin directory broke future conda (after it fixes the C compiler path to point to gcc it embeds), then that would be a bug with conda. Would the existence of this verbosely named compiler mess with anything else? Unlikely either. Even if something did pick it up, it's just your system gcc after all...

P. B.
  • 417
  • 6
  • 12
  • Now I get to the same error but differently: `cc1: error: unrecognized command line option "-fstack-protector-strong" cc1: error: unrecognized command line option "-fno-plt" pysam/libchtslib.c:1: error: bad value (haswell) for -mtune= switch error: command 'x86_64-conda_cos6-linux-gnu-gcc' failed with exit status 1` – Sergio.pv Sep 28 '17 at 09:11
  • 1
    I recommend against fiddling randomly with symlinks to resolve this type of issue. Jon Riehl mentioned the existence of a bug and a sound solution to the problem (using an earlier conda). – Pierre de Buyl Sep 28 '17 at 11:38
  • @Sergio.pv You probably need to update gcc. Check `gcc --version` and make sure it's at least 6. – P. B. Sep 28 '17 at 16:45
  • @PierredeBuyl Could you please explain why? Nirlzr indicated this error has existed for a few days. This means you have to freeze conda version, because `conda install ANY_PACKAGE` would also update conda itself. I'm not sure why that is a better workaround, especially if the bug is indeed just due to the new release hard-coding compiler name somewhere. – P. B. Sep 28 '17 at 16:51
  • `conda install` only updates the packages that need to be updated. You can even force conda to not update dependencies with the option [--no-update-dependencies](https://conda.io/docs/commands/conda-install.html). As far as symlinking goes, it is a risk for future updates and it makes the diagnosis of your system by others very difficult. Possible mismatches of runtime libraries is also an issue. – Pierre de Buyl Sep 28 '17 at 17:07
  • Sorry for the delay. I installed an older version of Anaconda (Anaconda2-4.3.1-Linux-x86_64.sh). Then pysam installation was succesfull – Sergio.pv Sep 28 '17 at 17:25
  • @PierredeBuyl `conda install` always prompts me to update conda itself if there is a newer version. Yes I can suppress that if I remember to use the no-update option. Regarding symlinking, I would argue that only doing it in the opposite direction has the implications you mentioned (symlinking an obscure installation of gcc to the canonical name in the default system directory. Of course, in either case, one would ideally remove the link after the problem is resolved. – P. B. Sep 28 '17 at 18:00
  • 1
    To prevent conda from updating itself, ``conda config --set auto_update_conda false`` – msarahan Sep 29 '17 at 12:22
  • I really wouldn't recommend doing this - as @pierre-de-buyl says. Your local C compiler could be incompatible with the one used to build the conda libraries leading to some confusing errors in the future (when you've probably forgotten about making this symlink) – danodonovan Feb 02 '18 at 10:44
  • @danodonovan But how would gcc version 6 be incompatible with `x86_64-conda_cos6-linux-gnu-gcc` that conda uses? – P. B. Feb 04 '18 at 19:34
  • @PengBai Can you guarantee it always *will* be compatible? What if someone has a different GCC installed, or goes and updates their GCC to an incompatible version? (from experience) Its far safer to avoid symlink-ing binaries from different sources and focus on the root cause ie the now-fixed conda bug. – danodonovan Feb 05 '18 at 09:46
  • @danodonovan When the conda bug is fixed, will it favor the compiler it vendored in the case there are identically named executables in one's `~/bin` directory? I think it should, and then there is no problem with future conda upgrades. If not, I would say it's a bug? – P. B. Feb 13 '18 at 02:40