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 package is broken due to missing python ninja package. #97

Closed
1 task done
PythonCHB opened this issue Feb 19, 2023 · 7 comments · Fixed by #98
Closed
1 task done

Pytype package is broken due to missing python ninja package. #97

PythonCHB opened this issue Feb 19, 2023 · 7 comments · Fixed by #98
Labels
bug Something isn't working

Comments

@PythonCHB
Copy link
Contributor

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

The conda-forge package is broken (and unfixable :-( In short, it needs the python ninja package, but that package does not exist (yet) for conda-forge. There is a PR to add one, but it seems to be stalled out:

conda-forge/staged-recipes#19098

I'm not sure what the short term solution should be -- maybe pytype could vendor python-ninja? Or at least document that you need to pip-install the python ninja package to use it :-(

(and this issue might be that documentation for the moment)

But in any case, it's a bad idea to have a broken package in conda-forge :-(

Details:

create a new environment, with only pytype:

conda create -n pytype pytype

Try to use it:

(pytype) chris@Chris-MacBook pytype % pytype pytype_str.py 
Computing dependencies
Analyzing 1 sources with 0 local dependencies
/Users/chris/miniconda3/envs/pytype/bin/python: No module named ninja

The conda package ninja is there:

(pytype) chris@Chris-MacBook pytype % conda list ninja
# packages in environment at /Users/chris/miniconda3/envs/pytype:
#
# Name                    Version                   Build  Channel
ninja                     1.11.0               h1b54a9f_0    conda-forge

But that's not the Python module, hence it doesn't work.

If you pip install the python ninja package, all is fine:

(pytype) chris@Chris-MacBook pytype % pip install ninja
Collecting ninja
  Using cached ninja-1.11.1-py2.py3-none-macosx_10_9_universal2.macosx_10_9_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl (270 kB)
Installing collected packages: ninja
Successfully installed ninja-1.11.1

(pytype) chris@Chris-MacBook pytype % pytype pytype_str.py
Computing dependencies
Analyzing 1 sources with 0 local dependencies
ninja: Entering directory `.pytype'
[1/1] check pytype_str

...

All good.

Installed packages

(pytype) chris@Chris-MacBook pytype % 
(pytype) chris@Chris-MacBook pytype % conda list
# packages in environment at /Users/chris/miniconda3/envs/pytype:
#
# Name                    Version                   Build  Channel
atk-1.0                   2.38.0               h1d18e73_1    conda-forge
attrs                     22.2.0             pyh71513ae_0    conda-forge
bzip2                     1.0.8                h0d85af4_4    conda-forge
ca-certificates           2022.12.7            h033912b_0    conda-forge
cairo                     1.16.0            h904041c_1014    conda-forge
expat                     2.5.0                hf0c8a7f_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.2               h5bb23bf_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.12.1               h3f81eb7_1    conda-forge
fribidi                   1.0.10               hbcb3906_0    conda-forge
gdk-pixbuf                2.42.10              he00a9fc_0    conda-forge
gettext                   0.21.1               h8a4c099_0    conda-forge
giflib                    5.2.1                hbcb3906_2    conda-forge
graphite2                 1.3.13            h2e338ed_1001    conda-forge
graphviz                  7.1.0                hc51f7b9_0    conda-forge
gtk2                      2.24.33              h7c1209e_2    conda-forge
gts                       0.7.6                hccb3bdf_2    conda-forge
harfbuzz                  6.0.0                h08f8713_0    conda-forge
icu                       70.1                 h96cf925_0    conda-forge
importlab                 0.8                pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
jpeg                      9e                   hb7f2c08_3    conda-forge
lerc                      4.0.0                hb486fe8_0    conda-forge
libcst                    0.4.9           py310h896817c_0    conda-forge
libcxx                    14.0.6               hccf4f1f_0    conda-forge
libdeflate                1.17                 hac1461d_0    conda-forge
libffi                    3.4.2                h0d85af4_5    conda-forge
libgd                     2.3.3                h4685329_4    conda-forge
libglib                   2.74.1               h4c723e1_1    conda-forge
libiconv                  1.17                 hac89ed1_0    conda-forge
libpng                    1.6.39               ha978bb4_0    conda-forge
librsvg                   2.54.4               h3d48ba6_0    conda-forge
libsqlite                 3.40.0               ha978bb4_0    conda-forge
libtiff                   4.5.0                hee9004a_2    conda-forge
libtool                   2.4.7                hf0c8a7f_0    conda-forge
libwebp                   1.2.4                h70a068d_1    conda-forge
libwebp-base              1.2.4                h775f41a_0    conda-forge
libxml2                   2.10.3               hb9e07b5_0    conda-forge
libzlib                   1.2.13               hfd90126_4    conda-forge
markupsafe                2.1.2           py310h90acd4f_0    conda-forge
mypy_extensions           1.0.0              pyha770c72_0    conda-forge
ncurses                   6.3                  h96cf925_1    conda-forge
networkx                  2.8.3              pyhd8ed1ab_0    conda-forge
ninja                     1.11.0               h1b54a9f_0    conda-forge
openssl                   3.0.8                hfd90126_0    conda-forge
pango                     1.50.12              hbd9bf65_1    conda-forge
pcre2                     10.40                h1c4e4bc_0    conda-forge
pip                       23.0.1             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               hbcb3906_0    conda-forge
pydot                     1.4.2           py310h2ec42d9_3    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
python                    3.10.9          he7542f4_0_cpython    conda-forge
python_abi                3.10                    3_cp310    conda-forge
pytype                    2023.02.17      py310h7a76584_0    conda-forge
pyyaml                    6.0             py310h90acd4f_5    conda-forge
readline                  8.1.2                h3899abd_0    conda-forge
setuptools                67.3.2             pyhd8ed1ab_0    conda-forge
tabulate                  0.9.0              pyhd8ed1ab_1    conda-forge
tk                        8.6.12               h5dbffcc_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
typing-extensions         4.4.0                hd8ed1ab_0    conda-forge
typing_extensions         4.4.0              pyha770c72_0    conda-forge
typing_inspect            0.8.0              pyhd8ed1ab_0    conda-forge
tzdata                    2022g                h191b570_0    conda-forge
wheel                     0.38.4             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h775f41a_0    conda-forge
yaml                      0.2.5                h0d85af4_2    conda-forge
zlib                      1.2.13               hfd90126_4    conda-forge
zstd                      1.5.2                hbc0c0cd_6    conda-forge

Environment info

(pytype) chris@Chris-MacBook pytype % conda info

     active environment : pytype
    active env location : /Users/chris/miniconda3/envs/pytype
            shell level : 1
       user config file : /Users/chris/.condarc
 populated config files : /Users/chris/.condarc
          conda version : 22.9.0
    conda-build version : not installed
         python version : 3.9.13.final.0
       virtual packages : __osx=11.6.2=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /Users/chris/miniconda3  (writable)
      conda av data dir : /Users/chris/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/chris/miniconda3/pkgs
                          /Users/chris/.conda/pkgs
       envs directories : /Users/chris/miniconda3/envs
                          /Users/chris/.conda/envs
               platform : osx-64
             user-agent : conda/22.9.0 requests/2.28.1 CPython/3.9.13 Darwin/20.6.0 OSX/11.6.2
                UID:GID : 501:20
             netrc file : None
           offline mode : False
@PythonCHB PythonCHB added the bug Something isn't working label Feb 19, 2023
@PythonCHB
Copy link
Contributor Author

The lot thickens -- this may not be a pytype recipe bug, but a ninja package bug -- it doesn't seem to provide a working ninja command -- is pytype reverting to the python package due to that failure?

 % conda list
# packages in environment at /Users/chris/miniconda3/envs/junk:
#
# Name                    Version                   Build  Channel
libcxx                    14.0.6               hccf4f1f_0    conda-forge
ninja                     1.11.0               h1b54a9f_0    conda-forge
(junk) chris@Chris-MacBook pytype % ninja 
ninja: error: loading 'build.ninja': No such file or directory

bug reported to the ninja feedstock:

conda-forge/ninja-feedstock#31

@eli-schwartz
Copy link

This is an upstream pytype regression in google/pytype#642, and commit google/pytype@1a6d0b3 should be partially reverted to run ['ninja'] instead of _get_executable('ninja'). The latter unconditionally tries to run python -m ninja which is a python API that exists solely to install a real ninja program as a console_scripts entrypoint.

@PythonCHB
Copy link
Contributor Author

Thanks -- I took a look at the pytype code, and it's pretty buried.

Not sure what to do here -- yes,it's a pytype bug, but the fact is we have a feedstock that produces a package that doesn't work :-(

Maybe we should mark this version as broken (I think you can do that on anaconda.org), and not make a new one until pytype fixes its bug.

I"ve been trying to see how far back I have to go to get a working pytype, and no luck yet.

@PythonCHB
Copy link
Contributor Author

I couldn't find an issue in the pytype project, so I added one here:

google/pytype#1376

NOTE: I doubt they are going to revert that commit -- it was put in to solve a problem, but It also could be fixed, though all that code is a bit of a tangled mess, so I haven't figured out a PR :-(

@PythonCHB
Copy link
Contributor Author

I've been going back to older versions of the conda pytype package -- well before the refrences commit -- and I haven't yet found one that works :-(

It seems the pytype folks have been committed to the python-wrapped ninja for quite some time :-(

I've gone back to 2022.01.05 -- didn't work then. :-(

@ngam
Copy link
Contributor

ngam commented Feb 21, 2023

This is an upstream pytype regression in google/pytype#642, and commit google/pytype@1a6d0b3 should be partially reverted to run ['ninja'] instead of _get_executable('ninja'). The latter unconditionally tries to run python -m ninja which is a python API that exists solely to install a real ninja program as a console_scripts entrypoint.

We could patch this here ourselves. I will give this a try

@ngam
Copy link
Contributor

ngam commented Feb 21, 2023

see #98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants