Repository navigation
Closed
Description
I think the wheels for Windows on PyPi for statsmodels version 0.9 do not contain proper Requires-Dist keys. Therefore, e.g. pandas is not installed as a requirement for statsmodels.
I think this is the relevant section in the METADATA file of the wheel:
Requires-Dist: sphinx; extra == 'docs'
Requires-Dist: nbconvert; extra == 'docs'
Requires-Dist: jupyter-client; extra == 'docs'
Requires-Dist: ipykernel; extra == 'docs'
Requires-Dist: matplotlib; extra == 'docs'
Requires-Dist: nbformat; extra == 'docs'
Requires-Dist: numpydoc; extra == 'docs'
Requires-Dist: pandas-datareader; extra == 'docs'
Previously, installing statsmodels via pip gave this:
Collecting statsmodels>=0.5.0 (from dclab==0.4.0.dev44)
Downloading https://files.pythonhosted.org/packages/72/16/d7e7a70fc8ca3cc0d783a66e902a7adf80a810695c357cd48bb22c82451a/statsmodels-0.8.0.tar.gz (9.5MB)
Collecting six (from h5py->dclab==0.4.0.dev44)
Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting pillow (from imageio->dclab==0.4.0.dev44)
Downloading https://files.pythonhosted.org/packages/0d/5f/0803065fa0b5cdae29fa70342134151443da3598bcc656350e745d82ec6a/Pillow-5.1.0-cp27-cp27m-win_amd64.whl (1.5MB)
Collecting pandas (from statsmodels>=0.5.0->dclab==0.4.0.dev44)
Downloading https://files.pythonhosted.org/packages/10/7b/5b29a9601e322c8a94c15894216bce14dad9cbac933abebce271dbcc5b9a/pandas-0.22.0-cp27-cp27m-win_amd64.whl (9.1MB)
Collecting patsy (from statsmodels>=0.5.0->dclab==0.4.0.dev44)
Downloading https://files.pythonhosted.org/packages/5d/eb/92c4b45ca47a2dd1339c958636e083b50ffadb5162a599a1cbbe92f89832/patsy-0.5.0-py2.py3-none-any.whl (232kB)
Collecting pytz>=2011k (from pandas->statsmodels>=0.5.0->dclab==0.4.0.dev44)
Downloading https://files.pythonhosted.org/packages/dc/83/15f7833b70d3e067ca91467ca245bae0f6fe56ddc7451aa0dc5606b120f2/pytz-2018.4-py2.py3-none-any.whl (510kB)
Collecting python-dateutil (from pandas->statsmodels>=0.5.0->dclab==0.4.0.dev44)
Downloading https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl (211kB)
Building wheels for collected packages: pathlib, statsmodels
Running setup.py bdist_wheel for pathlib: started
Running setup.py bdist_wheel for pathlib: finished with status 'done'
Stored in directory: C:\Users\appveyor\AppData\Local\pip\Cache\wheels\f9\b2\4a\68efdfe5093638a9918bd1bb734af625526e849487200aa171
Running setup.py bdist_wheel for statsmodels: started
Running setup.py bdist_wheel for statsmodels: finished with status 'done'
Stored in directory: C:\Users\appveyor\AppData\Local\pip\Cache\wheels\d9\58\cf\87cbd88032d70c0a3d5f3ab657d32961186bb61ed6d9587621
Now it only yields this:
Collecting statsmodels>=0.5.0 (from dclab==0.5.0)
Downloading https://files.pythonhosted.org/packages/9d/19/075e6d23030b9032e9484a14a0a9ef80c732c092a4a43a8171696ba3170f/statsmodels-0.9.0-cp27-cp27m-win_amd64.whl (7.1MB)
As a result, I get errors like this:
from statsmodels.nonparametric.kernel_density import KDEMultivariate
c:\python27-x64\lib\site-packages\statsmodels\__init__.py:10: in <module>
from statsmodels.tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning,
c:\python27-x64\lib\site-packages\statsmodels\tools\__init__.py:1: in <module>
from .tools import add_constant, categorical
c:\python27-x64\lib\site-packages\statsmodels\tools\tools.py:9: in <module>
import pandas as pd
E ImportError: No module named pandas
Here are the relevant appveyor builds for the dclab package:
Metadata
Metadata
Assignees
Labels
No labels
Activity
josef-pkt commentedon May 15, 2018
I'm not really up-to-date.
I thought we never supported this. A long time ago we decided not to tell pip what our requirements are because pip always updated numpy (which I hated).
There were some changes since then, but I didn't try to understand changes for pip install anymore.
AFAIK, there were no changes in this relative to 0.8.
josef-pkt commentedon May 15, 2018
The relevant changes were in 2014 (PR #2007 was the last in the sequence that changed this), which adds our dependencies to setuptool requires if those dependencies are not yet installed. (relevant part in setup.py is check_dependency_versions function.
My guess is that this applies to source distribution and during build but not for wheels.
When the wheels are built our dependencies are already installed, and then, I assume, the requirements stay empty. When pip installing the wheels it won't have to go through that part of the setup.py.
So, when installing wheels, the requirement have to be told to pip separately.
paulmueller commentedon May 16, 2018
I understand.
Since numpy is on PyPi as a wheel for all major platforms and having dependencies installed automatically is a very convenient feature in Python, I would suggest bringing the dependencies back to the wheels. Should I create a new issue for that?
TomAugspurger commentedon May 16, 2018
I haven't read through this thread, but @paulmueller what version of pip are you using? Pandas had issues with pip 10 because we added a pyproject.toml, and Pip didn't 100% implement things.
Adding the
--no-build-isolationflag helped. See pandas-dev/pandas#20775paulmueller commentedon May 16, 2018
It is pip version 9.0.1. Pandas installs fine via pip.
The problem is that statsmodels does not tell pip that pandas is one of its dependencies. Therefore, pandas must be installed manually.
matthew-brett commentedon May 16, 2018
Pip 10 no longer has the annoying 'upgrade everything' behavior by default:
https://pip.pypa.io/en/stable/reference/pip_install/
I believe all statsmodels' dependencies have had wheels for a long time time, especially numpy, but also scipy and pandas. So specifying dependencies should be safe, now.
josef-pkt commentedon May 16, 2018
(
It took 5 to 8 years of pip development to get there. Maybe we can change it in the next release.
There is still no --upgrade-strategy to "raise" if not version compatible.
Reminds me of some Julia discussion, where installing a package down graded another package and then there was an empty set of compatible package version that the user needed.
I never want pip to "upgrade" my numpy and e.g. replace MKL numpy by a newer OpenBLAS numpy which would break scipy AFAIK, because MKL is in the numpy folder, and in turn would break statsmodels because we don't get the LAPACK files through scipy anymore.
)
matthew-brett commentedon May 16, 2018
I guess that is for Christoph Gohlke's wheels, that he only ships MKL inside the numpy wheel, and it would break scipy, if numpy / MKL was upgraded?
The at-risk users would be those who've installed Christoph's numpy and scipy, by downloading, and have an old numpy, and a new scipy, and an old pip, and then do
pip install --upgrade statsmodels(rather than, say, downloading from Christoph's site). The scipy would have to be bang up to date (to avoid the upgrade) and the numpy would have to be out of date (to trigger the upgrade). So, yes, I'm sure it could happen, but I bet it is much less common than people confused by pip not installing dependencies for statsmodels.josef-pkt commentedon May 16, 2018
I'm using older WinPython versions, and pip install -U can still screw up the packages in it. WinPython uses the MKL numpy and scipy.
(By now I always remember no-deps or do explicit pip uninstall xxx, pip install xxx.)
The version requirements of statsmodels are very low in 0.9, so currently it wouldn't trigger any updates except for very old installs.
However, one problem we (or I) had was that specifying pandas and patsy as dependency of statsmodels triggers their requirements which has a chain reaction that might go all the way back to upgrading numpy and whatever else pandas specifies.
But it's easier to recover from a missing dependency, e.g. by explicitly installing the dependencies, than recover from having the current installation messed up.
(At least that's when I got my pip aversion (that still lingers after 8 years or so). I spend several hours setting up my python installations, and pip wipes it or messes it up in a few minutes when forgetting no-deps.)
paulmueller commentedon May 16, 2018
I agree that pip may be a little frustrating when it comes to installing packages. Nevertheless, I think that statsmodels should install like any other Python package (with its dependencies). I agree with @matthew-brett that the default behavior should be to install the dependencies. Breaking manual setups with Christoph Gohlke's wheels is (not desired but) better than non-functioning native PyPI setups (which also includes MacOS, Linux, Anaconda installs, and CIs like Appveyor or Travis).
Add my solutions for Lab 3.
TST: Adjust appveyor tolerance
TST: Adjust appveyor tolerance
TST: Adjust appveyor tolerance
TST: Adjust appveyor tolerance