Repository: statsmodels/statsmodels

Issue:
`LICENSE.txt` and `setup.cfg` get copied to the python lib folder
#### Describe the bug

After upgrading to 0.10.1, I noticed that a copy of the statsmodels `LICENSE.txt` and `setup.cfg` gets also copied into the python lib root folder (e.g. `/user/local`), but is not only limited to the statsmodels package folder. 

This can be problematic if the package is installed into a customized `--prefix` folder and there are other `LICENSE.txt` and `setup.cfg` files in the customized folder. 

#### Code Sample, a copy-pastable example if possible

1. Create a clean folder for python packages, e.g. `/root/python`
2. pip install with prefix  ```pip install --prefix=='/root/python' statsmodels==0.10.1```
3. `LICENSE.txt` and `setup.cfg` present in the `/root/python` folder. 

#### Expected Output

N/A

#### Output of ``import statsmodels.api as sm; sm.show_versions()``

```
INSTALLED VERSIONS
------------------
Python: 2.7.16.final.0
OS: Linux 4.15.0-1043-aws #45-Ubuntu SMP Mon Jun 24 14:07:03 UTC 2019 x86_64
byteorder: little
LC_ALL: None
LANG: C.UTF-8

Statsmodels
===========

Installed: 0.10.1 (/root/python/lib/python2.7/site-packages/statsmodels)

Required Dependencies
=====================

cython: Not installed
numpy: 1.16.4 (/root/python/lib/python2.7/site-packages/numpy)
scipy: 1.2.2 (/root/python/lib/python2.7/site-packages/scipy)
pandas: 0.24.2 (/root/python/lib/python2.7/site-packages/pandas)
    dateutil: 2.8.0 (/root/python/lib/python2.7/site-packages/dateutil)
patsy: 0.5.1 (/root/python/lib/python2.7/site-packages/patsy)

Optional Dependencies
=====================

matplotlib: Not installed
cvxopt: Not installed
joblib: Not installed

Developer Tools
================

IPython: Not installed
    jinja2: Not installed
sphinx: Not installed
    pygments: Not installed
pytest: Not installed
virtualenv: 16.7.2 (/usr/local/lib/python2.7/site-packages)
```





Discussion:
I think we cannot fix this.  setup.cfg is required for tests to run from an installed version, which is part of the manylinux build. LICENSE.txt doesn't have to be copied but is a good idea.  This means that --prefix installation is not supported by statsmodels.  

A PR that fixes this while continuing to be testable from an installed location would be welcome, but I don't think we will be able to put work support this. 

NumPy also copies their LICENSE.txt to the install folder. 
I probably didn't make the point very clear. Though I encountered this in a `--prefix` install, this is not about `--prefix`. 

Please see below for a non-prefix clean system installation. These two files are copied into `/user/local` instead of the install folder`/usr/local/lib/python2.7/dist-packages/statsmodels/`. NumPy doesn't do that. 

```
root@test-8546659665-rqk6f:~# pip uninstall statsmodels
Uninstalling statsmodels-0.10.1:
  Would remove:
    /usr/local/LICENSE.txt
    /usr/local/lib/python2.7/dist-packages/statsmodels-0.10.1.dist-info/*
    /usr/local/lib/python2.7/dist-packages/statsmodels/*
    /usr/local/setup.cfg
Proceed (y/n)? 
```
I'm content to say the only officially supported use is through site
packages. Python 2.7 is also effectively unsupported now. Not sure if that
is required for this second issue.

On Mon, Aug 19, 2019, 19:30 Qingqing Mao <notifications@github.com> wrote:

> I probably didn't make the point very clear. Though I encountered this in
> a --prefix install, this is not about --prefix.
>
> Please see below for a non-prefix clean system installation. These two
> files are copied into /user/local instead of the install folder
> /usr/local/lib/python2.7/dist-packages/statsmodels/. NumPy doesn't do
> that.
>
> root@test-8546659665-rqk6f:~# pip uninstall statsmodels
> Uninstalling statsmodels-0.10.1:
>   Would remove:
>     /usr/local/LICENSE.txt
>     /usr/local/lib/python2.7/dist-packages/statsmodels-0.10.1.dist-info/*
>     /usr/local/lib/python2.7/dist-packages/statsmodels/*
>     /usr/local/setup.cfg
> Proceed (y/n)?
>
> —
> You are receiving this because you modified the open/close state.
> Reply to this email directly, view it on GitHub
> <https://github.com/statsmodels/statsmodels/issues/6114?email_source=notifications&email_token=ABKTSRJQABXPEYCV4GWTONLQFLRF3A5CNFSM4IMU7CB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4T4JMY#issuecomment-522699955>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABKTSRJVM6BXWDPU33OD6WTQFLRF3ANCNFSM4IMU7CBQ>
> .
>

I am also happy to accept a PR that will preserve running the test from
installation while not installing these files.

On Mon, Aug 19, 2019, 19:34 Kevin Sheppard <kevin.k.sheppard@gmail.com>
wrote:

> I'm content to say the only officially supported use is through site
> packages. Python 2.7 is also effectively unsupported now. Not sure if that
> is required for this second issue.
>
> On Mon, Aug 19, 2019, 19:30 Qingqing Mao <notifications@github.com> wrote:
>
>> I probably didn't make the point very clear. Though I encountered this in
>> a --prefix install, this is not about --prefix.
>>
>> Please see below for a non-prefix clean system installation. These two
>> files are copied into /user/local instead of the install folder
>> /usr/local/lib/python2.7/dist-packages/statsmodels/. NumPy doesn't do
>> that.
>>
>> root@test-8546659665-rqk6f:~# pip uninstall statsmodels
>> Uninstalling statsmodels-0.10.1:
>>   Would remove:
>>     /usr/local/LICENSE.txt
>>     /usr/local/lib/python2.7/dist-packages/statsmodels-0.10.1.dist-info/*
>>     /usr/local/lib/python2.7/dist-packages/statsmodels/*
>>     /usr/local/setup.cfg
>> Proceed (y/n)?
>>
>> —
>> You are receiving this because you modified the open/close state.
>> Reply to this email directly, view it on GitHub
>> <https://github.com/statsmodels/statsmodels/issues/6114?email_source=notifications&email_token=ABKTSRJQABXPEYCV4GWTONLQFLRF3A5CNFSM4IMU7CB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4T4JMY#issuecomment-522699955>,
>> or mute the thread
>> <https://github.com/notifications/unsubscribe-auth/ABKTSRJVM6BXWDPU33OD6WTQFLRF3ANCNFSM4IMU7CBQ>
>> .
>>
>

ok. I am not familiar with the `statsmodels` setup, but I will see what I can do in the next a couple of days. Thanks! 

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -344,8 +344,7 @@ def is_pure(self):
       setup_requires=SETUP_REQUIRES,
       install_requires=INSTALL_REQUIRES,
       extras_require=EXTRAS_REQUIRE,
-      zip_safe=False,
-      data_files=[('', ['LICENSE.txt', 'setup.cfg'])]
+      zip_safe=False
       )
 
 # Clean-up copied files


Test patch: