Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install z80 fails #53

Open
fmuntean opened this issue Mar 21, 2023 · 14 comments
Open

pip install z80 fails #53

fmuntean opened this issue Mar 21, 2023 · 14 comments
Assignees
Labels

Comments

@fmuntean
Copy link

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 /

@kosarev
Copy link
Owner

kosarev commented Mar 22, 2023

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 kosarev self-assigned this Mar 22, 2023
@mortenjc
Copy link

mortenjc commented Jul 8, 2024

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?

@dargueta
Copy link

dargueta commented Jul 9, 2024

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.)

@kosarev
Copy link
Owner

kosarev commented Jul 17, 2024

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

@kosarev
Copy link
Owner

kosarev commented Jul 26, 2024

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

@mortenjc
Copy link

mortenjc commented Jul 30, 2024 via email

@fmuntean
Copy link
Author

fmuntean commented Aug 8, 2024

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 pypa/pip#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.

@kosarev
Copy link
Owner

kosarev commented Aug 9, 2024

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

@kosarev
Copy link
Owner

kosarev commented Aug 9, 2024

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.

@fmuntean
Copy link
Author

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.

@kosarev
Copy link
Owner

kosarev commented Aug 11, 2024

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

@fmuntean
Copy link
Author

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'

@kosarev
Copy link
Owner

kosarev commented Sep 15, 2024

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?

@fmuntean
Copy link
Author

I have no problem installing other packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants