NucleoATAC icon indicating copy to clipboard operation
NucleoATAC copied to clipboard

Cython compilation errors, 'CompileError: command 'gcc' failed with exit status 1\n'

Open evanbiederstedt opened this issue 7 years ago • 4 comments

I've installed the package with python 2.7.14 as recommend. Using gcc (GCC) 6.2.0

Processing /path/location/NucleoATAC
  Requirement already satisfied (use --upgrade to upgrade): NucleoATAC==0.3.2 from file://path/location/NucleoATAC in /path/python-2.7.14/lib/python2.7/site-packages
Requirement already satisfied: cython>=0.22 in /path/python-2.7.14/lib/python2.7/site-packages (from NucleoATAC==0.3.2)
Requirement already satisfied: numpy>=1.9.1 in /path/python-2.7.14/lib/python2.7/site-packages (from NucleoATAC==0.3.2)
Requirement already satisfied: scipy>=0.16.0 in /path/python-2.7.14/lib/python2.7/site-packages (from NucleoATAC==0.3.2)
Requirement already satisfied: pysam>=0.8.1 in /path/python-2.7.14/lib/python2.7/site-packages (from NucleoATAC==0.3.2)
Requirement already satisfied: matplotlib in /path/python-2.7.14/lib/python2.7/site-packages (from NucleoATAC==0.3.2)
Requirement already satisfied: backports.functools-lru-cache in /path/python-2.7.14/lib/python2.7/site-packages (from matplotlib->NucleoATAC==0.3.2)
Requirement already satisfied: six>=1.10 in /path/python-2.7.14/lib/python2.7/site-packages (from matplotlib->NucleoATAC==0.3.2)
Requirement already satisfied: pytz in /path/python-2.7.14/lib/python2.7/site-packages (from matplotlib->NucleoATAC==0.3.2)
Requirement already satisfied: subprocess32 in /path/python-2.7.14/lib/python2.7/site-packages (from matplotlib->NucleoATAC==0.3.2)
Requirement already satisfied: cycler>=0.10 in /path/python-2.7.14/lib/python2.7/site-packages (from matplotlib->NucleoATAC==0.3.2)
Requirement already satisfied: python-dateutil>=2.0 in /path/python-2.7.14/lib/python2.7/site-packages (from matplotlib->NucleoATAC==0.3.2)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /path/python-2.7.14/lib/python2.7/site-packages (from matplotlib->NucleoATAC==0.3.2)

The specific versions of the libraries I'm using:

>>> cython.__version__
'0.27.3'
>>> numpy.__version__
'1.14.0'
>>> scipy.__version__
'1.0.0'
>>> pysam.__version__
'0.13'
>>> matplotlib.__version__
'2.1.1'

Here is the error I'm getting. Trouble-shooting ideas?

$ ./python-2.7.14/bin/python ./nucleoatac/run_nuc.py --bed nucleoATAC.bed --bam myfile.bam --fasta ./human_g1k_v37_decoy.decoy.fasta --out NucATAC

Error compiling Cython file:
------------------------------------------------------------
...
#### Import needed modules #####
import pyatac.seq as seq
import numpy as np
cimport numpy as np
cimport cython
from pysam.calignmentfile cimport AlignmentFile, AlignedSegment
^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:6:0: 'pysam/calignmentfile.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
#### Import needed modules #####
import pyatac.seq as seq
import numpy as np
cimport numpy as np
cimport cython
from pysam.calignmentfile cimport AlignmentFile, AlignedSegment
^
------------------------------------------------------------

/path/python2.7/site-packages/pyatac/fragments.pyx:6:0: 'pysam/calignmentfile/AlignmentFile.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
#### Import needed modules #####
import pyatac.seq as seq
import numpy as np
cimport numpy as np
cimport cython
from pysam.calignmentfile cimport AlignmentFile, AlignedSegment
^
------------------------------------------------------------

/path/python2.7/site-packages/pyatac/fragments.pyx:6:0: 'pysam/calignmentfile/AlignedSegment.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
import pyatac.seq as seq
import numpy as np
cimport numpy as np
cimport cython
from pysam.calignmentfile cimport AlignmentFile, AlignedSegment
from pysam.cfaidx cimport FastaFile
^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:7:0: 'pysam/cfaidx.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
import pyatac.seq as seq
import numpy as np
cimport numpy as np
cimport cython
from pysam.calignmentfile cimport AlignmentFile, AlignedSegment
from pysam.cfaidx cimport FastaFile
^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:7:0: 'pysam/cfaidx/FastaFile.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
@cython.boundscheck(False)
def makeFragmentMat(str bamfile, str chrom, int start, int end, int lower, int upper, int atac = 1):
    cdef int nrow = upper - lower
    cdef int ncol = end - start
    cdef np.ndarray[DTYPE_t, ndim=2] mat = np.zeros( (nrow, ncol), dtype = DTYPE)
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
        ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:21:9: 'AlignmentFile' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
