BLD: fix build error for PyPy on macOS (#26536)
State: closed

- [x] closes #26536
- [ ] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

This change should have no effect on CPython, and may fix a crash in when trying to install using PyPy (see #26536).

I've given this a very quick check by installing locally with `pip install -e` (cpython 3.6 on mac). I dont have an easy way to check it on PyPy, so Im hoping the OP from #26536 can do this (@bhy)

Labels:
name: Build
description: Library building on various platforms

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=h1) Report
> Merging [#26862](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/430f0fd04646a0ab44ccbfbad706dfe22e9fabfe?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/26862/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #26862      +/-   ##
==========================================
- Coverage   91.88%   91.87%   -0.01%     
==========================================
  Files         179      179              
  Lines       50696    50696              
==========================================
- Hits        46581    46576       -5     
- Misses       4115     4120       +5
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.46% <ø> (ø)` | :arrow_up: |
| #single | `41.09% <ø> (-0.08%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `88.88% <0%> (-11.12%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.88% <0%> (-0.12%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `90.84% <0%> (-0.11%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=footer). Last update [430f0fd...85ed4f8](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=h1) Report
> Merging [#26862](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/430f0fd04646a0ab44ccbfbad706dfe22e9fabfe?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/26862/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #26862      +/-   ##
==========================================
- Coverage   91.88%   91.86%   -0.02%     
==========================================
  Files         179      180       +1     
  Lines       50696    50710      +14     
==========================================
+ Hits        46581    46584       +3     
- Misses       4115     4126      +11
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.45% <ø> (-0.02%)` | :arrow_down: |
| #single | `41.09% <ø> (-0.09%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `88.88% <0%> (-11.12%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.88% <0%> (-0.12%)` | :arrow_down: |
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `97.92% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/internals/managers.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL21hbmFnZXJzLnB5) | `95.21% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `94.38% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `97.79% <0%> (-0.01%)` | :arrow_down: |
| [pandas/io/api.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2FwaS5weQ==) | `100% <0%> (ø)` | :arrow_up: |
| [pandas/core/internals/construction.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2NvbnN0cnVjdGlvbi5weQ==) | `95.93% <0%> (ø)` | :arrow_up: |
| [pandas/io/spss.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3Nwc3MucHk=) | `46.15% <0%> (ø)` | |
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `97.91% <0%> (ø)` | :arrow_up: |
| ... and [2 more](https://codecov.io/gh/pandas-dev/pandas/pull/26862/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=footer). Last update [430f0fd...1398e30](https://codecov.io/gh/pandas-dev/pandas/pull/26862?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Thanks for the work! I'm testing this. Just to be sure, am I correct that pandas already dropped support for Python 2? `pip install` fails with invalid syntax on Python 2.

@robbuckley I've commented the line that needs minor fix (`str(current_system)`). With it fixed, the build will pass on pypy3.

Thank you!

Yes, py2 has been dropped.
@bhy thanks for testing, and pointing out the issue. I've fixed it in a slightly different way - would you mind giving the new code a check to make sure it installs with PyPy? thanks!
@robbuckley I tested again. Now installation works without any problem on PyPy. Thanks!


lgtm ex @TomAugspurger comment. ping on green.
all done
@robbuckley does this pass on the wheel building? if you can test
Seems easier to merge first and verify?

On Mon, Jun 17, 2019 at 6:39 AM Jeff Reback <notifications@github.com>
wrote:

> @robbuckley <https://github.com/robbuckley> does this pass on the wheel
> building? if you can test
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/26862?email_source=notifications&email_token=AAKAOIRKSHL2HDQRS4FIRV3P25ZX7A5CNFSM4HYNVBD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX24VIA#issuecomment-502647456>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAKAOIXZ2STPQQ7H2WOP7DLP25ZX7ANCNFSM4HYNVBDQ>
> .
>

I should be able to run the wheel builder script tomorrow. 
thanks @robbuckley that would be great
I ran the daily wheelbuilder on my fork, all passed.

But them I realised that the changed code would not have been executed under the wheel builder scripts, thanks to:

https://github.com/MacPython/pandas-wheels/blob/f3b5695939662666e69fb92d6a8eceeb26d0209a/config.sh#L12

since the changes are inside a check for: 
`if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:`.

So I pip installed the 3 macOS wheels built off my fork in suitable environments. That at least ensures the changed code has been executed. That plus @bhy's check that the PyPy issue seems to be fixed should be enough.
@robbuckley do we need < 10.9 supported any longer? (for going forwards in 0.25.0), I don't remember why we needed that in the first place.
@jreback we need it to build Python 3.5 wheels, since python.org don’t provide a 10’9 version of that
@robbuckley so reading your comments, this is good to go and pandas-wheels doesn't need any changing?
Yes, that’s right. I have a PR pending in pandas-wheels, but it’s independent of this one
thanks @robbuckley ping us on pandas-wheels for the PR