popgenmethods / momi2

Infer demographic history with the Moran model
GNU General Public License v3.0
47 stars 11 forks source link

Segmentation fault and various numpy issues with CentOS 7.5.1804 #15

Closed grafau closed 5 years ago

grafau commented 5 years ago

Hi!

I am trying to use momi2 on my lab server (distribution: CentOS Linux release 7.5.1804 (Core); Python: 3.6.6)

When I tried to go through the tutorial with momi-2.1.14, i got segfault when importing simulated vcf: _python -m momi.readvcf

Then, I updated momi to momi-2.1.16 and now I get segfault during import: import momi

Your suggestions for troubleshooting would be most valuable.

Best, Rafal

jackkamm commented 5 years ago

Hi there --

Thanks for reporting, hope we can sort this out quickly.

Is there any notable output before/when it segfaults?

Also, are you installing through conda or pip? If using pip, could you try installing with conda and report what happens? (or vice versa)

I'll try to see if I can reproduce this on a clean CentOS vm later this week.

grafau commented 5 years ago

Hi!

1) in version 2.1.14 when I was reading vcf's, import would get stuck at different positions but error message would look like the one on the bottom of the message.

2) in version 2.1.16 during import there are no additional error messages provided

3) I installed momi with Conda. I have never really used pip before, when I tried now I was unsuccessful with momi import. I received following message (even after multiple re-installations of numpy):

ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try git clean -xdf (removes all files not under version control). Otherwise reinstall numpy.

Original error was: cannot import name multiarray

--------------- SEGFAULT 2.1.14 ---------------------

In [108]: %%sh

 ...:  

 ...: for chrom in `seq 1 20`; 

 ...: do 

 ...:     python -m momi.read_vcf \ 

 ...:            tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt \ 

 ...:            tutorial_datasets/$chrom.snpAlleleCounts.gz \ 

 ...:            --bed tutorial_datasets/$chrom.bed 

 ...: done 

sh: line 2: 125617 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 125765 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 125822 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 125934 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126014 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126090 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126190 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126278 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126357 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126431 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126511 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126585 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126697 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126775 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126851 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 126925 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 127071 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 127182 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 127263 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed

sh: line 2: 127341 Segmentation fault (core dumped) python -m momi.read_vcf tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt tutorial_datasets/$chrom.snpAlleleCounts.gz --bed tutorial_datasets/$chrom.bed


CalledProcessError Traceback (most recent call last)

in ----> 1 get_ipython().run_cell_magic('sh', '', '\nfor chrom in `seq 1 20`;\ndo\n python -m momi.read_vcf \\\n tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt \\\n tutorial_datasets/$chrom.snpAlleleCounts.gz \\\n --bed tutorial_datasets/$chrom.bed\ndone\n\n\n\n') ~/bin/miniconda3/envs/my-momi-env/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell) 2321 magic_arg_s = self.var_expand(line, stack_depth) 2322 with self.builtin_trap: -> 2323 result = fn(magic_arg_s, cell) 2324 return result 2325 ~/bin/miniconda3/envs/my-momi-env/lib/python3.6/site-packages/IPython/core/magics/script.py in named_script_magic(line, cell) 140 else: 141 line = script --> 142 return self.shebang(line, cell) 143 144 # write a basic docstring: in shebang(self, line, cell) ~/bin/miniconda3/envs/my-momi-env/lib/python3.6/site-packages/IPython/core/magic.py in (f, *a, **k) 185 # but it's overkill for just that one bit of state. 186 def magic_deco(arg): --> 187 call = lambda f, *a, **k: f(*a, **k) 188 189 if callable(arg): ~/bin/miniconda3/envs/my-momi-env/lib/python3.6/site-packages/IPython/core/magics/script.py in shebang(self, line, cell) 243 sys.stderr.flush() 244 if args.raise_error and p.returncode!=0: --> 245 raise CalledProcessError(p.returncode, cell, output=out, stderr=err) 246 247 def _run_script(self, p, cell, to_close): CalledProcessError: Command 'b'\nfor chrom in `seq 1 20`;\ndo\n python -m momi.read_vcf \\\n tutorial_datasets/$chrom.vcf.gz tutorial_datasets/ind2pop.txt \\\n tutorial_datasets/$chrom.snpAlleleCounts.gz \\\n --bed tutorial_datasets/$chrom.bed\ndone\n\n\n\n'' returned non-zero exit status 139.
grafau commented 5 years ago

Update:

PIP installation v2.1.16: 1) There is an issue with Python 3.7.1 numpy installation on my CentOS. When I installed Python 3.6.6, numpy compiled correctly, import of numpy and momi went smoothly.

2) with pip installation python3.6 -m momi.read_vcf works without segfault.

CONDA installation v2.1.16: 1) I am still getting segfault; based on my search it might have something to do with numpy again. Apparently segfaults happen when numpy tries to imported twice. Not sure how would that work practically.

2) I made a new, clean momi-env. Momi imports, but during import shows following warning:

miniconda3/envs/momi-env/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(*args, **kwds)

During read.vcf:

miniconda3/envs/momi-env/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88 return f(*args, **kwds)

Sorry for all the chaos. I am quite new to managing virtual envs and I might be doing something wrong. With each of 3 creations of momi-env and installation through conda, I get different problems, but they all seem to be linked to numpy somehow.

HTH, Rafal

jackkamm commented 5 years ago

Thanks for the update, and sorry I have not yet had time to fully investigate this.

The RuntimeWarning is currently happening for momi conda builds on all linux systems, and while very annoying, it should be safe to ignore according to Anaconda devs (https://github.com/ContinuumIO/anaconda-issues/issues/6678#issuecomment-337276215). Probably we need to change the way we build momi for conda.

I'll leave this issue open until I figure out how to silence this warning, and also until we've sorted out what's going on with Python 3.7 on CentOS here.

jackkamm commented 5 years ago

Since you've managed to get momi installed (albeit with RuntimeWarnings which can be ignored), and since I don't use CentOS, I'm going to close this as part of issue cleanup. Please comment and/or reopen if this becomes a blocking issue again.