def makeFragmentMat(str bamfile, str chrom, int start, int end, int lower, int upper, int atac = 1):
    cdef int nrow = upper - lower
    cdef int ncol = end - start
    cdef np.ndarray[DTYPE_t, ndim=2] mat = np.zeros( (nrow, ncol), dtype = DTYPE)
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
    cdef AlignedSegment read
        ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:22:9: 'AlignedSegment' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

@cython.boundscheck(False)
def getInsertions(str bamfile, str chrom, int start, int end, int lower, int upper, int atac = 1):
    cdef int npos = end - start
    cdef np.ndarray[DTYPE_t, ndim=1] mat = np.zeros(npos, dtype = DTYPE)
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
        ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:46:9: 'AlignmentFile' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
@cython.boundscheck(False)
def getInsertions(str bamfile, str chrom, int start, int end, int lower, int upper, int atac = 1):
    cdef int npos = end - start
    cdef np.ndarray[DTYPE_t, ndim=1] mat = np.zeros(npos, dtype = DTYPE)
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
    cdef AlignedSegment read
        ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:47:9: 'AlignedSegment' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
@cython.boundscheck(False)
def getStrandedInsertions(str bamfile, str chrom, int start, int end, int lower, int upper, int atac = 1):
    cdef int npos = end - start
    cdef np.ndarray[DTYPE_t, ndim=1] matplus = np.zeros(npos, dtype = DTYPE)
    cdef np.ndarray[DTYPE_t, ndim=1] matminus = np.zeros(npos, dtype = DTYPE)
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
        ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:75:9: 'AlignmentFile' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
def getStrandedInsertions(str bamfile, str chrom, int start, int end, int lower, int upper, int atac = 1):
    cdef int npos = end - start
    cdef np.ndarray[DTYPE_t, ndim=1] matplus = np.zeros(npos, dtype = DTYPE)
    cdef np.ndarray[DTYPE_t, ndim=1] matminus = np.zeros(npos, dtype = DTYPE)
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
    cdef AlignedSegment read
        ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:76:9: 'AlignedSegment' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

@cython.boundscheck(False)
def getAllFragmentSizes(str bamfile, int lower, int upper, int atac = 1):
    cdef np.ndarray[DTYPE_t, ndim =1] sizes = np.zeros(upper - lower, dtype= np.float)
    # loop over samfile
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
        ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:104:9: 'AlignmentFile' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
@cython.boundscheck(False)
def getAllFragmentSizes(str bamfile, int lower, int upper, int atac = 1):
    cdef np.ndarray[DTYPE_t, ndim =1] sizes = np.zeros(upper - lower, dtype= np.float)
    # loop over samfile
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
    cdef AlignedSegment read
        ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:105:9: 'AlignedSegment' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

@cython.boundscheck(False)
def getFragmentSizesFromChunkList(chunks, str bamfile, int lower, int upper, int atac = 1):
    cdef np.ndarray[DTYPE_t, ndim =1] sizes = np.zeros(upper - lower, dtype= np.float)
    # loop over samfile
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
        ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:126:9: 'AlignmentFile' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
@cython.boundscheck(False)
def getFragmentSizesFromChunkList(chunks, str bamfile, int lower, int upper, int atac = 1):
    cdef np.ndarray[DTYPE_t, ndim =1] sizes = np.zeros(upper - lower, dtype= np.float)
    # loop over samfile
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
    cdef AlignedSegment read
        ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:127:9: 'AlignedSegment' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
@cython.boundscheck(False)
def makeFragmentMat(str bamfile, str chrom, int start, int end, int lower, int upper, int atac = 1):
    cdef int nrow = upper - lower
    cdef int ncol = end - start
    cdef np.ndarray[DTYPE_t, ndim=2] mat = np.zeros( (nrow, ncol), dtype = DTYPE)
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
                                  ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:21:35: 'AlignmentFile' is not a constant, variable or function identifier

Error compiling Cython file:
------------------------------------------------------------
...

@cython.boundscheck(False)
def getInsertions(str bamfile, str chrom, int start, int end, int lower, int upper, int atac = 1):
    cdef int npos = end - start
    cdef np.ndarray[DTYPE_t, ndim=1] mat = np.zeros(npos, dtype = DTYPE)
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
                                  ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:46:35: 'AlignmentFile' is not a constant, variable or function identifier

Error compiling Cython file:
------------------------------------------------------------
...
@cython.boundscheck(False)
def getStrandedInsertions(str bamfile, str chrom, int start, int end, int lower, int upper, int atac = 1):
    cdef int npos = end - start
    cdef np.ndarray[DTYPE_t, ndim=1] matplus = np.zeros(npos, dtype = DTYPE)
    cdef np.ndarray[DTYPE_t, ndim=1] matminus = np.zeros(npos, dtype = DTYPE)
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
                                  ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:75:35: 'AlignmentFile' is not a constant, variable or function identifier

