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

Update patches for 1.7.0 #43

Merged
merged 45 commits into from
Jan 21, 2022
Merged

Update patches for 1.7.0 #43

merged 45 commits into from
Jan 21, 2022

Conversation

jjyao
Copy link
Contributor

@jjyao jjyao commented Dec 3, 2021

Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number (if the version is unchanged)
  • Reset the build number to 0 (if the version changed)
  • Re-rendered with the latest conda-smithy (Use the phrase @conda-forge-admin, please rerender in a comment in this PR for automated rerendering)
  • Ensured the license file is being packaged.

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

@h-vetinari
Copy link
Member

It looks like bazel doesn't like the following:

version_info = bazel_invoke(subprocess.check_output, ["--version"])

as it results in

[FATAL 19:45:39.671 src/main/cpp/blaze.cc:1293] Unknown startup option: '--version'.
  For more info, run 'bazel help startup_options'

@h-vetinari
Copy link
Member

Windows looks even worse. I'd suggest to leave the bazel version untouched for now, unless absolutely necessary for upstream.

@h-vetinari
Copy link
Member

I had tried rebasing the patches for 1.7.0 myself, but ran into other problems. So far, @vnlitvinov and @krfricke haven't responded for comment.

I appreciate that you're giving this a shot - hopefully you get further than I do and we can unblock this!

@vnlitvinov
Copy link
Contributor

My guess is this is too new Bazel version (I see upstream updated to 4.2.1, but maybe they did it later than 1.7.0 this tries to tackle).

As for Windows - it seems either directory layout was changed, or repository, or symlink->junction replacement was unsuccessful. Symlinks in git under Windows do not behave well...

- bazel_version = tuple(map(int, bazel_version_digits))
- if bazel_version < SUPPORTED_BAZEL:
- logger.warning("Expected Bazel version {} but found {}".format(
- ".".join(map(str, SUPPORTED_BAZEL)), bazel_version_str))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest you add the removal of SUPPORTED_BAZEL variable in this patch, too. It would make it so next time upstream changes Bazel version we'll have a merge conflict here which would prompt us to update the Bazel version in the recipe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUPPORTED_BAZEL is still needed in the setup.py. Also I'm removing that bazel version check code in the upstream as well: ray-project/ray#20990

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea with removing the declaration was to create a conflict here in conda-forge when required Bazel version changes, so meta.yaml would be updated accordingly (kind of semi-automatic version check).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about purposely creating a conflict when Bazel required version changes? so meta.yaml could be updated when this happens

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to defer it to a separate PR: we need a solution not just for bazel but for all dependencies in meta.yaml. Currently I need to manually update them and make sure they are consistent with the versions in the upstream. We need a better solution here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency is semi-automatic with current solution - a merge conflict happens when something is changed in setup.py which touches the dependencies. Ideally this should be fully automatic, I totally agree, but I don't have better solution yet.

It would be awesome if you could come up with any better approach, I would gladly copy it to other conda packages I maintain 🙃

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so worried about patching this out. If the recipe builds and passes the tests, then - ipso facto - the bazel version wasn't doing too badly. OTOH, if we're using a bazel version that's really not supported, things will fail loudly anyway.

That said, I don't think it's a bad idea what @vnlitvinov is suggesting - explicit is better than implicit, and as such we'd get a clear reminder (through a rebase conflict) if the supported bazel version changed. But it doesn't have to be done for this PR, IMO, let's just try to keep moving through the queue first.

Thanks for pushing on this BTW, @jjyao! :)

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipe) and found some lint.

Here's what I've got...

For recipe:

  • Selectors are suggested to take a <two spaces>#<one space>[<expression>] form. See lines [65]

For recipe:

  • Recipes should usually depend on matplotlib-base as opposed to matplotlib so that runtime environments do not require large packages like qt.

@conda-forge-linter
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

I do have some suggestions for making it better though...

For recipe:

  • Recipes should usually depend on matplotlib-base as opposed to matplotlib so that runtime environments do not require large packages like qt.

@jjyao
Copy link
Contributor Author

jjyao commented Dec 20, 2021

@h-vetinari I faced the same issue as you Python Configuration Error: Problem getting python include path for /home/conda/feedstock_root/build_artifacts/ray-packages_1639068846815/_build_env/bin/python.

One thing I noticed is that the python version in build_artifacts is python 3.10 not the target python version (3.6 - 3.9).

[root@8252aaf75e12 bin]# ls -lh python
lrwxrwxrwx 1 conda conda 10 Dec 20 18:51 python -> python3.10
[root@8252aaf75e12 bin]# pwd
/home/conda/feedstock_root/build_artifacts/ray-packages_1640025700006/_build_env/bin

Also I found the following in the output:

