32bit python on 64bit linux gets wrong platform name
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Originally reported by: dougn (Bitbucket: dougn, GitHub: dougn)
This is ultimately a bug in distutils.util.get_platform, but as that would require new point releases on all versions of python, we need a better fix sooner. Setuptools is the best place for this as it is already inheriting the Distribution class for it's own use and can override the faulty platform name.
This works fine on Windows and I think OSX is ok as well, but that should be checked as well.
When you run setuptools using a 32bit python on 32bit linux, the platname is still 'linux-x86_64', because distutils.util.get_platform() is using only the OS uname for determining the machine part for linux.
For most operations using setup tools, this can be overwritten on the commandline, but not on install. This becomes critical with wheel support, as now the problem becomes that pip will download and install the 64bit wheel instead of the 32bit one. There is also no way of overriding this. pip and wheels become useless. pip provides --install-options, and --general-options, but setuptools does not have install or general options for overriding the platname, like bdist and the other building commands do.
On windows distutils.util.get_platform() uses a backoff to sys.platform, which is 'win32' when running a 32bit python on a 64bit system.
setuptools is the proper place to deal with this issue. setuptools needs this fix for it's own building and installing. It is also the upstream provider of the Distribution class used by pip and wheel used for searching, converting and installing.
[32.env] [dnapoleone@unv-dnapoleone1 numpy-1.9.1]$ which python2.7_32bit
/home/dnapoleone/32.env/bin/python2.7_32bit
[32.env] [dnapoleone@unv-dnapoleone1 numpy-1.9.1]$ python2.7_32bit ./setup.py bdist -h
Running from numpy source directory.
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_suite'
warnings.warn(msg)
Common commands: (see '--help-commands' for more)
setup.py build will build the package underneath 'build/'
setup.py install will install the package
Global options:
--verbose (-v) run verbosely (default)
--quiet (-q) run quietly (turns verbosity off)
--dry-run (-n) don't actually do anything
--help (-h) show detailed help message
--no-user-cfg ignore pydistutils.cfg in your home directory
Options for 'bdist' command:
--bdist-base (-b) temporary directory for creating built distributions
--plat-name (-p) platform name to embed in generated filenames (default:
linux-x86_64)
--formats formats for distribution (comma-separated list)
--dist-dir (-d) directory to put final built distributions in [default:
dist]
--skip-build skip rebuilding everything (for testing/debugging)
--owner (-u) Owner name used when creating a tar file [default:
current user]
--group (-g) Group name used when creating a tar file [default:
current group]
--help-formats lists available distribution formats
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing setuptools' Distribution override and the distutils.util.get_platform path used by bdist and install, using the reported 32-bit Python on 64-bit Linux behavior as the reproduction case. Verify that the resulting platform name reflects the Python runtime for Linux, while checking the stated Windows and macOS behavior; done means generated and installed artifacts select the correct architecture.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100