Failed building wheel for bcrypt when running pip install flask-bcrypt - python

I'm trying to run pip install flask-bcrypt for my flask application but i'm running into the following error
=============================DEBUG
ASSISTANCE=============================
If you are seeing a compilation error, please try the following steps to
successfully install bcrypt:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Ensure you have a recent Rust toolchain installed. bcrypt requires
rustc >= 1.56.0.
Python: 3.9.12
platform: Windows-10-10.0.19044-SP0
pip: n/a
setuptools: 65.5.0
setuptools_rust: 1.5.2
rustc: 1.64.0 (a55dd71d5 2022-09-19)
=============================DEBUG ASSISTANCE============================
error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src\_bcrypt\Cargo.toml --release -v --features 'pyo3/abi3-py36 pyo3/extension-module' -- --crate-type cdylib` failed with code 101
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for bcrypt
Failed to build bcrypt
ERROR: Could not build wheels for bcrypt, which is required to install pyproject.toml-based projects
I have already tried upgrading to the latest pip, pip install wheel, and updating rustc. Sorry for the confusion, first time asking for help on stackoverflow.

The issue was caused by a lack of package management. I swapped from windows to ubuntu and created a virtual environment and the problem was resolved.

Related

Unable to install Flask - SQLAlchemy with pip (greenlet build error) - Windows, Venv

I am trying to install Flask-SQLAlchemy with pip install -U Flask-SQLAlchemy and I'm getting this error during greenlet's build, I put a "..." to skip all of the copying files etc:
× Running setup.py install for greenlet did not run successfully.
│ exit code: 1
╰─> [92 lines of output]
running install
D:\test\server\.venv\lib\python3.10\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
...
copying src\greenlet\tests\_test_extension_cpp.cpp -> build\lib.mingw_x86_64-cpython-310\greenlet\tests
running build_ext
building 'greenlet._greenlet' extension
error: --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64')
[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.
╰─> greenlet
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I'm on Windows 10, AMD processor, pip version 23.0, python3 version 3.10.7. The package installs fine globally and in WSL, but fails every time with this error within the virtual environment which I run with ..venv\bin\Activate.ps1. Any ideas on how to fix this, maybe this isn't on my end?
This error is indicating that the greenlet package is failing to build during the installation of Flask-SQLAlchemy. The error message mentions that the --plat-name must be one of ('win32', 'win-amd64', 'win-arm32', 'win-arm64'). This means that the platform you are building the greenlet package for must be specified.
One solution could be to try to install the package using a specific platform name, such as:
pip install --no-use-pep517 -U --plat-name=win-amd64 Flask-SQLAlchemy
It is possible that the win-amd64 platform name is not correct for your system, in which case you can try one of the other platform names in the list.
If this doesn't work, it could be due to a compatibility issue between greenlet and the version of Python you are using (3.10.7). Try to upgrade or downgrade your Python version and see if that resolves the issue.

Error in building wheel for cryptography while installing firebase-admin on raspberry pi 3

I was installing firebase-admin using pip on my raspberry pi 3b+ using the following command:
pip3 install firebase-admin
However it always ends with an error saying "Error building wheel for cryptography"
Here is the full error message:
/tmp/pip-build-env-k7qo7p54/overlay/lib/python3.7/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning: Installing 'cryptography.hazmat.bindings._rust' as data is deprecated, please list it in packages.
!!
############################
# Package would be ignored #
############################
Python recognizes 'cryptography.hazmat.bindings._rust' as an importable package,
but it is not listed in the `packages` configuration of setuptools.
'cryptography.hazmat.bindings._rust' has been automatically added to the distribution only
because it may contain data files, but this behavior is likely to change
in future versions of setuptools (and therefore is considered deprecated).
Please make sure that 'cryptography.hazmat.bindings._rust' is included as a package by using
the `packages` configuration field or the proper discovery methods
(for example by using `find_namespace_packages(...)`/`find_namespace:`
instead of `find_packages(...)`/`find:`).
You can read more about "package discovery" and "data files" on setuptools
documentation page.
!!
check.warn(importable)
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation/ for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq/
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation/#rust
Python: 3.7.3
platform: Linux-5.10.103-v7+-armv7l-with-debian-10.13
pip: n/a
setuptools: 67.0.0
setuptools_rust: 1.5.2
rustc: n/a
=============================DEBUG ASSISTANCE=============================
error: can't find Rust compiler
If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
To update pip, run:
pip install --upgrade pip
and then retry package installation.
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
This package requires Rust >=1.48.0.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects
I have tried different commands like:
pip3 install firebase-admin
or
python -m pip install firebase-admin
I have upgraded pip and tried again, but still it didn't work
I faced a similar problem long time ago and solved by installing openssl. Tried it this time, it didn't work
Also tried installing rust compiler and using it but it didn't work
I am using Raspbian OS Buster on my Raspberry Pi 3
I have tried fresh installs of the OS
Still the same problem occurs

Installation error of scikit-image in python-3.11.0

Getting errors when installing scikit-image with python-3.11.0.
The package is simply installed via pip install scikit-image or python -m pip install -U scikit-image.
The error messages showed that the problem occur on the wheel building process, and therefore hinder the scikit-image installation. How could I fix this problem?
Error messages:
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/
INFO: CCompilerOpt.cache_flush[857] : write cache to path -> C:\Users\admin\AppData\Local\Temp\pip-install-z_bg8g6d\scikit-image_ae4333805d744761b97e8cd984f9e2c1\build\temp.win-amd64-3.11\Release\ccompiler_opt_cache_ext.py
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for scikit-image
Failed to build scikit-image
ERROR: Could not build wheels for scikit-image, which is required to install pyproject.toml-based projects
Environment:
affine==2.3.1
attrs==22.1.0
beautifulsoup4==4.11.1
certifi==2022.9.24
charset-normalizer==2.1.1
click==8.1.3
click-plugins==1.1.1
cligj==0.7.2
colorama==0.4.6
contourpy==1.0.6
cycler==0.11.0
docopt==0.6.2
Fiona # file:///C:/Users/admin/pipwin/Fiona-1.8.21-cp311-cp311-win_amd64.whl
fonttools==4.38.0
GDAL # file:///C:/Users/admin/pipwin/GDAL-3.4.3-cp311-cp311-win_amd64.whl
geopandas==0.12.1
idna==3.4
Js2Py==0.74
kiwisolver==1.4.4
matplotlib==3.6.2
munch==2.5.0
numpy==1.23.4
opencv-contrib-python==4.6.0.66
packaging==21.3
pandas==1.5.1
Pillow==9.3.0
pipwin==0.5.2
pyjsparser==2.7.1
pyparsing==3.0.9
PyPrind==2.11.3
pyproj==3.4.0
pySmartDL==1.3.4
python-dateutil==2.8.2
pytz==2022.6
pytz-deprecation-shim==0.1.0.post0
rasterio==1.3.3
requests==2.28.1
rioxarray==0.12.4
Shapely==1.8.5.post1
six==1.16.0
snuggs==1.4.7
soupsieve==2.3.2.post1
tzdata==2022.6
tzlocal==4.2
urllib3==1.26.12
xarray==2022.11.0
Two approaches were suggested:
Downgrades to an older python version:
Nathan answer
Install Visual Studio C++ compiler, as mentioned in: https://wiki.python.org/moin/WindowsCompilers
However, I would like to stay on current python version, and I'm getting stuck in the second approach.
In my case, this problem was solved via installing a wheel file from:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-image
In my case, I download the cp311 windows amd64 version.
Then, install the .whl file to the virtual environment
(env) D:\env>python -m pip install D:\Download\scikit_image-0.19.3-cp311-cp311-win_amd64.whl
Finally, the scikit-image was successfully installed.

Issue installing python bcrypt in Cygwin

I'm trying to install paramiko in Cygwin and one of the build dependencies is bcrypt.
I have rustc installed and I believe all of the supporting build libraries.
Pip is also updated to the latest.
$ pip --version
pip 22.2.2 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
I use the following pip command:
pip install bcrypt
And I get the following error output:
error: failed to run custom build command for `pyo3-build-config v0.15.2`
Caused by:
process didn't exit successfully: `C:\Cygwin64\tmp\pip-install-19d9dusl\bcrypt_117761e212a240d8804ceae0beeb39c1\src\_bcrypt\target\release\build\pyo3-build-config-2ef06b5f5d02e46b\build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-env-changed=PYO3_CONFIG_FILE
cargo:rerun-if-env-changed=PYO3_NO_PYTHON
cargo:rerun-if-env-changed=PYO3_PYTHON
--- stderr
error: failed to run the Python interpreter at /usr/bin/python.exe: The system cannot find the path specified. (os error 3)
warning: build failed, waiting for other jobs to finish...
cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src/_bcrypt/Cargo.toml --release -v --features pyo3/abi3-py36 pyo3/extension-module -- --crate-type cdylib
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install bcrypt:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Ensure you have a recent Rust toolchain installed. bcrypt requires
rustc >= 1.56.0.
Python: 3.8.12
platform: CYGWIN_NT-10.0-19044-3.3.5-341.x86_64-x86_64-64bit-WindowsPE
pip: n/a
setuptools: 65.3.0
setuptools_rust: 1.5.1
rustc: 1.63.0 (4b91a6ea7 2022-08-08)
=============================DEBUG ASSISTANCE=============================
error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path src/_bcrypt/Cargo.toml --release -v --features 'pyo3/abi3-py36 pyo3/extension-module' -- --crate-type cdylib` failed with code 101
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for bcrypt Failed to build bcrypt ERROR: Could not build wheels for bcrypt, which is required to install pyproject.toml-based projects
I check my python installation (python.exe) and it is installed at /usr/bin/python.exe.
$ ls /usr/bin/python*
/usr/bin/python.exe /usr/bin/python2.7.exe /usr/bin/python3.8-config
/usr/bin/python2-config /usr/bin/python3 /usr/bin/python3.8.exe
/usr/bin/python2.7-config /usr/bin/python3-config
So I am confused.....what is the issue? Why can't it find my python interpreter? Why is bcrypt not building and installing?
I'm guessing that Cygwin causes some compatibility issues here.
It looks like Cygwin has a package for this purpose, likely to avoid these issues:
https://cygwin.com/packages/summary/python36-bcrypt.html

While I am installing cryptography in django project using pycharm, I got the error. Failed building wheel for cryptography

While I am installing cryptography got the following error.
Failed building wheel for cryptography
Running setup.py clean for cryptography
Failed to build cryptography
Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
i was have same problem
my config was : python==3.7 django==2.2 pip==19.0.3
and its not from pycharm
its from pip
just upgrade pip to 21.0.1
Update:
some error code:
running build_rust
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation.html for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq.html
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation.html#rust
5) If you are experiencing issues with Rust for *this release only* you may
set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
=============================DEBUG ASSISTANCE=============================
error: Can not find Rust compiler
----------------------------------------
Running setup.py clean for cryptography
Failed to build cryptography
Failed building wheel for cryptography
Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

Categories