Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module '__main__' has no attribute '__spec__' #24

Open
paujedynak opened this issue Mar 20, 2020 · 4 comments
Open

AttributeError: module '__main__' has no attribute '__spec__' #24

paujedynak opened this issue Mar 20, 2020 · 4 comments

Comments

@paujedynak
Copy link

paujedynak commented Mar 20, 2020

Hi, I was trying to run comb-p pipeline on Windows, Python 3.8.1. Input file: sorted .bed with p values in the 4th column, obtained for 450k Illumina experiment:
1 69591 69592 0.982159693721179
1 790667 790668 0.869352157002484
1 800083 800084 0.976817881693934
1 805541 805542 0.217375018346954
1 812539 812540 0.31980048550337
1 834183 834184 0.435330819704651

After running a command:
python comb-p pipeline -c 4 --seed 0.001 --dist 500 -p mp --region-filter-p 0.05 --region-filter-n 2 full_path\bed_file.bed

I obtain the following output:

setting --acf-dist to 0.33 * --dist == 170
calculated stepsize as: 170
Traceback (most recent call last):
File "comb-p", line 4, in
import('pkg_resources').run_script('cpv==0.50.3', 'comb-p')
File "C:\Users\pauli\miniconda3\envs\pau1\lib\site-packages\pkg_resources_init_.py", line 667, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "C:\Users\pauli\miniconda3\envs\pau1\lib\site-packages\pkg_resources_init_.py", line 1464, in run_script
exec(code, namespace, namespace)
File "c:\users\pauli\miniconda3\envs\pau1\lib\site-packages\cpv-0.50.3-py3.8.egg\EGG-INFO\scripts\comb-p", line 39, in
main()
File "c:\users\pauli\miniconda3\envs\pau1\lib\site-packages\cpv-0.50.3-py3.8.egg\EGG-INFO\scripts\comb-p", line 36, in main
module.main()
File "C:\Users\pauli\miniconda3\envs\pau1\lib\site-packages\cpv-0.50.3-py3.8.egg\cpv\pipeline.py", line 70, in main
return pipeline(col_num, args.step,
File "C:\Users\pauli\miniconda3\envs\pau1\lib\site-packages\cpv-0.50.3-py3.8.egg\cpv\pipeline.py", line 101, in pipeline
putative_acf_vals = acf.acf(bed_files, lags, col_num, simple=False, mlog=mlog)
File "C:\Users\pauli\miniconda3\envs\pau1\lib\site-packages\cpv-0.50.3-py3.8.egg\cpv\acf.py", line 88, in acf
imap = get_map()
File "C:\Users\pauli\miniconda3\envs\pau1\lib\site-packages\cpv-0.50.3-py3.8.egg\cpv_common.py", line 169, in get_map
p = Pool(min(4, cpu_count()), pool_sig)
File "C:\Users\pauli\miniconda3\envs\pau1\lib\multiprocessing\context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
File "C:\Users\pauli\miniconda3\envs\pau1\lib\multiprocessing\pool.py", line 212, in init
self._repopulate_pool()
File "C:\Users\pauli\miniconda3\envs\pau1\lib\multiprocessing\pool.py", line 303, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
File "C:\Users\pauli\miniconda3\envs\pau1\lib\multiprocessing\pool.py", line 326, in _repopulate_pool_static
w.start()
File "C:\Users\pauli\miniconda3\envs\pau1\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\pauli\miniconda3\envs\pau1\lib\multiprocessing\context.py", line 326, in _Popen
return Popen(process_obj)
File "C:\Users\pauli\miniconda3\envs\pau1\lib\multiprocessing\popen_spawn_win32.py", line 45, in init
prep_data = spawn.get_preparation_data(process_obj._name)
File "C:\Users\pauli\miniconda3\envs\pau1\lib\multiprocessing\spawn.py", line 183, in get_preparation_data
main_mod_name = getattr(main_module.spec, "name", None)
AttributeError: module 'main' has no attribute 'spec'

I was wondering if this can be fixed somehow. Thank you!
Pau

@brentp
Copy link
Owner

brentp commented Mar 20, 2020

hi, I'm not able to help much on windows, but usually, you'd just run comb-p ... instead of python comb-p ... -- at least on linux.

@paujedynak
Copy link
Author

Thanks for the prompt reply! It seems to me that the error AttributeError: module 'main' has no attribute 'spec' is typical for python, not OS dependent, isn't it? The software seems to work until some point, the last printed message is:
setting --acf-dist to 0.33 * --dist == 170
calculated stepsize as: 170
and then it crashes.

And the python comb-p in my case is necessary, otherwise it does not work.

@ziphra
Copy link

ziphra commented Mar 23, 2021

Hello, I had the same issue, but I am running on Mac. I solved this issue using python3.7 instead of 3.8.

@brentp
Copy link
Owner

brentp commented Mar 23, 2021

If anyone has a proper solution to this, I'd be happy to incorporate it. I found some stackoverflow posts that suggest to add: __spec__ = None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants