Repository: statsmodels/statsmodels

Issue:
`pip install git+https://github.com/statsmodels/statsmodels.git` fails with `numpy is installed but older (1.14.5) than required (1.17)`
#### Describe the bug

As the title says, `pip install git+https://github.com/statsmodels/statsmodels.git` fails with `numpy is installed but older (1.14.5) than required (1.17)`.

#### Code Sample, a copy-pastable example if possible


```bash
# Your code here that produces the bug
# This example should be self-contained, and so not rely on external data.
# It should run in a fresh ipython session, and so include all relevant imports.

pip install git+https://github.com/statsmodels/statsmodels.git
```

This fails with:

```
+ pip install git+https://github.com/statsmodels/statsmodels.git
Collecting git+https://github.com/statsmodels/statsmodels.git
  Cloning https://github.com/statsmodels/statsmodels.git to /tmp/pip-req-build-se1gsaxj
  Running command git clone --filter=blob:none -q https://github.com/statsmodels/statsmodels.git /tmp/pip-req-build-se1gsaxj
  Resolved https://github.com/statsmodels/statsmodels.git to commit 19db7961b3388f85b4383d81f3caa3c9e809a532
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /opt/hostedtoolcache/Python/3.7.12/x64/bin/python /opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpuzaz9kp1
       cwd: /tmp/pip-req-build-se1gsaxj
  Complete output (25 lines):
  setup.py:61: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    req_ver = LooseVersion(SETUP_REQUIREMENTS[key])
  setup.py:64: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    ver = LooseVersion(mod.__version__)
  Traceback (most recent call last):
    File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-c2wv8145/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 163, in get_requires_for_build_wheel
      config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-c2wv8145/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-c2wv8145/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 268, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/tmp/pip-build-env-c2wv8145/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 66, in <module>
      raise RuntimeError(REQ_NOT_MET_MSG.format(key, ver, req_ver))
  RuntimeError:
  numpy is installed but older (1.14.5) than required (1.17). You must manually
  upgrade numpy before installing or install into a fresh virtualenv.
  
  ----------------------------------------
WARNING: Discarding git+https://github.com/statsmodels/statsmodels.git. Command errored out with exit status 1: /opt/hostedtoolcache/Python/3.7.12/x64/bin/python /opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpuzaz9kp1 Check the logs for full command output.
ERROR: Command errored out with exit status 1: /opt/hostedtoolcache/Python/3.7.12/x64/bin/python /opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpuzaz9kp1 Check the logs for full command output.
```

GitHub Actions log: https://github.com/mlflow/mlflow/runs/4736147038?check_suite_focus=true#step:9:1

<details>

**Note**: As you can see, there are many issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates.

**Note**: Please be sure you are using the latest released version of `statsmodels`, or a recent build of `main`. If your problem has been fixed in an unreleased version, you might be able to use `main` until a new release occurs. 

**Note**: If you are using a released version, have you verified that the bug exists in the main branch of this repository? It helps the limited resources if we know problems exist in the current main branch so that they do not need to check whether the code sample produces a bug in the next release.

</details>


If the issue has not been resolved, please file it in the issue tracker.

#### Expected Output

A clear and concise description of what you expected to happen.

#### Output of ``import statsmodels.api as sm; sm.show_versions()``

<details>

[paste the output of ``import statsmodels.api as sm; sm.show_versions()`` here below this line]

</details>



Discussion:
Probably a result of trying oldest numpy version in pyproject yesterday. Might need to revert. 
Is this in an empty environment? Which os? 
@bashtage Thanks for the quick response.

> Is this in an empty environment?

Yes.

> Which os?

We observed this issue in Ubuntu with python 3.7: https://github.com/mlflow/mlflow/runs/4736147038?check_suite_focus=true#step:9:44
Here's a dockerfile to reproduce the issue:

```dockerfile
FROM python:3.7

RUN pip install git+https://github.com/statsmodels/statsmodels.git
```

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -45,42 +45,18 @@
 ###############################################################################
 # Key Values that Change Each Release
 ###############################################################################
-SETUP_REQUIREMENTS = {
-    "numpy": "1.17",  # released July 2019
-    "scipy": "1.3",  # released May 2019
+# These are strictly installation requirements. Builds requirements are
+# managed in pyproject.toml
+INSTALL_REQUIREMENTS = {
+    "numpy": "1.18",  # released December 2019
+    "scipy": "1.4",  # released December 2019
+    "pandas": "1.0",  # released January 2020
+    "patsy": "0.5.2",  # released January 2018
+    "packaging": "21.3"  # released Nov 2021
 }
 
-REQ_NOT_MET_MSG = """
-{0} is installed but older ({1}) than required ({2}). You must manually
-upgrade {0} before installing or install into a fresh virtualenv.
-"""
-for key in SETUP_REQUIREMENTS:
-    from distutils.version import LooseVersion
-    import importlib
-
-    req_ver = LooseVersion(SETUP_REQUIREMENTS[key])
-    try:
-        mod = importlib.import_module(key)
-        ver = LooseVersion(mod.__version__)
-        if ver < req_ver:
-            raise RuntimeError(REQ_NOT_MET_MSG.format(key, ver, req_ver))
-    except ImportError:
-        pass
-    except AttributeError:
-        raise RuntimeError(REQ_NOT_MET_MSG.format(key, ver, req_ver))
-
-INSTALL_REQUIREMENTS = SETUP_REQUIREMENTS.copy()
-INSTALL_REQUIREMENTS.update(
-    {
-        "pandas": "0.25",  # released July 2019
-        "patsy": "0.5.2",  # released January 2018
-        "packaging": "21.3"
-    }
-)
-
-CYTHON_MIN_VER = "0.29.22"  # released 2020
+CYTHON_MIN_VER = "0.29.26"  # released 2020
 
-SETUP_REQUIRES = [k + ">=" + v for k, v in SETUP_REQUIREMENTS.items()]
 INSTALL_REQUIRES = [k + ">=" + v for k, v in INSTALL_REQUIREMENTS.items()]
 
 EXTRAS_REQUIRE = {
@@ -122,9 +98,9 @@
     "Development Status :: 4 - Beta",
     "Environment :: Console",
     "Programming Language :: Cython",
-    "Programming Language :: Python :: 3.7",
     "Programming Language :: Python :: 3.8",
     "Programming Language :: Python :: 3.9",
+    "Programming Language :: Python :: 3.10",
     "Operating System :: OS Independent",
     "Intended Audience :: End Users/Desktop",
     "Intended Audience :: Developers",
@@ -420,11 +396,10 @@ def is_pure(self):
     package_data=package_data,
     distclass=BinaryDistribution,
     include_package_data=False,  # True will install all files in repo
-    setup_requires=SETUP_REQUIRES,
     install_requires=INSTALL_REQUIRES,
     extras_require=EXTRAS_REQUIRE,
     zip_safe=False,
-    python_requires=">=3.7",
+    python_requires=">=3.8",
 )
 
 # Clean-up copied files
diff --git a/statsmodels/compat/pandas.py b/statsmodels/compat/pandas.py
--- a/statsmodels/compat/pandas.py
+++ b/statsmodels/compat/pandas.py
@@ -60,7 +60,7 @@
 assert_series_equal = testing.assert_series_equal
 
 
-def is_int_index(index: pd.Index):
+def is_int_index(index: pd.Index) -> bool:
     """
     Check if an index is integral
 
@@ -81,7 +81,7 @@ def is_int_index(index: pd.Index):
     )
 
 
-def is_float_index(index):
+def is_float_index(index: pd.Index) -> bool:
     """
     Check if an index is floating
 


Test patch: