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

ImportError: subprocess #4579

Closed
JohannesBuchner opened this issue Jul 2, 2015 · 1 comment
Closed

ImportError: subprocess #4579

JohannesBuchner opened this issue Jul 2, 2015 · 1 comment

Comments

@JohannesBuchner
Copy link

Using matplotlib, multiprocessing and astropy I run into this ImportError:

Traceback (most recent call last):
  File "/mnt/data/daten/PostDoc/research/agn/var/timeseries.py", line 7, in <module>
    import matplotlib
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 181, in <module>
    from matplotlib.compat import subprocess
  File "/usr/lib64/python2.7/site-packages/matplotlib/compat/subprocess.py", line 19, in <module>
    import subprocess
  File "/usr/lib64/python2.7/subprocess.py", line 427, in <module>
    import select
  File "/mnt/data/daten/PostDoc/research/agn/var/select.py", line 2, in <module>
    import astropy.io.fits as pyfits
  File "/usr/lib64/python2.7/site-packages/astropy/__init__.py", line 268, in <module>
    from .logger import _init_log, _teardown_log
  File "/usr/lib64/python2.7/site-packages/astropy/logger.py", line 15, in <module>
    from .utils.console import color_print
  File "/usr/lib64/python2.7/site-packages/astropy/utils/console.py", line 13, in <module>
    import multiprocessing
  File "/usr/lib64/python2.7/multiprocessing/__init__.py", line 65, in <module>
    from multiprocessing.util import SUBDEBUG, SUBWARNING
  File "/usr/lib64/python2.7/multiprocessing/util.py", line 41, in <module>
    from subprocess import _args_from_interpreter_flags
ImportError: cannot import name _args_from_interpreter_flags

The problem is that matplotlib uses its own module called subprocess, which makes the import of multiprocessing fail.

Please consider renaming your compat/subprocess module, so that it does not have the same name as the python standard library.

This bug can be circumvented by importing matplotlib last.

@JohannesBuchner
Copy link
Author

I see now that the bug is caused by having a file called "select.py"!

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

1 participant