The following NEW packages will be INSTALLED:
    python:                   3.10.0-h543edf9_3_cpython conda-forge
...

The following NEW packages will be INSTALLED:
    python:           3.7.12-hf930737_100_cpython conda-forge
...

The following NEW packages will be INSTALLED:
    python:                               3.10.0-h543edf9_3_cpython conda-forge

I'm also reverting the bazel version to the old one and let's see if it works.

@jjyao
Copy link
Contributor Author

jjyao commented Dec 20, 2021

Even if I reverted the bazel version, it's still the same error Python Configuration Error: Problem getting python include path for /home/conda/feedstock_root/build_artifacts/ray-packages_1639068846815/_build_env/bin/python.

@jjyao
Copy link
Contributor Author

jjyao commented Dec 20, 2021

I think I found the issue:

The failure is from https://github.com/grpc/grpc/blob/master/third_party/py/python_configure.bzl:

def _get_python_include(repository_ctx, python_bin):
    """Gets the python include path."""
    result = _execute(
        repository_ctx,
        [
            python_bin,
            "-c",
            "from __future__ import print_function;" +
            "from distutils import sysconfig;" +
            "print(sysconfig.get_python_inc())",
        ],
        error_msg = "Problem getting python include path for {}.".format(python_bin),
        error_details = (
            "Is the Python binary path set up right? " + "(See ./configure or " +
            python_bin + ".) " + "Is distutils installed? " +
            _HEADERS_HELP
        ),
    )

The way how they check whether the command succeeds or not is by checking if stderr is empty (instead of exit code). With python 3.10, distutils is deprecated and we have

<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead

in stderr which caused the command to fail.

@jjyao
Copy link
Contributor Author

jjyao commented Dec 21, 2021

@conda-forge-admin, please rerender

@jjyao
Copy link
Contributor Author

jjyao commented Dec 21, 2021

Hmm, seems after rerender, the multi variant build is removed. Any ideas?

@vnlitvinov
Copy link
Contributor

Symlink support is already enabled I believe, but symlinks on Windows are a very funky business.

I had made some post-checkout replacements with junctions if you take a look at setup.py:
https://github.com/ray-project/ray/blob/1315293dd8c524fea863c2b25a4ad2daa84351fc/python/setup.py#L368-L421

If this patching is not an option, I think disabling streaming-related things is the best way to go, especially if they're going to be dropped soon - no point in fixing what's going to be removed very soon.

@jjyao
Copy link
Contributor Author

jjyao commented Jan 18, 2022

Hmm... The code you showed already exists in 1.7 not sure why it's not working.

@vnlitvinov
Copy link
Contributor

This time it looks the setup.py needs to be updated, as the directory layout changed - there seem to no longer be a new_dashboard directory.

@jjyao
Copy link
Contributor Author

jjyao commented Jan 18, 2022

Oh, yea new_dashboard is removed in 1.7.

@jjyao
Copy link
Contributor Author

jjyao commented Jan 18, 2022

At least we confirmed that we thought conda environment automatically sets IS_AUTOMATED_BUILD but it's not.

@jjyao
Copy link
Contributor Author

jjyao commented Jan 19, 2022

D:\bld\ray-packages_1642549985623\_h_env\lib\site-packages\setuptools\command\install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  setuptools.SetuptoolsDeprecationWarning,
D:\bld\ray-packages_1642549985623\_h_env\lib\site-packages\setuptools\command\easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  EasyInstallDeprecationWarning,
error: [WinError 3] The system cannot find the path specified: 'ray/streaming/generated'
Traceback (most recent call last):
  File "setup.py", line 364, in <module>
    replace_symlinks_with_junctions()
  File "setup.py", line 350, in replace_symlinks_with_junctions
    raise ValueError(f"Unexpected type of entry: '{path}'")
ValueError: Unexpected type of entry: 'ray\rllib'

Hmm... this symlink should be there.

@vnlitvinov
Copy link
Contributor

I have noticed just now that this line is incorrect:
https://github.com/ray-project/ray/blob/1315293dd8c524fea863c2b25a4ad2daa84351fc/python/setup.py#L419

It uses single quotes which Windows cmd.exe does not interpret correctly, this might be a reason why things fail here.

@jjyao
Copy link
Contributor Author

jjyao commented Jan 19, 2022

@vnlitvinov Are you saying we should do f"MKLINK /J \"{os.path.basename(link)}\" \"{target}\""? Although the failure is before this line.

Also for our windows pip package, we don't run replace_symlinks_with_junctions but just set git config --global core.symlinks true before checking out the code, can we config the same thing in conda environment?

@vnlitvinov
Copy link
Contributor

