pypa / pipenv

Python Development Workflow for Humans.
https://pipenv.pypa.io
MIT License
24.84k stars 1.87k forks source link

Mean to select Python architecture other than system architecture #4571

Closed MRtecno98 closed 1 year ago

MRtecno98 commented 3 years ago

Is your feature request related to a problem? Please describe.

I often need to specify different sources for a package for different system environments, and as intended I use the PEP 508 markers to select the system and the machine architecture(needed for wheel files). Emphasis on "machine" because here resides the problem. I can, using PEP 508 markers, mark a wheel to only be installed in a specific machine architecture, but not on a specific installation architecture. E.g. I'm running on a 64bit machine but I have a 32bit Python version installed, the platform_machine marker will still be evaluated to AMD64 or whatever 64bit architecture my CPU is based on, and so it won't stop pipenv from trying(and failing) to install a 64bit wheel on a 32bit python installation.

Describe the solution you'd like

A method to control package installation based also on the Python architecture and not only the system architecture.

Describe alternatives you've considered

Well, the only alternative that comes to mind is making a Pipfile for each architecture but, you know, it would defeat Pipenv's purpose in the first place, or at least make it extremely more annoying to use.

Additional context

The dump below was taken on a test project I'm testing for this problem on, the package I'm trying to install is mysqlclient(which can't be compiled "on the go" by pip on windows platforms), but the problem remains with other packages in a similar situation, I'm using the 32bit version of CPython 3.8 on an AMD64 system.

I don't have any idea in how this could be implemented with respects to the standards, conventions, and philosophy this project has/respects, I'll leave this up to the devs. Also, if I'm blind and missing something crucial here sorry about that but even after all the research I did I could have missed something.


$ pipenv --support Pipenv version: `'2020.8.13'` Pipenv location: `'c:\\users\\temp\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\pipenv'` Python location: `'c:\\users\\temp\\appdata\\local\\programs\\python\\python36\\python.exe'` Python installations found: - `3.8.5`: `C:\Users\Temp\AppData\Local\Programs\Python\Python38-32\python.exe` - `3.6.3`: `C:\Users\Temp\AppData\Local\Programs\Python\Python36\python.exe` PEP 508 Information: ``` {'implementation_name': 'cpython', 'implementation_version': '3.6.3', 'os_name': 'nt', 'platform_machine': 'AMD64', 'platform_python_implementation': 'CPython', 'platform_release': '10', 'platform_system': 'Windows', 'platform_version': '10.0.18362', 'python_full_version': '3.6.3', 'python_version': '3.6', 'sys_platform': 'win32'} ``` System environment variables: - `ADSK_CLM_WPAD_PROXY_CHECK` - `ALLUSERSPROFILE` - `APPDATA` - `BOCHS_HOME` - `CMAKE_HOME` - `CMDLINE_TOOLS` - `COMMONPROGRAMFILES` - `COMMONPROGRAMFILES(X86)` - `COMMONPROGRAMW6432` - `COMPUTERNAME` - `COMSPEC` - `DRIVERDATA` - `FPS_BROWSER_APP_PROFILE_STRING` - `FPS_BROWSER_USER_PROFILE_STRING` - `GNUPLOT_LIB` - `GTK_BASEPATH` - `HOMEDRIVE` - `HOMEPATH` - `INTEL_DEV_REDIST` - `JAVA_HOME` - `JAVA_JRE` - `LOCALAPPDATA` - `LOGONSERVER` - `MIC_LD_LIBRARY_PATH` - `MINGW_HOME` - `NASM_HOME` - `NUMBER_OF_PROCESSORS` - `ONEDRIVE` - `OS` - `PATH` - `PATHEXT` - `PROCESSOR_ARCHITECTURE` - `PROCESSOR_IDENTIFIER` - `PROCESSOR_LEVEL` - `PROCESSOR_REVISION` - `PROGRAMDATA` - `PROGRAMFILES` - `PROGRAMFILES(X86)` - `PROGRAMW6432` - `PROMPT` - `PSMODULEPATH` - `PT7HOME` - `PUBLIC` - `PYTHON_PATH` - `QT_DEVICE_PIXEL_RATIO` - `SCE_ROOT_DIR` - `SESSIONNAME` - `SYSTEMDRIVE` - `SYSTEMROOT` - `TEMP` - `TMP` - `USERDOMAIN` - `USERDOMAIN_ROAMINGPROFILE` - `USERNAME` - `USERPROFILE` - `VBOX_MSI_INSTALL_PATH` - `VS140COMNTOOLS` - `WINDIR` - `PIP_DISABLE_PIP_VERSION_CHECK` - `PYTHONDONTWRITEBYTECODE` - `PIP_SHIMS_BASE_MODULE` - `PIP_PYTHON_PATH` - `PYTHONFINDER_IGNORE_UNSUPPORTED` PipenvÔÇôspecific environment variables: DebugÔÇôspecific environment variables: - `PATH`: `C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.8.0_172\bin;C:\Program Files\Java\jre1.8.0_172\bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Scripts;C:\ffmpeg\bin;C:\Program Files (x86)\GnuWin32\bin;C:\ruby\bin;C:\Program Files\nodejs\;C:\Program Files\dotnet\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;E:\Vagrant\bin;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Java\jdk1.8.0_172\bin;C:\Users\Temp\AppData\Local\Programs\Python\Python36;C:\Users\Temp\AppData\Local\Programs\Python\Python36\Scripts;C:\Python27\execs;C:\Python27\Scripts;E:\make\bin;E:\tcc;E:\tor-win32;E:\apache-maven-3.6.2\bin;E:\apache-ant-1.10.6\bin;C:\Program Files\Bochs-2.6.11\bin;E:\nasm-2.15.05;E:\MinGW\bin;E:\cmake\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Git\cmd;C:\Users\Temp\AppData\Local\Programs\Python\Python38-32\Scripts\;C:\Users\Temp\AppData\Local\Programs\Python\Python38-32\;C:\Users\Temp\scoop\shims;C:\Users\Temp\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\Temp\AppData\Local\Programs\Python\Python36\;C:\Users\Temp\AppData\Local\Microsoft\WindowsApps;C:\Users\Temp\AppData\Local\atom\bin;C:\Users\Temp\AppData\Local\Microsoft\WindowsApps;;C:\Users\Temp\AppData\Local\Gpg4win\..\GnuPG\bin;C:\Users\Temp\.dotnet\tools;c:\users\temp\appdata\local\programs\python\python36\lib\site-packages\pypiwin32_system32;c:\users\temp\appdata\local\programs\python\python36\lib\site-packages\pywin32_system32` --------------------------- Contents of `Pipfile` ('E:\\tempfiles\\JustATestProjectForMakingAnIssue\\Pipfile'): ```toml [[source]] name = "pypi" url = "https://pypi.org/simple" verify_ssl = true [dev-packages] [packages] mysqlclient_win_32 = {file = "https://download.lfd.uci.edu/pythonlibs/z4tqcw5k/mysqlclient-1.4.6-cp38-cp38-win32.whl", markers = "sys_platform == 'win32' and platform_machine != 'AMD64'"} mysqlclient_win_64 = {file = "https://download.lfd.uci.edu/pythonlibs/z4tqcw5k/mysqlclient-1.4.6-cp38-cp38-win_amd64.whl", markers = "sys_platform == 'win32' and platform_machine == 'AMD64'"} mysqlclient = {version = "==1.4.6", sys_platform = "!= 'win32'"} [requires] python_version = "3.8" ``` Contents of `Pipfile.lock` ('E:\\tempfiles\\JustATestProjectForMakingAnIssue\\Pipfile.lock'): ```json { "_meta": { "hash": { "sha256": "d361b1a680b3d190045dda0a2f9e45b41b0e4f6f5dd543e7fa5614d788e27a84" }, "pipfile-spec": 6, "requires": { "python_version": "3.8" }, "sources": [ { "name": "pypi", "url": "https://pypi.org/simple", "verify_ssl": true } ] }, "default": { "mysqlclient": { "hashes": [ "sha256:1f4d3c3fa7d7f1683071ad12096e5494179e7fa837c5210c3032c81d72f33e3a" ], "markers": "sys_platform != 'win32'", "version": "==1.4.6" }, "mysqlclient-win-32": { "file": "https://download.lfd.uci.edu/pythonlibs/z4tqcw5k/mysqlclient-1.4.6-cp38-cp38-win32.whl", "markers": "sys_platform == 'win32' and platform_machine != 'AMD64'" }, "mysqlclient-win-64": { "file": "https://download.lfd.uci.edu/pythonlibs/z4tqcw5k/mysqlclient-1.4.6-cp38-cp38-win_amd64.whl", "markers": "sys_platform == 'win32' and platform_machine == 'AMD64'" } }, "develop": {} } ```
frostming commented 3 years ago

Pipenv provides no more than PEP 508 environment markers, sadly. So if you can't tell Pipenv the installation arch, you can neither tell Pip. In my personal opinion, Pipenv isn't going to support more than PEP 508, so that Pipfile can be easily converted to requirements.txt without breaking the compatibility.