z80 icon indicating copy to clipboard operation
z80 copied to clipboard

pip install z80 fails

Open fmuntean opened this issue 1 year ago • 13 comments

Running setup.py install for z80 did not run successfully. │ exit code: 1 ╰─> [20 lines of output] running install C:\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py creating build creating build\lib.win-amd64-cpython-311 creating build\lib.win-amd64-cpython-311\z80 copying z80_disasm.py -> build\lib.win-amd64-cpython-311\z80 copying z80_disasm_parser.py -> build\lib.win-amd64-cpython-311\z80 copying z80_error.py -> build\lib.win-amd64-cpython-311\z80 copying z80_instr.py -> build\lib.win-amd64-cpython-311\z80 copying z80_machine.py -> build\lib.win-amd64-cpython-311\z80 copying z80_main.py -> build\lib.win-amd64-cpython-311\z80 copying z80_source.py -> build\lib.win-amd64-cpython-311\z80 copying z80_token.py -> build\lib.win-amd64-cpython-311\z80 copying z80_init_.py -> build\lib.win-amd64-cpython-311\z80 running build_ext building 'z80._z80' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output]

this cpp built tools take over 1.3 GB to install. maybe use another compiler or use the VScode C++ compiler /

fmuntean avatar Mar 21 '23 01:03 fmuntean

https://stackoverflow.com/questions/25595098/force-setup-py-to-use-my-custom-compiler reads like it's possible to specify the compiler with setup.py --compiler. I guess cygwin or mingw32 could be viable alternatives to MSVC on Windows?

kosarev avatar Mar 22 '23 23:03 kosarev

Hey I just tried today (python 3.12.3) with this result:

python3 setup.py
Traceback (most recent call last):
  File "/Users/mortenjc/proj/3rdpty/z80/setup.py", line 4, in <module>
    import distutils.sysconfig
ModuleNotFoundError: No module named 'distutils'

pip install distutils also fails. https://docs.python.org/3.10/whatsnew/3.10.html#distutils-deprecated

This currently prevents me from setting this up on my Macbook. Is there a known workaround?

mortenjc avatar Jul 08 '24 14:07 mortenjc

It looks like the use of distutils in setup.py is a workaround for a bug that was fixed in Python 3.6, according to the linked bug report. Python 3.8 sunsets in October this year, so it's possible to eliminate this usage entirely without breaking compatibility with most users. (Anyone still on 3.5 probably has bigger problems.)

dargueta avatar Jul 09 '24 04:07 dargueta

Right, we should switch to setuptools. Will try that as soon as I have a chance.

kosarev avatar Jul 17 '24 22:07 kosarev

References to distutils are removed in 9a5d7447e145d592f45f6192098638d0d7ceaab7. @mortenjc Morten, can you give it a try?

kosarev avatar Jul 26 '24 19:07 kosarev

Hi,

This seems to work for me

Best

Morten


From: Ivan Kosarev @.***> Sent: Friday, July 26, 2024 9:08 PM To: kosarev/z80 Cc: Morten Jagd Christensen; Mention Subject: Re: [kosarev/z80] pip install z80 fails (Issue #53)

References to distutils are removed in 9a5d744https://github.com/kosarev/z80/commit/9a5d7447e145d592f45f6192098638d0d7ceaab7. @mortenjchttps://github.com/mortenjc Morten, can you give it a try?

— Reply to this email directly, view it on GitHubhttps://github.com/kosarev/z80/issues/53#issuecomment-2253319030, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABEHBDRY2UEEXMALDCB76FDZOKNCLAVCNFSM6AAAAABKQ7DNO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJTGMYTSMBTGA. You are receiving this because you were mentioned.Message ID: @.***>

mortenjc avatar Jul 30 '24 06:07 mortenjc

still not working for me: Collecting z80 Downloading z80-1.0b3.tar.gz (49 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.3/49.3 kB 1.2 MB/s eta 0:00:00 Preparing metadata (setup.py) ... done Installing collected packages: z80 DEPRECATION: z80 is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559 Running setup.py install for z80 ... error error: subprocess-exited-with-error

× Running setup.py install for z80 did not run successfully. │ exit code: 1 ╰─> [63 lines of output] running install C:\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py creating build creating build\lib.win-amd64-cpython-311 creating build\lib.win-amd64-cpython-311\z80 copying z80_disasm.py -> build\lib.win-amd64-cpython-311\z80 copying z80_disasm_parser.py -> build\lib.win-amd64-cpython-311\z80 copying z80_error.py -> build\lib.win-amd64-cpython-311\z80 copying z80_instr.py -> build\lib.win-amd64-cpython-311\z80 copying z80_machine.py -> build\lib.win-amd64-cpython-311\z80 copying z80_main.py -> build\lib.win-amd64-cpython-311\z80 copying z80_source.py -> build\lib.win-amd64-cpython-311\z80 copying z80_token.py -> build\lib.win-amd64-cpython-311\z80 copying z80_init_.py -> build\lib.win-amd64-cpython-311\z80 running build_ext building 'z80._z80' extension creating build\temp.win-amd64-cpython-311 creating build\temp.win-amd64-cpython-311\Release creating build\temp.win-amd64-cpython-311\Release\z80 "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Python311\include -IC:\Python311\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpz80/_z80module.cpp /Fobuild\temp.win-amd64-cpython-311\Release\z80/_z80module.obj _z80module.cpp "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Python311\libs /LIBPATH:C:\Python311 /LIBPATH:C:\Python311\PCbuild\amd64 "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\x64" /EXPORT:PyInit__z80 build\temp.win-amd64-cpython-311\Release\z80/z80module.obj /OUT:build\lib.win-amd64-cpython-311\z80_z80.cp311-win_amd64.pyd /IMPLIB:build\temp.win-amd64-cpython-311\Release\z80_z80.cp311-win_amd64.lib Creating library build\temp.win-amd64-cpython-311\Release\z80_z80.cp311-win_amd64.lib and object build\temp.win-amd64-cpython-311\Release\z80_z80.cp311-win_amd64.exp Generating code Finished generating code running install_lib creating C:\Python311\Lib\site-packages\z80 copying build\lib.win-amd64-cpython-311\z80_disasm.py -> C:\Python311\Lib\site-packages\z80 copying build\lib.win-amd64-cpython-311\z80_disasm_parser.py -> C:\Python311\Lib\site-packages\z80 copying build\lib.win-amd64-cpython-311\z80_error.py -> C:\Python311\Lib\site-packages\z80 copying build\lib.win-amd64-cpython-311\z80_instr.py -> C:\Python311\Lib\site-packages\z80 copying build\lib.win-amd64-cpython-311\z80_machine.py -> C:\Python311\Lib\site-packages\z80 copying build\lib.win-amd64-cpython-311\z80_main.py -> C:\Python311\Lib\site-packages\z80 copying build\lib.win-amd64-cpython-311\z80_source.py -> C:\Python311\Lib\site-packages\z80 copying build\lib.win-amd64-cpython-311\z80_token.py -> C:\Python311\Lib\site-packages\z80 copying build\lib.win-amd64-cpython-311\z80_z80.cp311-win_amd64.pyd -> C:\Python311\Lib\site-packages\z80 copying build\lib.win-amd64-cpython-311\z80_init.py -> C:\Python311\Lib\site-packages\z80 byte-compiling C:\Python311\Lib\site-packages\z80_disasm.py to _disasm.cpython-311.pyc byte-compiling C:\Python311\Lib\site-packages\z80_disasm_parser.py to _disasm_parser.cpython-311.pyc byte-compiling C:\Python311\Lib\site-packages\z80_error.py to _error.cpython-311.pyc byte-compiling C:\Python311\Lib\site-packages\z80_instr.py to _instr.cpython-311.pyc byte-compiling C:\Python311\Lib\site-packages\z80_machine.py to _machine.cpython-311.pyc byte-compiling C:\Python311\Lib\site-packages\z80_main.py to _main.cpython-311.pyc byte-compiling C:\Python311\Lib\site-packages\z80_source.py to _source.cpython-311.pyc byte-compiling C:\Python311\Lib\site-packages\z80_token.py to token.cpython-311.pyc byte-compiling C:\Python311\Lib\site-packages\z80_init.py to init.cpython-311.pyc running install_egg_info running egg_info writing z80.egg-info\PKG-INFO writing dependency_links to z80.egg-info\dependency_links.txt writing entry points to z80.egg-info\entry_points.txt writing top-level names to z80.egg-info\top_level.txt reading manifest file 'z80.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE' writing manifest file 'z80.egg-info\SOURCES.txt' Copying z80.egg-info to C:\Python311\Lib\site-packages\z80-1.0b3-py3.11.egg-info running install_scripts Installing z80-script.py script to C:\Python311\Scripts error: [Errno 13] Permission denied: 'C:\Python311\Scripts\z80-script.py' [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure

× Encountered error while trying to install package. ╰─> z80

note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.

fmuntean avatar Aug 08 '24 03:08 fmuntean

@fmuntean Did you try to pip install wheel before installing z80 as the deprecation message suggests?

kosarev avatar Aug 09 '24 21:08 kosarev

This bit:

 error: [Errno 13] Permission denied: 'C:\Python311\Scripts\z80-script.py'

looks like a problem with the Python setup itself. Can you install any packages into that folder at all? Another thing to try is a user-local (pip install --user z80) installation.

kosarev avatar Aug 09 '24 21:08 kosarev

pip install wheel
Requirement already satisfied: wheel in c:\python312\lib\site-packages (0.44.0)


pip install --user z80 Collecting z80 Downloading z80-1.0b3.tar.gz (49 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.3/49.3 kB 276.8 kB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [28 lines of output] Traceback (most recent call last): File "C:\Users\mfd\AppData\Roaming\Python\Python312\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in
main() File "C:\Users\mfd\AppData\Roaming\Python\Python312\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mfd\AppData\Roaming\Python\Python312\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mfd\AppData\Local\Temp\pip-build-env-ntcsy2lw\overlay\Lib\site-packages\setuptools\build_meta.py", line 327, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mfd\AppData\Local\Temp\pip-build-env-ntcsy2lw\overlay\Lib\site-packages\setuptools\build_meta.py", line 297, in _get_build_requires self.run_setup() File "C:\Users\mfd\AppData\Local\Temp\pip-build-env-ntcsy2lw\overlay\Lib\site-packages\setuptools\build_meta.py", line 497, in run_setup super().run_setup(setup_script=setup_script) File "C:\Users\mfd\AppData\Local\Temp\pip-build-env-ntcsy2lw\overlay\Lib\site-packages\setuptools\build_meta.py", line 313, in run_setup exec(code, locals()) File "", line 10, in File "C:\Python312\Lib\inspect.py", line 1282, in getsource lines, lnum = getsourcelines(object) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\inspect.py", line 1264, in getsourcelines lines, lnum = findsource(object) ^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\inspect.py", line 1093, in findsource raise OSError('could not get source code') OSError: could not get source code [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

fmuntean avatar Aug 10 '24 17:08 fmuntean

Does running pip install --upgrade setuptools wheel before installing z80 help?

kosarev avatar Aug 11 '24 09:08 kosarev

Does running pip install --upgrade setuptools wheel before installing z80 help?

install --upgrade setuptools wheel Requirement already satisfied: setuptools in c:\python311\lib\site-packages (65.5.0) Collecting setuptools Downloading setuptools-75.0.0-py3-none-any.whl (1.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 3.4 MB/s eta 0:00:00 Collecting wheel Downloading wheel-0.44.0-py3-none-any.whl (67 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 67.1/67.1 kB 3.6 MB/s eta 0:00:00 Installing collected packages: wheel, setuptools WARNING: Failed to write executable - trying to use .deleteme logic ERROR: Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified: 'C:\Python311\Scripts\wheel.exe' -> 'C:\Python311\Scripts\wheel.exe.deleteme'

fmuntean avatar Sep 15 '24 20:09 fmuntean

Installing collected packages: wheel, setuptools WARNING: Failed to write executable - trying to use .deleteme logic ERROR: Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified: 'C:\Python311\Scripts\wheel.exe' -> 'C:\Python311\Scripts\wheel.exe.deleteme'

Looks like it doesn't have rights to write the destination folder. Did you try to run this as administrator? Can you install any other packages at all?

kosarev avatar Sep 15 '24 20:09 kosarev