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

Compile errors when using --jobs #219

Closed
Nexus6 opened this issue Feb 17, 2017 · 8 comments
Closed

Compile errors when using --jobs #219

Nexus6 opened this issue Feb 17, 2017 · 8 comments

Comments

@Nexus6
Copy link

Nexus6 commented Feb 17, 2017

I'm getting compiler crashes when I use the -j argument with the new 1.2.1 release. If I don't use -j then compilation of the same files succeeds.

$ coconut -v
Coconut: Version 1.2.1 [Colonel] running on Python 2.7.12
$ coconut -t27 -j2 -f .
Traceback (most recent call last):
  File "/home/eric/proj/mxologyGAE/local/lib/python2.7/site-packages/coconut/command/command.py", line 249, in handling_exceptions
    yield
  File "/home/eric/proj/mxologyGAE/local/lib/python2.7/site-packages/coconut/command/command.py", line 404, in running_jobs
    from concurrent.futures import ProcessPoolExecutor
ImportError: No module named concurrent.futures
Coconut: Exiting due to ImportError.
Traceback (most recent call last):
  File "/home/eric/proj/mxologyGAE/local/lib/python2.7/site-packages/coconut/command/command.py", line 249, in handling_exceptions
    yield
  File "/home/eric/proj/mxologyGAE/local/lib/python2.7/site-packages/coconut/command/command.py", line 111, in cmd
    self.use_args(args, interact)
  File "/home/eric/proj/mxologyGAE/local/lib/python2.7/site-packages/coconut/command/command.py", line 202, in use_args
    with self.running_jobs():
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/eric/proj/mxologyGAE/local/lib/python2.7/site-packages/coconut/command/command.py", line 410, in running_jobs
    self.exit_on_error()
  File "/home/eric/proj/mxologyGAE/local/lib/python2.7/site-packages/coconut/command/command.py", line 128, in exit_on_error
    kill_children()
  File "/home/eric/proj/mxologyGAE/local/lib/python2.7/site-packages/coconut/command/util.py", line 182, in kill_children
    import psutil
ImportError: No module named psutil
Coconut: Exiting due to ImportError.

@evhub
Copy link
Owner

evhub commented Feb 17, 2017

@Nexus6 See the installation documentation. You need to run pip install coconut[jobs] to get the necessary dependencies. It's supposed to fail nicely in that scenario, though, with a message telling you to do that. I'll try to fix that and make sure it fails nicely for the other optional dependencies as well.

@evhub evhub added this to the v1.2.2 milestone Feb 17, 2017
@Nexus6
Copy link
Author

Nexus6 commented Feb 17, 2017

I hadn't read the docs, I just did a pip -U update to an existing venv and I assumed that was all that was needed. I'll do a proper/correct coco update tomorrow and test again. Yeah the compiler complains (or used to) if you don't have the watcher component installed so as you say it would be good to have the same behavior for [jobs] and any other optional bits.

@Nexus6
Copy link
Author

Nexus6 commented Feb 18, 2017

A few observations.
A 'pip install coconut[jobs]' has a dependency on psutil. psutil in turn needs python.h to compile, which means the user needs to install the python-dev package on Linux (no idea about Windows). It might be helpful to mention this in the docs, and in particular the "python-dev" package name as it's not clear which Linux package contains python.h without doing a bit of homework. FWIW I'm on Mint Xfce so it's possible python-dev is installed by default on other distros.

On a brand-new 2.7 virtualenv, doing a "pip install coconut[all]" barfed because of the mypy dependency.

(fresh_new_coconut_project) eric@Moonshine ~/proj/fresh_new_coconut_project $ pip install coconut[all]
Collecting coconut[all]
  Using cached coconut-1.2.1-py2.py3-none-any.whl
Collecting prompt-toolkit<1.1,>=1.0 (from coconut[all])
  Using cached prompt_toolkit-1.0.13-py2-none-any.whl
Requirement already satisfied: pyparsing<2.1.11,>=2.1.10 in ./lib/python2.7/site-packages (from coconut[all])
Collecting pygments<2.3,>=2.2 (from coconut[all])
  Using cached Pygments-2.2.0-py2.py3-none-any.whl
Collecting jupyter<1.1,>=1.0; extra == "all" (from coconut[all])
  Downloading jupyter-1.0.0-py2.py3-none-any.whl
Collecting psutil<5.2,>=5.1; extra == "all" (from coconut[all])
Collecting watchdog<0.9,>=0.8; extra == "all" (from coconut[all])
Collecting mypy-lang<0.5,>=0.4; extra == "all" (from coconut[all])
  Downloading mypy-lang-0.4.6.tar.gz (620kB)
    100% |████████████████████████████████| 624kB 311kB/s 
    Complete output from command python setup.py egg_info:
    ERROR: You need Python 3.2 or later to use mypy.

It might be good somewhere in the docs(hope I didn't miss it ...) to mention that [all] and [mypy] will fail on py2.7.

Lastly, after seemingly successfully installing coconut + coconut[jobs] using a py27 venv, when compiling I still get

$ coconut -j2 -t27 -f .
Traceback (most recent call last):
  File "/home/eric/proj/fresh_new_coconut_project/local/lib/python2.7/site-packages/coconut/command/command.py", line 249, in handling_exceptions
    yield
  File "/home/eric/proj/fresh_new_coconut_project/local/lib/python2.7/site-packages/coconut/command/command.py", line 404, in running_jobs
    from concurrent.futures import ProcessPoolExecutor
ImportError: No module named concurrent.futures
Coconut: Exiting due to ImportError.

@evhub
Copy link
Owner

evhub commented Feb 18, 2017

@Nexus6 I'm looking into the dependency issues right now; I may try to put out a quick v1.2.2 release to fix them depending on how serious it looks.

evhub added a commit that referenced this issue Feb 18, 2017
@evhub
Copy link
Owner

evhub commented Feb 18, 2017

@Nexus6 I've uploaded a coconut-develop release that should hopefully fix the error. Let me know if it works, and if so, I'll push out a v1.2.1.1 release.

@evhub
Copy link
Owner

evhub commented Feb 19, 2017

As far as I can tell, I believe this has been fixed. Marking as resolved and closing the issue. @Nexus6 lmk if you're still experiencing any problems now on the latest coconut-develop (which will very soon be released).

@Nexus6
Copy link
Author

Nexus6 commented Feb 22, 2017

This seems to be fixed with 1.2.2. Thanks. The only comment I have w/regard to the fix is that when I
pip install coconut[all] on 2.7 I see:
Collecting mypy<0.472,>=0.471; extra == "all" (from coconut[all])
Using cached mypy-0.471.tar.gz
Complete output from command python setup.py egg_info:
ERROR: You need Python 3.2 or later to use mypy.

The scary "ERROR" text makes me think that the entire pip operation failed, but in fact it seems to have succeeded in all ways except for the mypy install. When I install a single thing (coconut[all] in this case) and get an ERROR, I naturally assume that the entire operation failed and that there won't be any side-effects from having tried the install. Side-effects == evil, right? :-)

@evhub
Copy link
Owner

evhub commented Feb 22, 2017

@Nexus6 That scary ERROR message is being emitted by MyPy, not Coconut, so there's not much I can do about it. I could change all to only try to install MyPy if your Python version is 3.2 or later, but then all would silently not install the necessary dependencies for --mypy, which is one of the things that it promises it does.

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

No branches or pull requests

2 participants