Can't install xmlsec using PIP command
Asked Answered
N

10

15

pip install xmlsec commands throws the below error.

ERROR: Command errored out with exit status 1:
   command: /home/xxx/PycharmProjects/saml_impl/saml_impl/venv/bin/python /home/sathia/PycharmProjects/saml_impl/saml_impl/venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpu_b5m5vz
       cwd: /tmp/pip-install-gblz98sr/xmlsec
  Complete output (14 lines):
  running bdist_wheel
  running build
  running build_py
  package init file 'src/xmlsec/__init__.py' not found (or not a regular file)
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/xmlsec
  copying src/xmlsec/py.typed -> build/lib.linux-x86_64-3.8/xmlsec
  copying src/xmlsec/template.pyi -> build/lib.linux-x86_64-3.8/xmlsec
  copying src/xmlsec/constants.pyi -> build/lib.linux-x86_64-3.8/xmlsec
  copying src/xmlsec/__init__.pyi -> build/lib.linux-x86_64-3.8/xmlsec
  copying src/xmlsec/tree.pyi -> build/lib.linux-x86_64-3.8/xmlsec
  running build_ext
  error: Unable to invoke pkg-config.
  ----------------------------------------
  ERROR: Failed building wheel for xmlsec
Failed to build xmlsec
ERROR: Could not build wheels for xmlsec which use PEP 517 and cannot be installed directly'

I don't know how to resolve this issue. I tried to install other xmlsec package too, nothing worked.

Nim answered 12/9, 2020 at 11:24 Comment(0)
N
23

Xmlsec listed here https://pypi.org/project/xmlsec/. The below command should install for download required native libraries.

sudo apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl
Nim answered 12/9, 2020 at 12:2 Comment(2)
For python 3.7 I also had to add this: apt-get install libpython3.7-dev response found hereStu
Similar for Python 3.8: apt-get install libpython3.8-devHypnoanalysis
P
13

Fast forward to 2023 and the issue happened w/me on macOS. It seems like we are Unable to (pip install xmlsec) since brew version 4.0.13. A variation of dpritchett's workaround plus johnnymetz's comment saved me, which consists on:

manually reverting to a copy of the last known good pre-1.3.0 xmlsec1 version (1.2.37) Formula:

  1. brew edit libxmlsec1; an editor opens up, full of the contents of the latest downloaded xmlsec formula
  2. paste in the contents of the last pre-1.3.0 brew formula and save it (vim: wq!)*
  3. brew unlink libxmlsec1
  4. Install that local formula: brew install /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/libxmlsec1.rb
  5. pip install xmlsec

* On my setup steps 1 & 2 were not necessary; I pasted here a variation of their answer on the same link

Penis answered 14/6, 2023 at 0:16 Comment(2)
Same issue for me on Homebrew 4.1.20, and i couldn't get the guides from the others to work, until i found your comment which saved me!.. i was missing to run brew unlink libxmlsec1 after updating the formula. And as you said, you combined both dpritchett and johnnymetz suggestions, which I should just have done.. But thanks, now I can continue!Statistician
From the 'answer on the same link', this comment one-liner solved it for me github.com/xmlsec/python-xmlsec/issues/…Resourceful
H
9

I had a similar issue with installing xmlsec. What did it for me was reinstalling the required native libraries listed here: https://pypi.org/project/xmlsec/

It was as simple as installing: brew install libxml2 libxmlsec1 pkg-config

Herman answered 8/1, 2021 at 18:25 Comment(0)
H
5
sudo apt-get install libxmlsec1-dev pkg-config

this will work on ubuntu / wsl ubuntu

Horatio answered 23/8, 2021 at 9:28 Comment(0)
M
2

This indicates that the wheels you are trying to install aren't supported by PEP 517. Try upgrading the following packages then trying to install again

pip install --upgrade pip setuptools wheel
Missive answered 12/9, 2020 at 11:34 Comment(2)
Try downgrading pip to 18.1 using pip install pip==18.1 and installing the libpython dev for your python version.Missive
solved, I have posted the solution. thanks for your helpNim
N
1

i had similar issue but instead of "pkg-config" error, i had error with "xmlsec1" so i used the command

sudo apt-get install libxmlsec1-dev pkg-config

as per Could not find xmlsec1 config. Are libxmlsec1-dev and pkg-config installed?

Norford answered 6/10, 2020 at 13:27 Comment(0)
P
1
yum install libxml2-devel xmlsec1-devel xmlsec1-openssl-devel libtool-ltdl-devel
Paugh answered 3/10, 2021 at 16:32 Comment(0)
N
1

Solution for my MacBook Air (M2, 2022) running macOS Monterey

xcode-select --install
brew upgrade
brew install libxml2 libxmlsec1
pip install xmlsec

!REBOOT!
Create virtual env with python 3.10 (probably 3.8/3.9 works too but didn't test)

python3.10 -m venv .venv
source .venv/bin/activate
pip install xmlsec
Nellynelms answered 10/10, 2022 at 13:42 Comment(0)
G
0

Use these commands if you are getting this error in mac this will work for sure.

xcode-select --install

brew upgrade

brew install libxml2 libxmlsec1

pip install xmlsec
Godman answered 23/3, 2022 at 16:33 Comment(0)
A
0

I was getting below error while installation of sentry

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

It's resolved by @sathiamoorthy above answer.

sudo apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl
Angloindian answered 25/7, 2022 at 13:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.