KarchinLab / probabilistic2020

Simulates somatic mutations, and calls statistically significant oncogenes and tumor suppressor genes based on a randomization-based test
http://probabilistic2020.readthedocs.org
Apache License 2.0
8 stars 5 forks source link

installing probabilistic2020 fails with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 #6

Closed chaitanyapvk closed 5 years ago

chaitanyapvk commented 6 years ago

installing probabilistic2020 fails with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 .

In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:27:0, from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4, from prob2020/cython/cutils.cpp:311: /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h: At global scope: /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1634:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function] _import_array(void) ^~~~~ error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

ctokheim commented 6 years ago

I suspect that either you don't have a basic C/C++ compiler installed on your system or you don't have a "python-dev" system package installed. Is the operating system freshly installed and what operating system are you using?

chaitanyapvk commented 6 years ago

1) Thanks for the response. I recently updated my OS to Ubuntu 18.04 from 16.04. 2) Also I am having gcc compiler in /usr/bin and this is mentioned in my system PATH variable PATH=/usr/bin (this variable has more paths but I have mentioned here). I am able compile a general C program without any problem 3) python-dev is already installed when I try to install these libraries sudo apt-get install build-essential libssl-dev libffi-dev python-dev it says these are already installed

build-essential is already the newest version (12.4ubuntu1).
libffi-dev is already the newest version (3.2.1-8).
python-dev is already the newest version (2.7.15~rc1-1).
libssl-dev is already the newest version (1.1.0g-2ubuntu4.1).

4) I have ensured that the required dependent python packages are also installed with the specific version (pip freeze output for these packages)

numpy==1.10.4
scipy==0.14.1
pandas==0.17.0
pysam==0.8.4

I am attaching the build_log which can possibly tell which dependency is failing. build_log.txt

Please let me know if I have to do some thing different in this environment to fix this issue, I can provide additional information about environment if needed.

ctokheim commented 6 years ago

So it looks like you are trying to do a local installation of probabilistic2020. Is that correct? I would recommend installing it via pip. Also, I recommend using python 3.5 or 3.6. It was originally developed on python 2.7, but has since been migrated over to 3.5/3.6. I also only unit test on python 3.5 and 3.6 at this point.

chaitanyapvk commented 6 years ago

Thanks! pip3 install worked.

zmiimz commented 5 years ago

So it looks like you are trying to do a local installation of probabilistic2020. Is that correct? I would recommend installing it via pip.

you have redefined std::log2 function https://en.cppreference.com/w/cpp/numeric/math/log2 in permutation.hpp and it is qualified as error now. It is better to fix the code. log2 is part of the C++ standard library since C++11.

prob2020/cpp/permutation.hpp:8:44: error: ‘long double log2(long double)’ conflicts with a previous declaration
 inline long double log2(const long double x){
                                            ^
In file included from /usr/include/c++/7/math.h:36:0,
                 from /usr/include/python2.7/pyport.h:325,
                 from /usr/include/python2.7/Python.h:61,
                 from prob2020/cython/cutils.cpp:16:
/usr/include/c++/7/cmath:1589:3: note: previous declaration ‘constexpr long double std::log2(long double)’
   log2(long double __x)
   ^~~~
ctokheim commented 5 years ago

Hi,

Thanks for reporting the issue. Could you clarify what OS you are using? Currently I can't reproduce the error on my travis ci build on ubuntu 14.04.

Best, Collin

zmiimz commented 5 years ago

Hi Collin,

thanks for the answer. I have Ubuntu 18.04 with default gcc version 7.3.0 here, which uses std=c++14. Ubuntu 14.04 has gcc-4.8 compiler with std=c++98. The problem with log2 can be fixed just by commenting out the inline function in hpp file (or using __cplusplus macro wrapper)

There is another issue in the package + python 3.7. Miniconda3-latest-Linux-x86_64.sh uses python 3.7 and there is problem with old cpp files from cython: they are incompatible with python 3.7 (see https://github.com/cython/cython/issues/1955) Even after fixing log2 issue, I got multiple compiler errors. Should I open a new issue for that? I found workaround for this (without regeneration cpp files with new cython) by using explicitly python 3.6 in the command: conda env create -f environment_python.yml --prefix=2020plus python=3.6

... Unfortunately, after these changes I cannot reproduce exactly results for pancan_example. F.e. the number and order of gene names in produced rff_onco.txt is not the same as in the reference result directory...

ctokheim commented 5 years ago

Ok, that explains it, you are using the latest ubuntu version which I haven't tested against. As not everyone will necessarily have the latest OS and corresponding default gcc version, I have put in a if/else directive based on C++11. Could you download the latest commit from master and see if that compiles correctly for you?

How big is the difference in the result for an FDR<0.1?

zmiimz commented 5 years ago

Thnx, yes, successfully compiled and installed into python 3.6 environment. Regarding test difference I need more testing and give report again soon.

ctokheim commented 5 years ago

I'm going to close out this issue, but let me know if you have any remaining problems. The fix is included in version 1.2.1 of the package. I also now recommend use of python3.6 in the docs.