Can't Install xmlsec for Mac - django

I'm new to django. i am tring to implement python3-saml which requires Xmlsec. i am trying to install it Using "pip install xmlsec" on my virtal environment. but throwing this error.
Collecting xmlsec
Using cached xmlsec-1.3.12.tar.gz (64 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: lxml>=3.8 in
/opt/anaconda3/envs/conda_saml_env/lib/python3.10/site-packages (from xmlsec)
(4.8.0)
Building wheels for collected packages: xmlsec
Building wheel for xmlsec (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for xmlsec (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
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.macosx-10.9-x86_64-3.10
creating build/lib.macosx-10.9-x86_64-3.10/xmlsec
copying src/xmlsec/py.typed -> build/lib.macosx-10.9-x86_64-3.10/xmlsec
copying src/xmlsec/tree.pyi -> build/lib.macosx-10.9-x86_64-3.10/xmlsec
copying src/xmlsec/__init__.pyi -> build/lib.macosx-10.9-x86_64-3.10/xmlsec
copying src/xmlsec/constants.pyi -> build/lib.macosx-10.9-x86_64-3.10/xmlsec
copying src/xmlsec/template.pyi -> build/lib.macosx-10.9-x86_64-3.10/xmlsec
running build_ext
error: xmlsec1 is not installed or not in path.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with
pip.
ERROR: Failed building wheel for xmlsec
Failed to build xmlsec
ERROR: Could not build wheels for xmlsec, which is required to install
pyproject.toml-based projects
I tried the following
brew install libxml2 libxmlsec1 pkg-config
Output for above command is
Warning: libxml2 2.9.12 is already installed and up-to-date.
To reinstall 2.9.12, run:
brew reinstall libxml2
Warning: libxmlsec1 1.2.33 is already installed and up-to-date.
To reinstall 1.2.33, run:
brew reinstall libxmlsec1
Warning: pkg-config 0.29.2_3 is already installed and up-to-date.
To reinstall 0.29.2_3, run:
brew reinstall pkg-config
I got the same issue when i tried on Linux OS. Then i was able to solve this by running this command
sudo apt-get install libxmlsec1-dev
But i'm not able to run this command on my Mac. Is there anything i'm missing.

Use these Commands :
xcode-select --install
brew upgrade
brew install libxml2 libxmlsec1
pip install xmlsec

Related

AWS CodeBuild: ERROR: Could not build wheels for cmake, ninja

Running command pip install --no-binary ':all:' ddtrace cause i need to install arm64 version (cause default pkg uses binary code). On local system i got it installed correctly, but on AWS i got an error:
Failed to build cmake ninja
ERROR: Could not build wheels for cmake, ninja which use PEP 517 and cannot be installed directly
Python version - 3.9.6
PIP version - 21.1.3

psycopg2-binary installation into a virtual environment fails when trying to compile source code

I am trying to install psycopg2-binary into my Django project. I am using a virtual environment and the command I'm running is
pip install psycopg2-binary
However, I'm getting a massive error message, the gist of it is this:
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
But, hey, I'm installing exactly 'psycopg2-binary'
Why am I getting all this mess?
Pip cannot find you processor+OS at https://pypi.org/project/psycopg2-binary/2.9.2/#files so it tried to install from sources (the last file at the page) and failed.
Compiling from sources is currently the only way. If you can donate some spare processor cycles to the Psycopg2 authors they perhaps could start compiling and publishing wheels for OSX on M1.

python pip install error language_check

When I am trying to install sudo pip install language_check
I got this error:
Collecting language_check
Downloading language-check-1.0.tar.gz
Complete output from command python setup.py egg_info: zip_safe flag not set; analyzing archive contents...
Installed /tmp/pip-build-_cYgOq/language-check/.eggs/3to2-1.1.1-py2.7.‌​
egg error in language-check setup command: package_data must be a dictionary
mapping package names to lists of wildcard patterns
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-_cYgOq/language-check/
It's a bug in language-check. They fixed it at 23 March but didn't include in any release yet (release 1.0 was from 21 March).
Download the sources from Github and install with
python setup.py install
I believe that if you install the latest version of Python, python3.6.2 it should work.
git clone -b patch-1 https://github.com/SpartorA/language-check.git
python setup.py install
Above will work
I was able to successfully install language-check in my Python 3.7 environment on MacOS as follows:
Check Java installation :
for language-check, Java 8 is expected
For MacOS: Follow these steps : https://stackoverflow.com/a/24657630
Install language-check
pip install language-check, won't directly work, you would have to:
Install from a forked & fixed repo for language-check
pip install git+https://github.com/MCFreddie777/language-check.git

Raspbian Jessi apt-get install python2.7-minimal configure error

I have installed Raspbian Jessi with Seafile, which is dependent on python2.7, installed as part of this process by myself. It was working fine for weeks when it was in headless mode. After running manually via ssh
sudo apt-get update && sudo apt-get upgrade
the update process fails with a configuration error of python2.7-minimal. the output was:
sudo apt-get install python2.7 python2.7-minimal
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libpython-stdlib
Use 'apt-get autoremove' to remove it.
Suggested packages:
python2.7-doc binfmt-support
The following NEW packages will be installed:
python2.7 python2.7-minimal
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/1,402 kB of archives.
After this operation, 3,595 kB of additional disk space will be used.
y
Selecting previously unselected package python2.7-minimal.
(Reading database ... 107629 files and directories currently installed.)
Preparing to unpack .../python2.7-minimal_2.7.9-2+deb8u1_armhf.deb ...
Unpacking python2.7-minimal (2.7.9-2+deb8u1) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.9-2+deb8u1_armhf.deb ...
Unpacking python2.7 (2.7.9-2+deb8u1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Setting up python2.7-minimal (2.7.9-2+deb8u1) ...
Sorry: TypeError: compile() expected string without null bytesdpkg: error processing package python2.7-minimal (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python2.7:
python2.7 depends on python2.7-minimal (= 2.7.9-2+deb8u1); however:
Package python2.7-minimal is not configured yet.
dpkg: error processing package python2.7 (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python2.7-minimal
python2.7
E: Sub-process /usr/bin/dpkg returned an error code (1)
I have tried several combinations of apt-get remove/purge, dpkg reconfigure etc but the error is persistent.
Another thing:
apt-cache policy python2.7-minimal python2.7
python2.7-minimal:
Installed: 2.7.9-2+deb8u1
Candidate: 2.7.9-2+deb8u1
Version table:
*** 2.7.9-2+deb8u1 0
500 http://mirrordirector.raspbian.org/raspbian/ jessie/main armhf Packages
100 /var/lib/dpkg/status
python2.7:
Installed: 2.7.9-2+deb8u1
Candidate: 2.7.9-2+deb8u1
Version table:
*** 2.7.9-2+deb8u1 0
500 http://mirrordirector.raspbian.org/raspbian/ jessie/main armhf Packages
100 /var/lib/dpkg/status
I am not a beginner but also not an expert with Linux in general. Tell me if you need any further information to answer this question. Please help because I am tired of fighting stuff like this.
According to this post on ServerFault and this blog, it seems likely that there is something wrong with your local files (corruption, mis-configuration, etc). You said that you tried purging the packages, but since I'm not sure exactly what you tried, I would suggest purging all python packages with sudo apt purge python*, and then reinstalling them as necessary.
It is worth noting for anybody not aware that apt purge will completely uninstall a package, including configuration files. So don't do this unless you understand the risk.

"error: command 'x86_64-linux-gnu-gcc' failed with exit status 1" in virtualenv

Environment: Linux Mint 17 Cinnamon.
This error is displayed:
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
when attempting the following in a virtualenv:
pip install lxml
pip install pillow
pip install pycrypto
pip install pymongo (fails but still shows in pip freeze)
There are several solutions here that recommend installing python2.7-dev:
Installing Pillow error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Installing lxml in virtualenv via pip install error: command 'x86_64-linux-gnu-gcc' failed
Pillow installation error: command 'gcc' failed with exit status 1
fatal error: Python.h: No such file or directory
I am confused by this recommendation however because it is my understanding that using something like:
sudo apt-get install python2.7-dev
would add this to the main *system* instance of Python, rather that the one in virtualenv. (see - https://unix.stackexchange.com/a/56392/92486)
Can I add python2.7-dev just to the virtualenv version of Python?
Most of the time these are dependency-issues.
Following the stack-trace of the gcc compiler one can see the missing files. Sometimes installing the Python development packages is not enough.
For example:
I tried to do pip install requests[security] in my virtualenv foo. This is the result that the pip-installer gave me.
Failed building wheel for cryptography
Running setup.py bdist_wheel for cffi
Stored in directory: /root/.cache/pip/wheels/99/e7/9a/68b1c8ca6f6f92b5feebd4d9434f50712b84f6a66d1285ea21
Successfully built cffi
Failed to build cryptography
Installing collected packages: cffi, cryptography, pyOpenSSL, ndg-httpsclient, requests
Running setup.py install for cryptography
Complete output from command /opt/foo/django-cms-virtualenv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-eZaLAG/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-BwgYTp-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/foo/django-cms-virtualenv/include/site/python2.7/cryptography:
running install
running build
running build_py
running egg_info
writing requirements to src/cryptography.egg-info/requires.txt
writing src/cryptography.egg-info/PKG-INFO
writing top-level names to src/cryptography.egg-info/top_level.txt
writing dependency_links to src/cryptography.egg-info/dependency_links.txt
writing entry points to src/cryptography.egg-info/entry_points.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
warning: no previously-included files matching '*' found under directory 'vectors'
writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
running build_ext
building '_Cryptography_cffi_a269d620xd5c405b7' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.c -o build/temp.linux-x86_64-2.7/src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.o
src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.c:217:25: fatal error: openssl/aes.h: Datei oder Verzeichnis nicht gefunden
#include <openssl/aes.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
The important part is the: #include <openssl/aes.h>
The compiler makes pretty clear that it is demanding this file - but it is not there in the filesystem.
Knowing that, the only thing left to do is: install the needed libraries!
Find out which package is needed for your distribution:
e.g. for Ubuntu you can go to The Ubuntu Package Search Site and enter the missing file you are looking for. In this case "aes.h"
Install the needed packages using your distributions package management tool:
e.g. for Ubuntu:
aptitude install libssl-dev
Retry with pip in your virtualenv:
pip install requests[security]
I installed python2.7-dev via Synaptic Package Manager in Linux Mint 17.
I could then accomplish the following in virtualenv:
pip install pillow
pip install pycrypto
And then I installed libxml2-dev and libxslt1-dev via Synaptic and could accomplish the following:
pip install lxml
I also did this so that the pymongo install didn't have any errors:
pip uninstall pymongo
pip install pymongo # i defined the version i needed ie pip install pymongo==2.6.2
I'm still confused how this fixes the problem, because I thought virtualenv was an isolated environment. Any clarification about this appreciated.
Work for me :
Just install python2.7-dev first
sudo apt-get install python2.7-dev
In Ubuntu 16.04.1 this worked for me:
sudo apt-get install libxml2-dev libxslt1-dev python-dev
For me the installation of lxml was failing on compilation. I followed the instructions for installation of lxml and reduced the compiler optimizations:
sudo CFLAGS="-O0" pip install lxml
After doing this, the compile of lxml succeeded.
This can be a problem in the pip. To solve, try:
sudo apt-get remove python-pip
To install pip, securely download get-pip.py.
https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
The cffi library needs libffi-dev:
sudo apt-get install libffi libffi-dev
Easiest way is:
sudo apt-get build-dep python-imaging
and then
pip install pillow
This works for me, 12.04, python2.7.6 for package lxml
sudo pip install libxml2 libxml2-dev libxslt1-dev
sudo pip install lxml