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

pytype not using system ninja, even if it's there #1376

Closed
PythonCHB opened this issue Feb 20, 2023 · 2 comments
Closed

pytype not using system ninja, even if it's there #1376

PythonCHB opened this issue Feb 20, 2023 · 2 comments

Comments

@PythonCHB
Copy link

pytype using ninja (honestly, I haven't looked into how or why, but I'm sure you all know :-) (and I may be getting some of this wrong, but ...)

However, ninja is not a python package, so it has to be installed somehow.

For Python / pip users, a "ninja" package is on PyPi that is basically a wrapper around ninja so that it can be installed by pip. Nifty.

However, at least as of commit: 1a6d0b3 -- pytype seems to always try to call ninja via the python wrapper, which fails if the python wrapper isn't there, even though the ninja executable is there.

This is an issue for the conda-forge pytype package, which has been broken for some time (still trying to figure out when it last worked). conda-forge has a ninja package that installs the ninja executable, which works fine itself, but not with the current pytype package.

I imagine it would be an issue for any other system that can install ninja itself -- e.g. Linux distros.

This is discussed in the conda-forge "feedstock" repo here:

conda-forge/pytype-feedstock#97

@eli-schwartz
Copy link

I would suggest checking for both shutil.which('ninja') and from ninja import ninja to see which one is available.

@PythonCHB
Copy link
Author

from ninja import ninja

Make sure to wrap that in a:

try:
    from ninja import ninja
except ImportError:
    ...

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

Successfully merging a pull request may close this issue.

2 participants