Open grelston opened 5 years ago
>>> pyfile = r"C:\Miniconda3\envs\mayavi\lib\site-packages\apptools\persistence\state_pickler.py"
>>> txt_str = open(pyfile, 'rt').read()
>>> txt_lines = open(pyfile, 'rt').readlines()
>>> bin_str = open(pyfile, 'rb').read()
>>> bin_lines = open(pyfile, 'rb').readlines()
>>> import hashlib
>>> hashlib.md5(bin_str).hexdigest()
'474262401f975920a18c82e763783c37'
>>> len(txt_lines)
2045
>>> len(bin_lines)
1023
>>> bin_lines[0:5]
[b'"""This module provides code that allows one to pickle the state of a\r\r\n', b'Python object to a dictionary.\r\r\n', b'\r\r\n', b'The motivation for this is simple. The standard Python\r\r\n', b'pickler/unpickler is best used to pickle simple objects and does not\r\r\n']
>>> txt_lines[0:10]
['"""This module provides code that allows one to pickle the state of a\n', '\n', 'Python object to a dictionary.\n', '\n', '\n', '\n', 'The motivation for this is simple. The standard Python\n', '\n', 'pickler/unpickler is best used to pickle simple objects and does not\n', '\n']
>>> open(pyfile+'.orig', 'wb').write(bin_str)
37425
>>> bin_str.replace(b'\r\r', b'\r')[0:100]
b'"""This module provides code that allows one to pickle the state of a\r\nPython object to a dictionary'
>>> open(pyfile, 'wb').write(bin_str.replace(b'\r\r', b'\r'))
36403
>>> import mayavi.api
>>> # an unrelated NameError. See Issue #10985.
This issue also affects the win-64 versions of mayavi and apptools. Once the above fix is applied, the 64-bit mayavi.api
imports with no further error.
Could the apptools packages for the main/win-32 and main/win-64 channels be rebuilt with (single) CR-LF line-endings instead of the existing (double) CR-CR-LF line-endings? Thanks.
I suspect this is an issue with the conda build of https://github.com/enthought/apptools because a pip install of mayavi (and its apptools and envisage dependencies) works as expected (see https://github.com/ContinuumIO/anaconda-issues/issues/10985#issuecomment-499627263 for more details).
I vaguely remember something about this a long time ago. My memory is that a git clone or something like that introduced the double line endings. I'm confused, though, because the apptools recipe is using source from a pypi package: https://github.com/AnacondaRecipes/apptools-feedstock/blob/master/recipe/meta.yaml
If you can get a good build working on the conda-forge feedstock, we'll be happy to bring it in. Otherwise, I'm afraid it will be a while before we can debug this and fix it ourselves.
Thanks @msarahan.
The conda-forge feedstock already builds a working apptools-4.4.0 for python=3.7 on both win-32 and win-64 (conda-forge also provides a working mayavi-4.6.2 on win-64; however, there is no mayavi for python=3.7 on win-32 in conda-forge).
I have compared the recipe/meta.yaml files from AnacondaRecipes/apptools-feedstock and conda-forge/apptools-feedstock. They both refer to the same pypi file for apptools-4.4.0.tar.bz2 and report the same md5 hash. The only major difference seems to be that conda-forge installs apptools using pip, whereas AnacondaRecipes uses "python setup.py install".
The double-CR line-ending was a new issue introduced by python/cpython#6483. The problem in lib2to3 was fixed, committed, merged and backported to python 3.7 in July 2018.
Both py37 builds of apptools in the main/win-32 Anaconda repo (py37_0 and py37_1) have CRCRLF line-endings in Lib/site-packages/apptools/persistence/state_pickler.py
even though their timestamps are August and September 2018. Could a pre-July-2018 version of (python-3.7) 2to3 have been used to generate them?
For completeness, I also checked the line-endings of state_pickler.py in the apptools-4.4.0-*.tar.bz2 files for py36_1 (CRLF), py35_1 (CRLF) and py27_1 (LF).
Actual Behavior
Expected Behavior
Steps to Reproduce
Anaconda or Miniconda version:
Miniconda3-4.6.14-Windows-x86
Operating System:
Windows 7 Enterprise, Service Pack 1, 64-bit Operating System
conda info
conda list --show-channel-urls