pymssql: Package installation failed in Mac OS - python

I tried installing with pipenv install pymssql and it failed
Then tried with pip install pymssql but import pymssql not working in Mac OS (Big Sur 11.5.2)
Also tried pip3 install pymssql==2.1.5 it gave error as
error: command '/usr/bin/clang' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for pymssql
Failed to build pymssql
ERROR: Could not build wheels for pymssql which use PEP 517 and cannot be installed directly

I resolved the issue by following below steps
brew install freetds
brew install unixodbc
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
brew install msodbcsql mssql-tools

Related

Failed building wheel for psycopg2 (Windows 11)

I am building a Django project, and as I was installing the psycopg2(using virtual env), I kept getting an error.
Versions:
Django==4.1.2
Python==3.11.0
PIP==22.3
OS==Win11
Code:
(env) PS C:\Users\keiko\Desktop\project> pip install psycopg2
Error:
ERROR: Failed building wheel for psycopg2
Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... error
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
I have already tried the solutions I found on the internet like:
Install psycopg2-binary instead.
Code: pip install psycopg2-binary
Error: Failed building wheel for psycopg2-binary
Upgrade the wheel and setup tools
Code:
pip install --upgrade wheel
pip install --upgrade setuptools
pip install psycopg2
Install it with python
Code: python -m pip install psycopg2
ERROR: Failed building wheel for psycopg2
Install the Microsoft C++ Build Tools
... but still none of these solutions helped me. I'm really hoping to install the package(psycopg2) on my project, I've been stuck with this error for so long and I can't really find any solution to this. I hope someone can help me with this.

pipx install eth-brownie error : Fatal error from pip prevented installation. Full pip output in file:

Hi I am trying to install Brownie but I seem to run into the below issue.
C:\Users\gmlad>pipx install eth-brownie
Fatal error from pip prevented installation. Full pip output in file:
C:\Users\gmlad\.local\pipx\logs\cmd_2021-12-03_16.35.47_pip_errors.log
pip failed to build packages:
bitarray
cytoolz
lru-dict
multidict
psutil
yarl
Some possibly relevant errors from pip install:
error: command 'cl.exe' failed: None
Error installing eth-brownie.
This is not the eth-brownie problem, but overall pipx issue.
I've got the same error after switching from Python 3.9 to 3.10 on Arch Linux.
This answer solved it, although it's for Windows) Try it out: https://stackoverflow.com/a/70080178/13389142

pip unable to Install svglib, libxml2 and libxslt

I'm hoping someone can help. I am trying to install svglib on my Raspberry Pi running Python 2.7.16
and pip version 18.1. When I try the following command:
sudo pip install svglib
I get the following errors:
Error: Please make sure the libxml2 and libxslt development packages are installed.
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-b0APrc/lxml/
So I tried to install libxml2 and libxslt using following commands:
sudo pip install libxml2
sudo pip install libxslt
But trying to install those throws the following error:
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/libxml2/
Does anyone know how this can be fixed please?
I managed to succesfully instead svglib on my windows computer running Python 3.9
This seems to work:
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev

ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

I get an error when pip builds wheels for the cryptography package.
Error:
LINK : fatal error LNK1181: cannot open input file 'libssl.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\link.exe' failed with exit status 1181
----------------------------------------
ERROR: Failed building wheel for cryptography
Running setup.py clean for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
I have already installed OpenSSL and set the environment variables as suggested in this post yet the problem persists. My setup details:
System - Windows 10
Python - 3.8
Pip - 19.3.1
In my case (windows 10 + conda) updating pip fixed the problem:
python -m pip install --upgrade pip
Setting cryptography to version 2.8 in requirements.txt fixed the issue.
TLDR;
Try using cryptography==3.1.1
Details:
This happened on Python 3.9.0 on Windows 10 PC.
I had the following in requirements.txt
cryptography==2.8
I removed the version and kept only cryptography in requirements.txt file like below
cryptography
Saved the requirements.txt and then I ran
pip install -r requirements.txt
It installed successfully.
Then I freeze the requirements.txt by running the following command
pip freeze > requirements.txt
Then the requirements.txt got updated with cryptography==3.1.1
Had also this issue. If you're using alpine, make sure that all dependencies for cryptography are installed.
In my case the cargo package was missing and causing the issue.
sudo apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo
https://cryptography.io/en/latest/installation.html#building-cryptography-on-linux
Ran into this issue, and the solution is actually in the message when pip attempts to install openssl before cryptography:
generating cffi module 'build/temp.linux-x86_64-3.7/_openssl.c'
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=============================
Simply running the pip update command appeared to work for me:
pip install -U pip
Which updated pip from version 18.0 to version 21.0.1
I faced this issue on macOS Monterey (version 12.2.1) Apple M1 Pro. I followed Cryptography installation documentation and it helped me resolve the issue.
brew install openssl#1.1 rust
env CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=1 LDFLAGS="$(brew --prefix openssl#1.1)/lib/libssl.a $(brew --prefix openssl#1.1)/lib/libcrypto.a" CFLAGS="-I$(brew --prefix openssl#1.1)/include" pip3 install cryptography
You can use the lastest version with
python3 -m pip install --no-use-pep517 cryptography
worked for me with ubuntu:18.04 on arm32v7
(instead as suggested by the error message install the full rust compiler and build-essentials, or upgrading pip (what had no effect on ubuntu:18.04 on my armbian))
pip install --upgrade pip
Try to upgrade pip of your environment working fine for me.
I got this error trying to install Scrapy with Python 3.8.1 on Windows 10, but its solved installing the last version of pip (19.3.1 in my case) and all works using pip in this way:
python -m pip install scrapy --user
I have faced same issue and tried to install openssl with mentioned step but still was not able to proceed for windows 10. Later I upgraded pip to latest version and tried again and it worked without any issue.
I would recommend to upgrade pip to latest version and give a try before proceeding for installing openssl
I had the same issue. pip3 version was 19.* after upgrade it works
sudo -H pip3 install --upgrade pip
You can try to install cryptography==3.1.1 package instead of cryptography 35 version.
pip install cryptography==3.1.1
If still you are facing challenges in cryptography package integration.
You can resolve that by the following steps.
python -m pip install --upgrade pip
sudo pip install -U pip setuptools
I had this problem and i just installed rust and problem fixed for me
You can install end version of cryptography after installing rust programming languege(dont try pip install rust, its not python package)
https://www.rust-lang.org/tools/install
Just updating pip
python -m pip install --upgrade pip
I did not install the latest version of Scrapy, then it worked for me. Instead of installing version 2.6.3, I installed 2.6.2:
pip install Scrapy==2.6.2
I use PyCharm 2022.2.3 (Professional Edition) on Windows.

How to install flask-mysqldb on Mac OSX?

I tried
sudo pip3 install flask-mysqldb
but got the following error:
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-3l4jec4_/mysqlclient/
The solution above works
conda install -c bioconda mysqlclient
Then run
pip install flask-mysqldb
Anaconda is a must have for python anyway.
First set your mysql path by giving the command
export PATH=$PATH:/usr/local/mysql/bin
Then, use below to install flask-mysqldb,
pip3 install flask-mysqldb
then use library 'flask_mysqldb' in python.
Just install it via pip install flask-mysqldb, it's python3 compatible.
If you have anaconda installed, you can try the following:
conda install -c bioconda mysqlclient
pip install flask-mysqldb
This should work.
After successfully install the flask-mysqldb, use it as:
from flaskext.mysql import MySQL

Categories

Resources