Azure / azure-python-siteextensions

Defines the Python runtime site extensions that are available for Azure App Service
Other
8 stars 9 forks source link

Can't install packages that depend on lib2to3 on Python 3.6.1 x64 #14

Open twschiller opened 7 years ago

twschiller commented 7 years ago

Installing the anyjson 0.3.3 package fails when using the Python 3.6.1 x64 site extension.

The package installer uses the use_2to3 flag of setuptools to run the conversion from Python 2 to Python 3 during the install.

During the install, the lib2to3 library looks for .py files for each fix to apply: https://github.com/python/cpython/blob/272d888c7b58aff5e1614e3b12e8198b92054835/Lib/lib2to3/refactor.py#L30

However, the fixes at D:\home\python361x64\Lib\lib2to3\fixes only includes bytecode .pyc files.

Python maintainer has indicated that Python / lib2to3 doesn't officially support Python distributions that don't include the source files: http://bugs.python.org/issue31143

Other information:

zooba commented 7 years ago

The easiest workaround is to pip wheel the package locally, and then upload the .whl file and install from that (put the .whl alongside your requirements.txt and a relative path in the .txt and it should install just fine). The first build step will do the conversion, so once you have the wheel you won't need to run 2to3 anymore.

As soon as bugs.p.o is back online (well, not straight away, but eventually) I'll go and argue with that maintainer, since I think it should be able to handle cases with a zipped stdlib or a bytecode-only stdlib. (I'll probably also end up contributing the fix, but that's fine.)

twschiller commented 7 years ago

Thanks for following up with the Python maintainers.

That workaround is OK for us since we're already using wheels for our numeric packages. The main limitation is we have to audit each dependency for use of 2to3

For completeness, here are links to other potential workarounds from the setuptools thread: