I recently upgrade keras from 2.0.5 to 2.0.6 and it leads to test fails in another project called Jep (https://github.com/mrj0/jep/issues/84#issuecomment-314306847).
The main reason is that keras==2.0.6 creates a directory named tests/ directly under site-packages/. Jep has ./tests directory under its project root directory for its test files. I think such a directory naming convention seems quite common for other projects.
I think the tests directory should be moved under site-packages/keras/.
Nothing in Keras is supposed to do that. Can you provide more details? Or send a PR, if you see something to fix.
These are the files under site-packages/tests:
~$ ls /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/*
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/__init__.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/__pycache__:
__init__.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual:
__init__.py __pycache__ check_autoencoder.py check_callbacks.py check_constraints.py check_masked_recurrent.py check_model_utils.py check_save_weights.py check_wrappers.py check_yaml.py
An attempt to uninstall keras shows the following messages; you can see that it is going to remove files under ./site-packages/tests.
~$ pip3 uninstall keras
Uninstalling Keras-2.0.6:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Keras-2.0.6.dist-info/DESCRIPTION.rst
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Keras-2.0.6.dist-info/INSTALLER
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Keras-2.0.6.dist-info/METADATA
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Keras-2.0.6.dist-info/RECORD
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Keras-2.0.6.dist-info/WHEEL
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Keras-2.0.6.dist-info/metadata.json
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/Keras-2.0.6.dist-info/top_level.txt
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/__init__.py
...
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/__init__.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/__pycache__/__init__.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/__init__.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/__pycache__/__init__.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/__pycache__/check_autoencoder.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/__pycache__/check_callbacks.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/__pycache__/check_constraints.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/__pycache__/check_masked_recurrent.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/__pycache__/check_model_utils.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/__pycache__/check_save_weights.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/__pycache__/check_wrappers.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/__pycache__/check_yaml.cpython-36.pyc
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/check_autoencoder.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/check_callbacks.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/check_constraints.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/check_masked_recurrent.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/check_model_utils.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/check_save_weights.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/check_wrappers.py
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tests/manual/check_yaml.py
Proceed (y/n)?
I checked it on my laptop (MBP) and CentOS server, and even in Docker environments.
There might be a mistake in uploading dist/* to PyPI. The problem does not occur when installing from git. I examined the following cases:
pip install git+https://github.com/fchollet/keras: goodpip install git+https://github.com/fchollet/[email protected]: goodpip install keras (2.0.6): weirdpip install keras==2.0.5: goodWeird. No idea why this got included in the package.
Fixed it, please check.
No more tests/ under site-packages/.
Thanks!
Anyway, @fchollet what was the problem? Is it related to PyPI as @taehoonlee said?
The issue was that I followed the official Twine instructions for uploading pip packages, which results in unwanted files getting packaged and uploaded. The solution is to do everything by hand, apparently.
Most helpful comment
Fixed it, please check.