Apologies in advance I’m a noob. The first error I was getting said Microsoft Visual C++ 14.0 or greater is required. So I googled that and downloaded VC v14+ runtime library which is what someone suggested. That did not change anything so I went with the next suggestion which was to download Visual Studio 2019 Build Tools and get the C++ Build Tools with MSVC v142 – VS 2019 C++ x64/x86 build tools (v 14.26) & Windows 10 SDK (10.0.17763.0) Now when I try to install pyblake 2 it says this:
C:Usersniles>pip install pyblake2
Defaulting to user installation because normal site-packages is not writeable
Collecting pyblake2
Using cached pyblake2-1.1.2.tar.gz (126 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyblake2
Building wheel for pyblake2 (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pyblake2 (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
running bdist_wheel
running build
running build_ext
building 'pyblake2' extension
creating build
creating buildtemp.win-amd64-cpython-312
creating buildtemp.win-amd64-cpython-312Release
"C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.38.33130binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DBLAKE2_COMPRESS_AUTO=1 "-IC:Program FilesPython312include" "-IC:Program FilesPython312Include" "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.38.33130include" "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCAuxiliaryVSinclude" "-IC:Program Files (x86)Windows Kits10include10.0.22621.0ucrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\um" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\shared" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\winrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\cppwinrt" /Tcblake2b_impl.c /Fobuildtemp.win-amd64-cpython-312Releaseblake2b_impl.obj
blake2b_impl.c
"C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.38.33130binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DBLAKE2_COMPRESS_AUTO=1 "-IC:Program FilesPython312include" "-IC:Program FilesPython312Include" "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.38.33130include" "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCAuxiliaryVSinclude" "-IC:Program Files (x86)Windows Kits10include10.0.22621.0ucrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\um" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\shared" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\winrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\cppwinrt" /Tcblake2s_impl.c /Fobuildtemp.win-amd64-cpython-312Releaseblake2s_impl.obj
blake2s_impl.c
"C:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.38.33130binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DBLAKE2_COMPRESS_AUTO=1 "-IC:Program FilesPython312include" "-IC:Program FilesPython312Include" "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCToolsMSVC14.38.33130include" "-IC:Program Files (x86)Microsoft Visual Studio2022BuildToolsVCAuxiliaryVSinclude" "-IC:Program Files (x86)Windows Kits10include10.0.22621.0ucrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\um" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\shared" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\winrt" "-IC:Program Files (x86)Windows Kits10\include10.0.22621.0\cppwinrt" /Tcpyblake2module.c /Fobuildtemp.win-amd64-cpython-312Releasepyblake2module.obj
pyblake2module.c
pyblake2module.c(651): warning C4244: '=': conversion from 'Py_ssize_t' to 'uint8_t', possible loss of data
pyblake2module.c(661): warning C4244: '=': conversion from 'Py_ssize_t' to 'uint8_t', possible loss of data
pyblake2module.c(699): error C2106: '=': left operand must be l-value
pyblake2module.c(703): error C2106: '=': left operand must be l-value
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyblake2
Failed to build pyblake2
ERROR: Could not build wheels for pyblake2, which is required to install pyproject.toml-based projects
2
Answers
If you encounter the error "Failed building wheel for x" when trying to install a Python package using pip, it usually means that the package includes C extensions that need to be compiled, but there are missing dependencies or the build environment is not set up correctly. Here are some steps you can take to address this issue:
1. Check Dependencies:
Make sure that you have all the necessary dependencies installed on your system. Some packages require external libraries or development tools. Refer to the package’s documentation or installation instructions for any specific requirements.
2. Install Development Tools:
On Linux, you may need to install build-essential or similar tools. On Windows, you might need to install Microsoft Visual C++ Build Tools. On macOS, you can install Xcode Command Line Tools.
3. Update pip and setuptools:
Make sure you have the latest versions of pip and setuptools. You can upgrade them using the following commands:
4. Use a Virtual Environment:
Create a virtual environment and install the package within that environment. This can help avoid conflicts with other installed packages. Here’s an example:
5. Check System Dependencies:
Some packages may require system-level dependencies to be installed. For example, if you are installing a package that relies on a specific library, make sure that library is installed on your system.
6. Check Package Documentation:
Review the documentation of the package you are trying to install. It may provide specific instructions or troubleshooting tips for installation.
7. Use Pre-built Wheels:
Instead of building from source, you can try installing a pre-built wheel. Many packages provide wheels for common platforms, and they can be installed faster. For example:
8. Check Compiler Compatibility:
Ensure that your compiler is compatible with the version of Python you are using. For example, if you are using Python 3.8, make sure your compiler is compatible with Python 3.8.
pyblake2
at PyPI. Last version 1.1.2 was released at Apr 11, 2018. The list of supported Python versions is: Python 2.6 to 3.5. The error message shows the code was for older version of Python. Most probably Python 3.5 is the last supported version.Let’ see at the GitHub development page. This repository was archived by the owner on Sep 14, 2020. It is now read-only and will never be updated. The end of the story.
But the page gives a very important hint:
So you should use BLAKE2 from hashlib from the standard library. You don’t need to install it, it should be readily available with your Python installation.