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

Python 3.8: Migrate connected formulae #47326

Closed
wants to merge 63 commits into from

Conversation

bayandin
Copy link
Member

@bayandin bayandin commented Nov 29, 2019

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

This PR is a rough approach to migration connected formulae to python@3.8.

Ref #47274

@bayandin
Copy link
Member Author

bayandin commented Nov 29, 2019 via email

@Bo98
Copy link
Member

Bo98 commented Nov 29, 2019

The superenv should put dependencies at the front of the PATH list, including keg-only dependencies.

What might be happening is regular python is being pulled in somewhere, perhaps as a build-only dependency.

@Bo98
Copy link
Member

Bo98 commented Nov 30, 2019

Progress so far

  • boost-python3 doesn't work - last 15 lines of logs are insufficient to tell why.
  • csound needs migrating.
  • itstool has the wrong PYTHON environment variable.
  • libpeas might be picking up the wrong Python.
  • vtk has the wrong include path (m suffix). Also is picking up 3.7 as an interpreter but not overly critical.

There's perhaps other cases of picking up the wrong Python that might be going unnoticed. Really, I should see where the hole is that it is picking up 3.7.

@bayandin
Copy link
Member Author

bayandin commented Dec 2, 2019

The superenv should put dependencies at the front of the PATH list, including keg-only dependencies.

What might be happening is regular python is being pulled in somewhere, perhaps as a build-only dependency.

Good to know, will remove redundant PATH prepending

There's perhaps other cases of picking up the wrong Python that might be going unnoticed. Really, I should see where the hole is that it is picking up 3.7.

For vtk I've missed python@3.8 here:

-DPYTHON_EXECUTABLE=#{Formula["python"].opt_bin}/python3

Thanks for the help!

@bayandin
Copy link
Member Author

bayandin commented Dec 4, 2019

There's perhaps other cases of picking up the wrong Python that might be going unnoticed. Really, I should see where the hole is that it is picking up 3.7.

Looks like even if we are able to migrate all the connected formulae at once, there still be a case when user rebuilds a formula from source and they has both python and python@3.8 the formula could pick the "wrong" python.
Probably we need to set parameters for make/cmake for all the python@3.8 converted formulae..

@Bo98
Copy link
Member

Bo98 commented Dec 4, 2019

when user rebuilds a formula from source and they has both python and python@3.8 the formula could pick the "wrong" python

Apart from the test stage, that shouldn’t happen unless the build scripts are hardcoded to look at /usr/local over any paths which are set. Is there a particular example of this happening?

@bayandin
Copy link
Member Author

bayandin commented Dec 4, 2019

Is there a particular example of this happening?

I suspect adios2:

cmake reports:

-- Found PythonLibs: /usr/local/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib (found version "3.7.5") 

Here is the failed installation: https://jenkins.brew.sh/job/Homebrew%20Core%20Pull%20Requests/52862/version=highsierra/testReport/junit/brew-test-bot/high_sierra/install___build_bottle_adios2/

@Bo98
Copy link
Member

Bo98 commented Dec 4, 2019

It's because cmake_find_frameworks does not use CMAKE_FRAMEWORK_PATH for some reason. I might consider that a bug worth fixing in CMake...

-DCMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS=/usr/local/opt/python@3.8/Frameworks/Python.framework works but this is very problematic as a call to, say, cmake_find_framework(Tk) would also return the Python framework...

If you can find a way to get -DCMAKE_FIND_FRAMEWORK_EXTRA_LOCATIONS=/usr/local/opt/python@3.8/Frameworks/\${fwk}.framework to work that would be nice.

https://gitlab.kitware.com/cmake/cmake/blob/f7ca8fc24ccb4e7724d2228d9997b2df99e71133/Modules/CMakeFindFrameworks.cmake#L26

@Bo98
Copy link
Member

Bo98 commented Dec 4, 2019

Another possibility is to symlink libpython3.8.dylib in lib if that is acceptable and doesn't cause problems elsewhere.

@bayandin
Copy link
Member Author

bayandin commented Dec 4, 2019

This cmake issue looks relevant: https://gitlab.kitware.com/cmake/cmake/issues/18204 (Closed)

@Bo98
Copy link
Member

Bo98 commented Dec 5, 2019

Just to add that if we do this:

Another possibility is to symlink libpython3.8.dylib in lib if that is acceptable and doesn't cause problems elsewhere.

then we also need to symlink the contents of include as well. The reason it works is because CMake prioritises the lib and include directories over frameworks in FindPythonLibs.

I'll look further into suggesting a patch for framework searching upstream at the weekend.

@bayandin
Copy link
Member Author

bayandin commented Dec 5, 2019

Just to add that if we do this:

Another possibility is to symlink libpython3.8.dylib in lib if that is acceptable and doesn't cause problems elsewhere.

then we also need to symlink the contents of include as well. The reason it works is because CMake prioritises the lib and include directories over frameworks in FindPythonLibs.

I think we should consider @iMichka's suggestion:

We could explicitly set the right python path, like we are doing for VTK: https://github.com/Homebrew/homebrew-core/blob/master/Formula/vtk.rb#L59-L61

      -DPYTHON_EXECUTABLE=#{Formula["python"].opt_bin}/python3
      -DPYTHON_INCLUDE_DIR=#{py_prefix}/include/python#{pyver}m
      -DPYTHON_LIBRARY=#{py_prefix}/lib/libpython#{pyver}.dylib

It's explicit but will require to change all the formulae depending on python and cmake

@Bo98
Copy link
Member

Bo98 commented Dec 5, 2019

Note that those which use the newer FindPython/FindPython3 won't work with those variables, but do have a better framework check anyway. So it's not quite everything depending on CMake.

@basictheprogram
Copy link
Contributor

12 days since the last comment.

How migration going?

I've asked in other tickets how I can help, been directed to this ticket, so I'll post here, that I am available to help.

Was told needed to "wait" on this pull to be merge before I can help.

Can the work not be done in parallel or distributed?

Seem like a lot of work and responsibility for just 1 person.

@iMichka
Copy link
Member

iMichka commented Dec 17, 2019

It's not just one person, we are a few maintainers working on this.
As you have seen, we do struggle with this update.
We have somewhat hit some problems, mostly due to too many formulae to update at once.

Some of these formula were not compatible with Python 3.8 (backward compatibility?). Others failed to build (reproducible builds?). Build times are getting huge, and we our disk space on our CI has been exhausted .... With issues piling up, this is not an easy move.

I think that we will discuss all these issues in February during our annual homebrew meeting.
Until then, we need to get this PR going.

As a first step, we created a pyhton@3.8 formula, which is now merged: #47273

This python version will not be in your path, and can be found at:
/usr/local/Cellar/python@3.8/3.8.0/bin/python3

@iMichka
Copy link
Member

iMichka commented Dec 17, 2019

I would propose to rebase this and:

  • Remove the python@3.8 change, as this has now been merged and we have the formula (this should also slightly speed up the build).
  • Use my suggestion for adios2.

Let the build run and have a look at the logs, to see what needs to be still fixed.

We may still fill the hard drive of our bot. In that case I'll have a look at the brew test-bot code to add more aggressive brew cleanup calls ...

@bayandin
Copy link
Member Author

Rebased the branch and applied fixes for some formulae (stashed since the last run). Let's see how it goes

@bayandin
Copy link
Member Author

bayandin commented Dec 19, 2019

sphinx-doc fails because of virtualenv_install_with_resources. Will be fixed in Homebrew/brew#6858

@iMichka iMichka added the python Python use is a significant feature of the PR or issue label Dec 19, 2019
@jonchang jonchang mentioned this pull request Dec 20, 2019
@iMichka
Copy link
Member

iMichka commented Apr 4, 2020

pytouhou source repository is currently down

It is back up. At this point if it fails again we will pull this PR anyway. The same holds for any other not-so-important package, we had enough rebuilds now.

caffe fails style

Fixed

C: 69: 6: end at 69, 5 is not aligned with resource("test_model_weights").stage do at 64, 4.
astrometry-net still not playing ball on the Catalina CI for some reason. I wonder if there is a verbose mode or something that we could enable.

Fixed, I wrote a patch for it.

I triggered a new rebuild. If this is green we can pull the PR right away.

beckermr pushed a commit to esheldon/fitsio that referenced this pull request Apr 4, 2020
Fixes:

fitsio/hdu/table.py:234: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if data.shape is ():
fitsio/hdu/table.py:234: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if data.shape is ():

Error found in Homebrew/homebrew-core#47326
@iMichka iMichka closed this in 987c9e1 Apr 5, 2020
@bayandin
Copy link
Member Author

bayandin commented Apr 5, 2020

Great work @iMichka and @Bo98!

@iMichka
Copy link
Member

iMichka commented Apr 5, 2020

Thanks for the initial PR @bayandin !

Follow up PR: #52590
And @Bo98 is building the missing pytouhou Mojave bottle right now.

@bayandin bayandin deleted the python-3.8.0-p2 branch April 5, 2020 11:20
@lock lock bot added the outdated PR was locked due to age label May 5, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age python Python use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants