[MacPorts] #64234: python39 @3.9.9+universal: Under arch arch -x86_64, ModuleNotFoundError: No module named 'msvcrt'

MacPorts noreply at macports.org
Fri Dec 17 08:33:36 UTC 2021


#64234: python39 @3.9.9+universal: Under arch arch -x86_64, ModuleNotFoundError: No
module named 'msvcrt'
-----------------------+----------------------
 Reporter:  ryankanno  |      Owner:  (none)
     Type:  defect     |     Status:  new
 Priority:  Normal     |  Milestone:
Component:  ports      |    Version:  2.7.1
 Keywords:  monterey   |       Port:  python39
-----------------------+----------------------
 I have built python39 with +universal variant, however, when I use the
 x86_64 version, and import subprocess, similar to the follow up comment in
 Ticket [ticket:63782], it fails with an identical error. Since this was a
 different python port, I thought it best to create a new ticket - my
 apologies if I should have just added onto [ticket:63782].

 {{{#!bash
 $ port -vq installed python39
   python39 @3.9.9_0+lto+optimizations+universal (active)
 requested_variants='+universal' platform='darwin 21' archs='arm64 x86_64'
 date='2021-12-17T16:42:35+0900'
 }}}

 {{{#!bash
 $ arch -arm64 /opt/local/bin/python3.9
 Python 3.9.9 (main, Nov 16 2021, 09:34:38)
 [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import subprocess
 >>> ^D

 $ arch -x86_64 /opt/local/bin/python3.9
 Python 3.9.9 (main, Nov 16 2021, 09:34:38)
 [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import subprocess
 Traceback (most recent call last):
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py",
 line 73, in <module>
     import msvcrt
 ModuleNotFoundError: No module named 'msvcrt'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py",
 line 78, in <module>
     import _posixsubprocess
 ImportError: dynamic module does not define module export function
 (PyInit__posixsubprocess)
 >>>
 }}}

 {{{#!bash
 $ port contents python39 | grep -i posixsub
 /opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /lib-dynload/_posixsubprocess.cpython-39-darwin.so

 $ file
 /opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /lib-dynload/_posixsubprocess.cpython-39-darwin.so

 /opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /lib-dynload/_posixsubprocess.cpython-39-darwin.so: Mach-O universal
 binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64]
 [arm64:Mach-O 64-bit bundle arm64]
 /opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /lib-dynload/_posixsubprocess.cpython-39-darwin.so (for architecture
 x86_64):  Mach-O 64-bit bundle x86_64
 /opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9
 /lib-dynload/_posixsubprocess.cpython-39-darwin.so (for architecture
 arm64):   Mach-O 64-bit bundle arm64
 }}}

 I am running macOS 12.0.1 (21A559), Xcode 13.2 13C90.

 In addition, since this seemed closely related (I'm more than happy to
 create another ticket), I have also built python310 @3.10.1+universal,
 however, interestingly enough, when I use the arm64 version (vs x86_64
 above), and import subprocess, it fails with an identical error.

 {{{#!bash
 $ sudo port -vq installed python310
   python310 @3.10.1_0+lto+optimizations+universal (active)
 requested_variants='+universal' platform='darwin 21' archs='arm64 x86_64'
 date='2021-12-17T16:18:01+0900'
 }}}

 {{{#!bash
 $ arch -x86_64 /opt/local/bin/python3.10
 Python 3.10.1 (main, Dec 17 2021, 16:13:14) [Clang 13.0.0
 (clang-1300.0.29.30)] on darwin
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import subprocess
 >>> ^D

 ~ $ arch -arm64 /opt/local/bin/python3.10
 Python 3.10.1 (main, Dec 17 2021, 16:13:14) [Clang 13.0.0
 (clang-1300.0.29.30)] on darwin
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import subprocess
 Traceback (most recent call last):
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py",
 line 69, in <module>
     import msvcrt
 ModuleNotFoundError: No module named 'msvcrt'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py",
 line 74, in <module>
     import _posixsubprocess
 ImportError: dynamic module does not define module export function
 (PyInit__posixsubprocess)
 >>>
 }}}

 {{{#!bash
 ~ $ sudo port contents python310 | grep -i posixsub
 /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10
 /lib-dynload/_posixsubprocess.cpython-310-darwin.so

 ~ $ file
 /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10
 /lib-dynload/_posixsubprocess.cpython-310-darwin.so
 /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10
 /lib-dynload/_posixsubprocess.cpython-310-darwin.so: Mach-O universal
 binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64]
 [arm64:Mach-O 64-bit bundle arm64]
 /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10
 /lib-dynload/_posixsubprocess.cpython-310-darwin.so (for architecture
 x86_64):       Mach-O 64-bit bundle x86_64
 /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10
 /lib-dynload/_posixsubprocess.cpython-310-darwin.so (for architecture
 arm64):        Mach-O 64-bit bundle arm64
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/64234>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list