It should be easier for the reader if it's written as f'MKLINK /J "{os.path.basename(link)}" "{target}"' (as Python doesn't care about single or double quotes).

I don't know about configuring git in conda build, this needs some research.

@jjyao
Copy link
Contributor Author

jjyao commented Jan 19, 2022

I changed the source from a zip file to a git repo, it worked for linux but failed for windows:

Cloning into bare repository '/d/bld/git_cache/github.com/ray-project/ray.git'...
Traceback (most recent call last):
  File "C:\Miniconda\Scripts\conda-mambabuild-script.py", line 9, in <module>
    sys.exit(main())
  File "C:\Miniconda\lib\site-packages\boa\cli\mambabuild.py", line 215, in main
    call_conda_build(action, config)
  File "C:\Miniconda\lib\site-packages\boa\cli\mambabuild.py", line 187, in call_conda_build
    result = api.build(
  File "C:\Miniconda\lib\site-packages\conda_build\api.py", line 186, in build
    return build_tree(
  File "C:\Miniconda\lib\site-packages\conda_build\build.py", line 3083, in build_tree
    packages_from_this = build(metadata, stats,
  File "C:\Miniconda\lib\site-packages\conda_build\build.py", line 2133, in build
    try_download(m, no_download_source=False, raise_error=True)
  File "C:\Miniconda\lib\site-packages\conda_build\render.py", line 649, in try_download
    source.provide(metadata)
  File "C:\Miniconda\lib\site-packages\conda_build\source.py", line 863, in provide
    git = git_source(source_dict, metadata.config.git_cache, src_dir, metadata.path,
  File "C:\Miniconda\lib\site-packages\conda_build\source.py", line 328, in git_source
    git_mirror_checkout_recursive(
  File "C:\Miniconda\lib\site-packages\conda_build\source.py", line 248, in git_mirror_checkout_recursive
    assert isdir(mirror_dir)
AssertionError

@jaimergp any ideas?

@jaimergp
Copy link
Member

Maybe something to do with git_depth? https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#source-from-git

it's an error during the git clone, but no idea why. Why do you need git as a source, instead of the tarball?

@jjyao
Copy link
Contributor Author

jjyao commented Jan 19, 2022

I'm trying to see if git clone fixes the symlink issue for us on windows. I'll revert back to tarball.

@jjyao
Copy link
Contributor Author

jjyao commented Jan 20, 2022

Finally, everything has passed. Could we merge it? @h-vetinari @vnlitvinov @krfricke

Copy link
Contributor

@vnlitvinov vnlitvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally! Congratulations to everyone involved!

Comment on lines +19 to +29
- r"ray\new_dashboard": "../../dashboard",
+ r"ray\dashboard": "../../dashboard",
r"ray\rllib": "../../rllib",
r"ray\streaming": "../../streaming/python/",
}
@@ -353,7 +353,7 @@ def replace_symlinks_with_junctions():
os.path.join(os.path.dirname(path), target))
logger.info("Setting {} -> {}".format(link, target))
subprocess.check_call(
- f"MKLINK /J '{os.path.basename(link)}' '{target}'",
+ f'MKLINK /J "{os.path.basename(link)}" "{target}"',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and these changes should also be upstreamed, I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@vnlitvinov
Copy link
Contributor

@jjyao thanks again for pushing this, I'll leave a day or so for others to review and, unless there would be no objections, I'm planning to merge this in ~24h.

Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently travelling without a laptop, but the bulk looks good, and I'm happy with a green CI already. 👍

Since the commits are almost all named the same, I'd be in favour of a squash merge (or creating a more reasonable commit history, for example: all changes in recipe/, and a separate commit for the feedstock rerender)

host:
- nodejs
- nodejs <16.6.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be lifted again sometime soon-ish.

@@ -6,3 +6,8 @@ cudnn: # [linux64]
- undefined # [linux64]
cdt_name: # [linux64]
- cos7 # [linux64]

c_compiler: # [win]
- vs2019 # [win]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure (after adding, reverting, etc.), this now upgrades the windows compilers. I don't mind doing that (actually, even in favour since the death of vs2017 is hastened greatly by msft currently), but just wanted to check if this is now the intention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intentional since upstream also uses vs2019.

ericl pushed a commit to ray-project/ray that referenced this pull request Jan 20, 2022
Windows cmd.exe doesn't interpret single quote correctly. See conda-forge/ray-packages-feedstock#43
@vnlitvinov vnlitvinov merged commit 93c846c into conda-forge:master Jan 21, 2022
@jjyao jjyao deleted the jjyao/1.7.0 branch January 21, 2022 20:36
@vnlitvinov vnlitvinov mentioned this pull request Jan 24, 2022
3 tasks
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 this pull request may close these issues.

None yet

5 participants