Unable to pip install old version of scikit-learn - python

I need to use scikit-learn==0.23.1 (or older) to make my project compatible with an AWS Lambda layer.
As suggested by this post, I tried pip3 install scikit-learn==0.23.1, but it did not work.
I then found an issue that suggested pip3 install -U scikit-learn==0.23.1 --no-cache-dir, but it did not work either.
I am using Python 3.11.1 on an M1 MacBook Air. These are the error logs from running pip3 install scikit-learn==0.23.1:
Collecting scikit-learn==0.23.1
Using cached scikit-learn-0.23.1.tar.gz (7.2 MB)
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [107 lines of output]
Ignoring numpy: markers 'python_version == "3.6" and platform_system != "AIX" and platform_python_implementation == "CPython"' don't match your environment
Ignoring numpy: markers 'python_version == "3.6" and platform_system != "AIX" and platform_python_implementation != "CPython"' don't match your environment
Ignoring numpy: markers 'python_version == "3.7" and platform_system != "AIX"' don't match your environment
Ignoring numpy: markers 'python_version == "3.6" and platform_system == "AIX"' don't match your environment
Ignoring numpy: markers 'python_version == "3.7" and platform_system == "AIX"' don't match your environment
Ignoring numpy: markers 'python_version >= "3.8" and platform_system == "AIX"' don't match your environment
Collecting setuptools
Using cached setuptools-67.2.0-py3-none-any.whl (1.1 MB)
Collecting wheel
Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
Collecting Cython>=0.28.5
Using cached Cython-0.29.33-py2.py3-none-any.whl (987 kB)
Collecting numpy==1.17.3
Using cached numpy-1.17.3.zip (6.4 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting scipy>=0.19.1
Using cached scipy-1.10.0-cp311-cp311-macosx_12_0_arm64.whl (28.7 MB)
Using cached scipy-1.9.3-cp311-cp311-macosx_12_0_arm64.whl (28.4 MB)
Using cached scipy-1.9.2-cp311-cp311-macosx_12_0_arm64.whl (28.4 MB)
Using cached scipy-1.9.1.tar.gz (42.0 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [67 lines of output]
The Meson build system
Version: 0.62.2
Source dir: /private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-install-txosa8qz/scipy_734bcce5e1d549fab1cee5a52c8d7f28
Build dir: /private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-install-txosa8qz/scipy_734bcce5e1d549fab1cee5a52c8d7f28/.mesonpy-7pg6lokl/build
Build type: native build
Project name: SciPy
Project version: 1.9.1
C compiler for the host machine: cc (clang 14.0.0 "Apple clang version 14.0.0 (clang-1400.0.29.202)")
C linker for the host machine: cc ld64 820.1
C++ compiler for the host machine: c++ (clang 14.0.0 "Apple clang version 14.0.0 (clang-1400.0.29.202)")
C++ linker for the host machine: c++ ld64 820.1
Host machine cpu family: aarch64
Host machine cpu: arm64
Compiler for C supports arguments -Wno-unused-but-set-variable: YES
Library m found: YES
../../meson.build:41:0: ERROR: Unknown compiler(s): [['gfortran'], ['flang'], ['nvfortran'], ['pgfortran'], ['ifort'], ['g95']]
The following exception(s) were encountered:
Running "gfortran --version" gave "[Errno 2] No such file or directory: 'gfortran'"
Running "gfortran -V" gave "[Errno 2] No such file or directory: 'gfortran'"
Running "flang --version" gave "[Errno 2] No such file or directory: 'flang'"
Running "flang -V" gave "[Errno 2] No such file or directory: 'flang'"
Running "nvfortran --version" gave "[Errno 2] No such file or directory: 'nvfortran'"
Running "nvfortran -V" gave "[Errno 2] No such file or directory: 'nvfortran'"
Running "pgfortran --version" gave "[Errno 2] No such file or directory: 'pgfortran'"
Running "pgfortran -V" gave "[Errno 2] No such file or directory: 'pgfortran'"
Running "ifort --version" gave "[Errno 2] No such file or directory: 'ifort'"
Running "ifort -V" gave "[Errno 2] No such file or directory: 'ifort'"
Running "g95 --version" gave "[Errno 2] No such file or directory: 'g95'"
Running "g95 -V" gave "[Errno 2] No such file or directory: 'g95'"
A full log can be found at /private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-install-txosa8qz/scipy_734bcce5e1d549fab1cee5a52c8d7f28/.mesonpy-7pg6lokl/build/meson-logs/meson-log.txt
+ meson setup --native-file=/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-install-txosa8qz/scipy_734bcce5e1d549fab1cee5a52c8d7f28/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2 --prefix=/Library/Frameworks/Python.framework/Versions/3.11 /private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-install-txosa8qz/scipy_734bcce5e1d549fab1cee5a52c8d7f28 /private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-install-txosa8qz/scipy_734bcce5e1d549fab1cee5a52c8d7f28/.mesonpy-7pg6lokl/build
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-build-env-u2xs3lnb/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 969, in get_requires_for_build_wheel
with _project(config_settings) as project:
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-build-env-u2xs3lnb/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 948, in _project
with Project.with_temp_working_dir(
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-build-env-u2xs3lnb/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 777, in with_temp_working_dir
yield cls(source_dir, tmpdir, build_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-build-env-u2xs3lnb/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 682, in __init__
self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
File "/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-build-env-u2xs3lnb/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 713, in _configure
self._meson(
File "/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-build-env-u2xs3lnb/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 696, in _meson
return self._proc('meson', *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-build-env-u2xs3lnb/overlay/lib/python3.11/site-packages/mesonpy/__init__.py", line 691, in _proc
subprocess.check_call(list(args))
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['meson', 'setup', '--native-file=/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-install-txosa8qz/scipy_734bcce5e1d549fab1cee5a52c8d7f28/.mesonpy-native-file.ini', '-Ddebug=false', '-Doptimization=2', '--prefix=/Library/Frameworks/Python.framework/Versions/3.11', '/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-install-txosa8qz/scipy_734bcce5e1d549fab1cee5a52c8d7f28', '/private/var/folders/c2/v1x2pn511b79mxpbdj208p780000gn/T/pip-install-txosa8qz/scipy_734bcce5e1d549fab1cee5a52c8d7f28/.mesonpy-7pg6lokl/build']' returned non-zero exit status 1.
[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.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies 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.
Any ideas on how to successfully install version 0.23.1 of scikit-learn?

sklearn==0.23.1 has not distribution package for Python==3.11, only for 3.6, 3.7 and 3.8 so you have to install from source but your need some binaries like gfortran, etc.
To installing on M1, use miniforge:
The recently introduced macos/arm64 platform (sometimes also known as macos/aarch64) requires the open source community to upgrade the build configuration and automation to properly support it.
At the time of writing (January 2021), the only way to get a working installation of scikit-learn on this hardware is to install scikit-learn and its dependencies from the conda-forge distribution, for instance using the miniforge installers:
https://scikit-learn.org/stable/install.html#installing-on-apple-silicon-m1-hardware

Related

pip wxpython gives ModuleNotFoundError: No module named 'attrdict'

Installing wxpython with pip gives the error ModuleNotFoundError: No module named 'attrdict'
Details:
py -3.10-64 -m pip install -U wxpython
Collecting wxpython
Using cached wxPython-4.2.0.tar.gz (71.0 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\Bernard\AppData\Local\Temp\pip-install-dokcizpt\wxpython_662eefb4314c47eba7b194b4d07a8e18\setup.py", line 27, in <module>
from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
File "C:\Users\Bernard\AppData\Local\Temp\pip-install-dokcizpt\wxpython_662eefb4314c47eba7b194b4d07a8e18\buildtools\config.py", line 30, in <module>
from attrdict import AttrDict
ModuleNotFoundError: No module named 'attrdict'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
What works
installing other packages works, e.g.
py -3.10-64 -m pip install -U mido
Requirement already satisfied: mido in c:\python311\lib\site-packages (1.2.10)
Version info
Windows 10 22H2
pip 23.0.1 from C:\Python311\Lib\site-packages\pip (python 3.11)
Context
This is used in the fluidpatcher installer, I logged a bug here.
Update 1
Seems to be a known issue reported here: https://github.com/wxWidgets/Phoenix/issues/2296
Tried workaround of manually installing
py -3.10-64 -m pip install -U attrdict3
Which installs.
Then retried the wxpython install
py -3.10-64 -m pip install -U wxpython
Which fails, this time with a different error message
Collecting wxpython
Using cached wxPython-4.2.0.tar.gz (71.0 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pillow in c:\python311\lib\site-packages (from wxpython) (9.4.0)
Requirement already satisfied: six in c:\python311\lib\site-packages (from wxpython) (1.16.0)
Requirement already satisfied: numpy in c:\python311\lib\site-packages (from wxpython) (1.24.2)
Installing collected packages: wxpython
DEPRECATION: wxpython 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 wxpython ... error
error: subprocess-exited-with-error
× Running setup.py install for wxpython did not run successfully.
│ exit code: 1
╰─> [49 lines of output]
C:\Python311\Lib\site-packages\setuptools\dist.py:771: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
warnings.warn(
C:\Python311\Lib\site-packages\setuptools\config\setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
C:\Python311\Lib\site-packages\setuptools\dist.py:317: DistDeprecationWarning: use_2to3 is ignored.
warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
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
Will build using: "C:\Python311\python.exe"
3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
Python's architecture is 64bit
cfg.VERSION: 4.2.0
Running command: build
Running command: build_wx
Command '"C:\Python311\python.exe" -c "import os, sys, setuptools.msvc; setuptools.msvc.isfile = lambda path: path is not None and os.path.isfile(path); ei = setuptools.msvc.EnvironmentInfo('x64', vc_min_ver=14.0); env = ei.return_env(); env['vc_ver'] = ei.vc_ver; env['vs_ver'] = ei.vs_ver; env['arch'] = ei.pi.arch; env['py_ver'] = sys.version_info[:2]; print(env)"' failed with exit code 1.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python311\Lib\site-packages\setuptools\msvc.py", line 1120, in __init__
self.si = SystemInfo(self.ri, vc_ver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\setuptools\msvc.py", line 596, in __init__
vc_ver or self._find_latest_available_vs_ver())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\setuptools\msvc.py", line 610, in _find_latest_available_vs_ver
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: No Microsoft Visual C++ version found
Finished command: build_wx (0m1.80s)
Finished command: build (0m1.80s)
WARNING: Building this way assumes that all generated files have been
generated already. If that is not the case then use build.py directly
to generate the source and perform the build stage. You can use
--skip-build with the bdist_* or install commands to avoid this
message and the wxWidgets and Phoenix build steps in the future.
"C:\Python311\python.exe" -u build.py build
Command '"C:\Python311\python.exe" -u build.py build' failed with exit code 1.
[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.
╰─> wxpython

Can't install pyo using pip

When trying to install pyo using pip I get error
$ pip install pyo
Collecting pyo
Using cached pyo-1.0.4.tar.gz (6.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-06kfbyzb\pyo_9bd28f6f7eba4c5aa2896ae564b089f6\setup.py", line 293, in <module>
for f in os.listdir(data_files_common_path)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Then I tried
$ pip install pyo --use-deprecated=backtrack-on-build-failures
DEPRECATION: Backtracking on build failures can mask issues related to how a package generates metadata or builds a wheel. This flag will be removed in pip 22.2. A possible replacement is avoiding known-bad versions by explicitly telling pip to ignore them (either directly as requirements, or via a constraints file). Discussion can be found at https://github.com/pypa/pip/issues/10655
Collecting pyo
Using cached pyo-1.0.4.tar.gz (6.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-_t68yako\pyo_d26c3df31ce44e44babd1e5def6de075\setup.py", line 293, in <module>
for f in os.listdir(data_files_common_path)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Discarding https://files.pythonhosted.org/packages/7a/4a/a681a4c1c6db790b39f24c3384debedd583db48bea47362640ebcab1f3a6/pyo-1.0.4.tar.gz#sha256=34937eba641ed6b1c8ede1c35f30ad5e08493ec1f09352398790910bfd19d445 (from https://pypi.org/simple/pyo/) (requires-python:>=3.6, <4) due to build failure: metadata generation failed
Using cached pyo-1.0.3.tar.gz (5.2 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-_t68yako\pyo_3f80885b827046bbb8de3e7c16e16c7b\setup.py", line 215, in <module>
[os.path.join(data_files_common_path, f) for f in os.listdir(data_files_common_path) if f.endswith(".dll")])]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Discarding https://files.pythonhosted.org/packages/60/ea/e717ec9cef74dc4a26000b29b1cf8703e2871d9edaae189dc515d8e74910/pyo-1.0.3.tar.gz#sha256=f0d187a78e3ab9f10275853a22b6a08094aeed4e0c2adee8697734373aa8dd1f (from https://pypi.org/simple/pyo/) (requires-python:>=3.6, <4) due to build failure: metadata generation failed
Using cached pyo-1.0.2.tar.gz (5.2 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-_t68yako\pyo_7636aa31397442f693130603d4cb92d8\setup.py", line 215, in <module>
[os.path.join(data_files_common_path, f) for f in os.listdir(data_files_common_path) if f.endswith(".dll")])]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Discarding https://files.pythonhosted.org/packages/4c/48/2b5ea0d2e52edbb3d440fbbf7992f52c9727b2c4117f11b6348abf51706b/pyo-1.0.2.tar.gz#sha256=cb716d2c38a02f3aafba2cb5a47af67d78433580f6536c57fd0883283d3bf64a (from https://pypi.org/simple/pyo/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4) due to build failure: metadata generation failed
Using cached pyo-1.0.1.tar.gz (5.2 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-_t68yako\pyo_9550d20742e24085af8ace9202cb7913\setup.py", line 212, in <module>
[os.path.join(data_files_common_path, f) for f in os.listdir(data_files_common_path) if f.endswith(".dll")])]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Discarding https://files.pythonhosted.org/packages/9c/f2/87f07599a2f107f02a9f7cf11599c5eecf37662356296e1236c17ec997f4/pyo-1.0.1.tar.gz#sha256=e85a3e9e4e17769c4178c907e6b8f01bc455fe0fa348b0ce64d5698ec7e82202 (from https://pypi.org/simple/pyo/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4) due to build failure: metadata generation failed
Using cached pyo-1.0.0.tar.gz (5.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\VA\AppData\Local\Temp\pip-install-_t68yako\pyo_712915a0221348b59415409f622bde9f\setup.py", line 211, in <module>
[os.path.join(data_files_common_path, f) for f in os.listdir(data_files_common_path) if f.endswith(".dll")])]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'win64dlls\\win64_pyo_data_files_common'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Discarding https://files.pythonhosted.org/packages/67/0f/2c3f9fb88effc62571c209525b5e84d1ec0b68611c916daa96ae8c84f43f/pyo-1.0.0.tar.gz#sha256=4ad45d32ae6ef5865762594223bddf0d6efa7e45657b899b16cda33ce328ebfd (from https://pypi.org/simple/pyo/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4) due to build failure: metadata generation failed
ERROR: Could not find a version that satisfies the requirement pyo (from versions: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4)
ERROR: No matching distribution found for pyo
The python version
$ python --version
Python 3.10.4
Tried to install AJAX SOUND STUDIO pyo
For AJax Sound studio I tried with latest pyo 0.9.1 but still error persists so I tried with pyo 0.8.4.
Still the issue is not solved.
The above terminal output is from Anaconda Promt from Windows. I also tried to install pyo in Ubuntu. In that OS also I am facing issues with installing PYO.
Terminal output for installation in Ubuntu
$ pip install pyo
Terminal output
tried to install pyo using conda but package is not found
$ conda install pyo
Looking at [PyPI]: pyo 1.0.4 - Download files (newest published version at answer time), prebuilt .whls (for Win) are available if all below apply:
Python version: v3.9, v3.8, v3.7, v3.6
Python arch: pc064 (win_amd64)
Also, building from sources (fall back if no prebuilt .whl available), is complex (and doesn't work OOTB - only tried for Win, but I'm 99% sure that it's the same for Nix) as it requires some additional steps (building / using a bunch of dependencies), so the error pops up (if fixed, another will, and so on).
So, stick with supported Python versions until a new PyO version will be released (this one is 1+ year old). Of course building from sources is an option, but it requires deeper knowledge.
Update #0
Built .whls and published them on [GitHub]: CristiFati/Prebuilt-Binaries - (master) Prebuilt-Binaries/PyO/v1.0.4 (win_amd64 for Python: v3.11, v3.10 and win32 for current Python versions). Check [SO]: Installing pygraphviz on Windows 10 64-bit, Python 3.6 (#CristiFati's answer) (Shortcut section at the end) for details regarding custom .whl installation.
I used the following script to (quickly) test them.
code00.py:
#!/usr/bin/env python
import sys
import time
import pyo
def main(*argv):
sample_name = "Sine"
sample_class = getattr(pyo, sample_name, None)
if sample_class is None:
print("Invalid sample: {:s}".format(sample_name))
return -1
secs = 2
out_file = "{:s}.wav".format(sample_name)
srv = pyo.Server().boot()
print("Playing sound ({:s}) for {:.3f} seconds (and saving to '{:s}') ...".format(sample_name, secs, out_file))
srv.start()
srv.recstart(out_file)
sample = sample_class(mul=0.01).out()
print("Sample: {:}".format(sample))
time.sleep(secs)
srv.recstop()
srv.stop()
sfp = pyo.SfPlayer(out_file)
print("SFP: {:}".format(sfp))
if __name__ == "__main__":
print("Python {:s} {:03d}bit on {:s}\n".format(" ".join(elem.strip() for elem in sys.version.split("\n")),
64 if sys.maxsize > 0x100000000 else 32, sys.platform))
rc = main(*sys.argv[1:])
print("\nDone.\n")
sys.exit(rc)
Output:
[cfati#CFATI-5510-0:e:\Work\Dev\StackOverflow\q073508905]> sopr.bat
### Set shorter prompt to better fit when pasted in StackOverflow (or other) pages ###
[prompt]> :: ------- PYTHON 3.10 -------
[prompt]> "e:\Work\Dev\VEnvs\py_pc064_03.10_test0\Scripts\python.exe" -m pip install "e:\Work\Dev\GitHub\CristiFati\Prebuilt-Binaries\pyo\v1.0.4\pyo-1.0.4-cp310-cp310-win_amd64.whl"
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Processing e:\work\dev\github\cristifati\prebuilt-binaries\pyo\v1.0.4\pyo-1.0.4-cp310-cp310-win_amd64.whl
Installing collected packages: pyo
Successfully installed pyo-1.0.4
WARNING: You are using pip version 21.3.1; however, version 22.2.2 is available.
You should consider upgrading via the 'e:\Work\Dev\VEnvs\py_pc064_03.10_test0\Scripts\python.exe -m pip install --upgrade pip' command.
[prompt]>
[prompt]> "e:\Work\Dev\VEnvs\py_pc064_03.10_test0\Scripts\python.exe" ./code00.py
WxPython is not found for the current python version.
Pyo will use a minimal GUI toolkit written with Tkinter (if available).
This toolkit has limited functionnalities and is no more
maintained or updated. If you want to use all of pyo's
GUI features, you should install WxPython, available here:
http://www.wxpython.org/
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] 064bit on win32
Pyo warning: Portmidi closed.
Playing sound (Sine) for 2.000 seconds (and saving to 'Sine.wav') ...
Sample: < Instance of Sine class >
SFP: < Instance of SfPlayer class >
Done.
[prompt]>
[prompt]> :: ------- PYTHON 3.11 -------
[prompt]> "e:\Work\Dev\VEnvs\py_pc064_03.11_test0\Scripts\python.exe" -m pip install "e:\Work\Dev\GitHub\CristiFati\Prebuilt-Binaries\pyo\v1.0.4\pyo-1.0.4-cp311-cp311-win_amd64.whl"
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Processing e:\work\dev\github\cristifati\prebuilt-binaries\pyo\v1.0.4\pyo-1.0.4-cp311-cp311-win_amd64.whl
Installing collected packages: pyo
Successfully installed pyo-1.0.4
WARNING: You are using pip version 21.3.1; however, version 22.2.2 is available.
You should consider upgrading via the 'e:\Work\Dev\VEnvs\py_pc064_03.11_test0\Scripts\python.exe -m pip install --upgrade pip' command.
[prompt]>
[prompt]> "e:\Work\Dev\VEnvs\py_pc064_03.11_test0\Scripts\python.exe" ./code00.py
WxPython is not found for the current python version.
Pyo will use a minimal GUI toolkit written with Tkinter (if available).
This toolkit has limited functionnalities and is no more
maintained or updated. If you want to use all of pyo's
GUI features, you should install WxPython, available here:
http://www.wxpython.org/
Python 3.11.0rc1 (main, Aug 8 2022, 11:30:54) [MSC v.1932 64 bit (AMD64)] 064bit on win32
Pyo warning: Portmidi closed.
Playing sound (Sine) for 2.000 seconds (and saving to 'Sine.wav') ...
Sample: < Instance of Sine class >
SFP: < Instance of SfPlayer class >
Done.
[prompt]>
[prompt]> :: ------- PYTHON 3.7 (!!! PC032 !!!) -------
[prompt]> "e:\Work\Dev\VEnvs\py_pc032_03.07_test0\Scripts\python.exe" -m pip install "e:\Work\Dev\GitHub\CristiFati\Prebuilt-Binaries\pyo\v1.0.4\pyo-1.0.4-cp37-cp37m-win32.whl"
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Processing e:\work\dev\github\cristifati\prebuilt-binaries\pyo\v1.0.4\pyo-1.0.4-cp37-cp37m-win32.whl
Installing collected packages: pyo
Successfully installed pyo-1.0.4
WARNING: You are using pip version 20.3.3; however, version 22.2.2 is available.
You should consider upgrading via the 'e:\Work\Dev\VEnvs\py_pc032_03.07_test0\Scripts\python.exe -m pip install --upgrade pip' command.
[prompt]>
[prompt]> "e:\Work\Dev\VEnvs\py_pc032_03.07_test0\Scripts\python.exe" ./code00.py
WxPython is not found for the current python version.
Pyo will use a minimal GUI toolkit written with Tkinter (if available).
This toolkit has limited functionnalities and is no more
maintained or updated. If you want to use all of pyo's
GUI features, you should install WxPython, available here:
http://www.wxpython.org/
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:01:55) [MSC v.1900 32 bit (Intel)] 032bit on win32
Pyo warning: Portmidi closed.
Playing sound (Sine) for 2.000 seconds (and saving to 'Sine.wav') ...
Sample: < Instance of Sine class >
SFP: < Instance of SfPlayer class >
Done.
Note: Needless to say that during each run, an annoying high pitch sound (corresponding to default frequency) was playing for 2 seconds.

Can't install Pyinstaller through pip

I am reasonably new to python and want to make a .exe from a .py.
However when i try to install pyinstaller with pip i get the following error:
I tried numerous things but cant resolve it.
Collecting pyinstaller
Using cached pyinstaller-5.2-py3-none-win_amd64.whl (1.2 MB)
Collecting pyinstaller-hooks-contrib>=2021.4
Using cached pyinstaller_hooks_contrib-2022.8-py2.py3-none-any.whl (239 kB)
Collecting pefile>=2022.5.30
Using cached pefile-2022.5.30.tar.gz (72 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: setuptools in c:\program files\spyder\pkgs (from pyinstaller) (62.3.2)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\program files\spyder\pkgs (from pyinstaller) (0.2.0)
Collecting altgraph
Using cached altgraph-0.17.2-py2.py3-none-any.whl (21 kB)
Collecting future
Using cached future-0.18.2.tar.gz (829 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
error: subprocess-exited-with-error
python setup.py egg_info did not run successfully.
exit code: 1
[6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\Z640179\AppData\Local\Temp\pip-install-klih4e96\future_d33b369ed28249c0b3c49bd67cf826d5\setup.py", line 86, in <module>
import src.future
ModuleNotFoundError: No module named 'src'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Encountered error while generating package metadata.
See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for detail
Does anybody know how to resolve this ?
EDIT: i tried installing SRC but got the following problem:
Collecting src
Using cached src-0.0.7.zip (6.3 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: src
Building wheel for src (setup.py): started
Building wheel for src (setup.py): finished with status 'error'
Running setup.py clean for src
Failed to build src
Installing collected packages: src
Running setup.py install for src: started
Running setup.py install for src: finished with status 'error'
Note: you may need to restart the kernel to use updated packages.
error: subprocess-exited-with-error
python setup.py bdist_wheel did not run successfully.
exit code: 1
[49 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib
creating build\lib\src
copying src\__init__.py -> build\lib\src
running egg_info
writing src.egg-info\PKG-INFO
writing dependency_links to src.egg-info\dependency_links.txt
deleting src.egg-info\entry_points.txt
writing requirements to src.egg-info\requires.txt
writing top-level names to src.egg-info\top_level.txt
reading manifest file 'src.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE.rst'
writing manifest file 'src.egg-info\SOURCES.txt'
C:\Program Files\Spyder\pkgs\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\Z640179\AppData\Local\Temp\pip-install-knke7ajt\src_eb79a5c109004a059d46335d661a3522\setup.py", line 70, in <module>
setup(
File "C:\Program Files\Spyder\pkgs\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\core.py", line 148, in setup
return run_commands(dist)
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\core.py", line 163, in run_commands
dist.run_commands()
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\dist.py", line 967, in run_commands
self.run_command(cmd)
File "C:\Program Files\Spyder\pkgs\setuptools\dist.py", line 1229, in run_command
super().run_command(command)
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Program Files\Spyder\pkgs\wheel\bdist_wheel.py", line 301, in run
install = self.reinitialize_command('install',
File "C:\Program Files\Spyder\pkgs\setuptools\__init__.py", line 142, in reinitialize_command
cmd = _Command.reinitialize_command(self, command, reinit_subcommands)
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\cmd.py", line 305, in reinitialize_command
return self.distribution.reinitialize_command(command,
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\dist.py", line 951, in reinitialize_command
for sub in command.get_sub_commands():
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\cmd.py", line 324, in get_sub_commands
if method is None or method(self):
File "C:\Program Files\Spyder\pkgs\setuptools\_distutils\command\install.py", line 756, in has_lib
return (self.distribution.has_pure_modules() or
AttributeError: 'NoneType' object has no attribute 'has_pure_modules'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for src
error: subprocess-exited-with-error
Running setup.py install for src did not run successfully.
exit code: 1
[2 lines of output]
running install
You've probably made a mistake here and are trying to install from a 'src' directory which doesn't exist.
[end of output]
I tried to update wheel but it is already up to date.
Looks like you need to install src.
Pip install src
Pyinstaller can’t convert a file to an exe if a required packages isn’t installed.

MySQL pip3 install error: metadata-generation-failed

Ive tried updating pip and installing different packages but nothing seems to work. im not sure if i have to run a command in konsole or alacritty but any help would be appreciated. i use fedora btw
sh-5.1$ pip3 install mysql
Defaulting to user installation because normal site-packages is not writeable
Collecting mysql
Using cached mysql-0.0.3-py3-none-any.whl (1.2 kB)
Collecting mysqlclient
Using cached mysqlclient-2.1.1.tar.gz (88 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
/bin/sh: line 1: mysql_config: command not found
/bin/sh: line 1: mariadb_config: command not found
/bin/sh: line 1: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-lol73zmo/mysqlclient_d4096e3cc1ee4a6fbc53886cb9de5a17 /
setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-lol73zmo/mysqlclient_d4096e3cc1ee4a6fbc53886cb9de5a17
/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-lol73zmo/mysqlclient_d4096e3cc1ee4a6fbc53886cb9de5a17
/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
before installing you have to resolve dependencies .
sudo apt-get install python3-dev libmysqlclient-dev
then inside a virtual environment:
pip3 install mysqlclient
then
pip3 install mysql
it should work

Getting "error while generating package metadata" when installing TkFontAwesome

I'm trying to install TkFontAwesome using python -m pip install tkfontawesome, but always get the following error:
Collecting tkfontawesome
Using cached tkfontawesome-0.2.0-py3-none-any.whl (405 kB)
Collecting tksvg==0.7.4
Using cached tksvg-0.7.4.tar.gz (50 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Installing dependency cmake... Traceback (most recent call last):
File "<string>", line 36, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\myuser\AppData\Local\Temp\pip-install-2krbeh5s\tksvg_7491a69795da43779e9e71e527849349\setup.py", line 62, in <module>
sp.call(["pacman", "--needed", "--noconfirm", "-S", "mingw-w64-x86_64-{}".format(dep)]) # , stdout=sp.PIPE)
File "C:\Users\myuser\AppData\Local\Programs\Thonny\lib\subprocess.py", line 339, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\myuser\AppData\Local\Programs\Thonny\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Users\myuser\AppData\Local\Programs\Thonny\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Never had any problems installing packages using pip before. The file subprocess.py IS in \Thonny\lib\ if this WinError 2 means that.
I'm using:
Python 3.7.7
pip 22.0.3
Tk 8.6.9
Thonny 3.2.7
Windows 10
So far i've tried:
to update my pip and setuptools (they're already up-to-date)
to install TkFontAwesome using ez_setup
to install TkFontAwesome using --use-deprecated=backtrack-on-build-failures
No use. Anyone have any ideas what to do next? Thanks in advance.
Try add this after your pip3 install package:
--use-deprecated=backtrack-on-build-failures
eg, if you want:
pip3 install imageAI
then:
pip3 install imageAI --use-deprecated=backtrack-on-build-failures
copy from there.

Categories

Resources