Error compiling Cython file:
------------------------------------------------------------
...

@cython.boundscheck(False)
def getAllFragmentSizes(str bamfile, int lower, int upper, int atac = 1):
    cdef np.ndarray[DTYPE_t, ndim =1] sizes = np.zeros(upper - lower, dtype= np.float)
    # loop over samfile
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
                                  ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:104:35: 'AlignmentFile' is not a constant, variable or function identifier

Error compiling Cython file:
------------------------------------------------------------
...

@cython.boundscheck(False)
def getFragmentSizesFromChunkList(chunks, str bamfile, int lower, int upper, int atac = 1):
    cdef np.ndarray[DTYPE_t, ndim =1] sizes = np.zeros(upper - lower, dtype= np.float)
    # loop over samfile
    cdef AlignmentFile bamHandle = AlignmentFile(bamfile)
                                  ^
------------------------------------------------------------

/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragments.pyx:126:35: 'AlignmentFile' is not a constant, variable or function identifier
/.pyxbld/temp.linux-x86_64-2.7/pyrex/pyatac/fragments.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
 #error Do not use this file, it is the result of a failed Cython compilation.
  ^~~~~
Traceback (most recent call last):
  File "./nucleoatac/run_nuc.py", line 17, in <module>
    from nucleoatac.NucleosomeCalling import NucChunk, NucParameters
  File "/path/python-2.7.14/lib/python2.7/site-packages/nucleoatac/NucleosomeCalling.py", line 13, in <module>
    from nucleoatac.Occupancy import OccupancyTrack
  File "/path/python-2.7.14/lib/python2.7/site-packages/nucleoatac/Occupancy.py", line 12, in <module>
    from pyatac.fragmentsizes import FragmentSizes
  File "/path/python-2.7.14/lib/python2.7/site-packages/pyatac/fragmentsizes.py", line 10, in <module>
    from pyatac.fragments import getAllFragmentSizes, getFragmentSizesFromChunkList
  File "/path/python-2.7.14/lib/python2.7/site-packages/pyximport/pyximport.py", line 458, in load_module
    language_level=self.language_level)
  File "/path/python-2.7.14/lib/python2.7/site-packages/pyximport/pyximport.py", line 233, in load_module
    exec("raise exc, None, tb", {'exc': exc, 'tb': tb})
  File "/path/python-2.7.14/lib/python2.7/site-packages/pyximport/pyximport.py", line 215, in load_module
    inplace=build_inplace, language_level=language_level)
  File "/path/python-2.7.14/lib/python2.7/site-packages/pyximport/pyximport.py", line 191, in build_module
    reload_support=pyxargs.reload_support)
  File "/path/python-2.7.14/lib/python2.7/site-packages/pyximport/pyxbuild.py", line 102, in pyx_to_dll
    dist.run_commands()
  File "/path/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/path/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/path/python-2.7.14/lib/python2.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/path/python2.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/path/python-2.7.14/lib/python2.7/site-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions
    self.build_extension(ext)
  File "/path/python2.7/distutils/command/build_ext.py", line 499, in build_extension
    depends=ext.depends)
  File "/path/python2.7/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/path/python2.7/distutils/unixccompiler.py", line 124, in _compile
    raise CompileError, msg
ImportError: Building module pyatac.fragments failed: ["CompileError: command 'gcc' failed with exit status 1\n"]

evanbiederstedt avatar Jan 12 '18 19:01 evanbiederstedt

I suspect one solution is to roll back dependencies to earlier versions, but the above is a bit odd

evanbiederstedt avatar Jan 12 '18 19:01 evanbiederstedt

Sorry I don't really have much to offer in way of guidance or suggestions. It seems like the issue would be with pysam, so rolling back the version there would be first thing to try.

AliciaSchep avatar Jan 29 '18 04:01 AliciaSchep

We were able to correct the module issue by cleaning up PYTHONPATH Tested the example workflow with pysam version 0.13

Python 2.7.14 (default, Dec  4 2017, 10:25:20)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysam
>>> pysam.__version__
'0.13'

Command run:  bin/nucleoatac run --bed example/example.bed --bam example/example.bam --fasta example/sacCer3.fa --out testing/anotherTest
nucleoatac version 0.3.4
start run at: 2018-01-29 16:06
---------Step1: Computing Occupancy and Nucleosomal Insert Distribution---------
Making figure
---------Step2: Processing Vplot------------------------------------------------
---------Step3: Obtaining nucleosome signal and calling positions---------------
---------Step4: Making combined nucleosome position map ------------------------
---------Step5: Calling NFR positions-------------------------------------------
end run at: 2018-01-29 16:07

Toseph avatar Jan 29 '18 22:01 Toseph

@Toseph

Tested the example workflow with pysam version 0.13

Excellent, thanks!

evanbiederstedt avatar Jan 29 '18 22:01 evanbiederstedt