lxml library won't install in virtual environment - python-3.x

OS: Debian GNU/Linux v9
System: Python 3.4.2
Ran command: sudo apt-get install build-essential python3-dev python3-lxml python3-pip python3-setuptools python3-wheel python3-lxml libssl-dev libffi-dev
I can do the following: python3 then import lxml
And it works! :)
I make a virtual environment, pip3 install some stuff, and type pip3 list
Package Version
--------------- -------
asn1crypto 0.24.0
cffi 1.12.2
cryptography 2.6.1
pip 19.0.3
pycparser 2.19
python-dateutil 2.8.0
pytz 2018.9
setuptools 40.8.0
six 1.12.0
Then I type: pip3 install lxml and get this:
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInithmyjgqp8.c -o tmp/xmlXPathInithmyjgqp8.o
/tmp/xmlXPathInithmyjgqp8.c:1:26: fatal error: libxml/xpath.h: No such file or directory
#include "libxml/xpath.h"
^
compilation terminated.
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
So it seems lxml can install on system, but not in a virtual environment. What am I doing wrong, and why is this?

Related

How to delete all packages from my ubuntu terminal in windows 10?

I have all these packages and I would like to remove them (removing pip and apache-airflow is my priority)
alembic 1.8.1
anyio 3.6.2
apache-airflow 2.4.2
apache-airflow-providers-common-sql 1.2.0
apache-airflow-providers-ftp 3.1.0
apache-airflow-providers-http 4.0.0
apache-airflow-providers-imap 3.0.0
apache-airflow-providers-sqlite 3.2.1
apispec 3.3.2
argcomplete 2.0.0
attrs 22.1.0
Babel 2.11.0
blinker 1.4
cachelib 0.9.0
cattrs 22.2.0
certifi 2022.9.24
charset-normalizer 2.1.1
pendulum 2.1.2
pip 22.0.2
pluggy 1.0.0
prison 0.2.1
psutil 5.9.4
Pygments 2.13.0
PyGObject 3.42.1
PyJWT 2.3.0
pyparsing 2.4.7
pyrsistent 0.19.2
python-apt 2.3.0+ubuntu2.1
python-daemon 2.3.2
python-dateutil 2.8.2
python-nvd3 0.15.0
python-slugify 6.1.2
pytz 2022.6
pytzdata 2020.1
PyYAML 5.4.1
requests 2.28.1
requests-toolbelt 0.10.1
rfc3986 1.5.0
uc-micro-py 1.0.1
ufw 0.36.1
Download ubuntu console for windows 10 and install pip and apache airflow without creating an environment (my mistake)
I run pip freeze --user | xargs pip uninstall -y to remove all and I get this error:
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/shutil.py", line 815, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/local/bin/alembic' -> '/tmp/pip-uninstall- lj7qg0bv/alembic'
If you're sure you really need to uninstall packages installed under /usr/local/ use superuser privileges:
pip freeze --user | xargs sudo pip uninstall -y

Cannot install Scipy in FreeBSD 13 with Python 3.10

I am trying install scipy in FreeBSD 13. I have built python 3.10 on FreebSD 13 and managed to install pandas, matplotlib and numpy on a virtual environment which has python 3.10. However, when I try to install sklearn or scipy I get an error saying scipy could not be installed.
Here it is below for when doing pip install scipy. I get the same error more or less when trying to install sklearn.
ERROR: Failed building wheel for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy, which is required to install pyproject.toml-based projects
Command errored out with exit status 1: /home/schroter/.pymain/dataViz/bin/python3 /tmp/pip-standalone-pip-d3nnvp2f/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-xp_669rf/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.28.5' 'oldest-supported-numpy; python_version!='"'"'3.7'"'"' or platform_machine=='"'"'aarch64'"'"' or platform_system=='"'"'AIX'"'"' or platform_python_implementation == '"'"'PyPy'"'"'' 'numpy==1.14.6; python_version=='"'"'3.7'"'"' and platform_machine!='"'"'aarch64'"'"' and platform_system!='"'"'AIX'"'"' and platform_python_implementation != '"'"'PyPy'"'"'' 'scipy>=1.1.0' Check the logs for full command output.
My pip list is as below:
(dataViz) schroter#SCHROTER:~ % pip list
Package Version
---------------- -------
cycler 0.11.0
kiwisolver 1.1.0
matplotlib 3.4.3
numpy 1.21.4
pandas 1.3.4
Pillow 8.4.0
pip 21.3.1
pyparsing 3.0.6
python-dateutil 2.8.2
pytz 2021.3
semantic-version 2.8.5
setuptools 58.5.3
setuptools-rust 0.12.1
six 1.16.0
toml 0.10.2
wheel 0.37.0
Would anyone be able to help me in this regards please?
Thanks & Best Regards
Schroter
Reuse system package
# install system-wide version in site-packages
doas pkg install py38-scipy-1.8.0
# create a virtualenv with site-packages included
python -m venv --system-site-packages .venv
Drawback is you'll get all packages from site-packages, however you can tackle that by
doas pkg install py38-scipy-1.8.0
python -m venv .venv
YOUR_PYTHON_VERSION= SET IT HERE
ln -s $(python -c 'import lxml, os.path; print(os.path.dirname(lxml.__file__)') ./.venv/lib/$YOUR_PYTHON_VERSION/site-packages
borrowed from https://stackoverflow.com/a/13719417
Regular Installation (TODO)
Haven't figured out it yet, but maybe someone else will, so putting here 2 links which might be helpful
https://forums.freebsd.org/threads/python-scipy-with-python3-x-on-freebsd-11.59009/
https://reviews.freebsd.org/D23447
Have you tried to install scipy from freebsd ports? The freebsd ports contain patches to make the code compile on FreeBSD.

STDERR: ERROR: Could not find a version that satisfies the requirement Brlapi==0.7.0 ERROR: No matching distribution found for Brlapi==0.7.0

when running sls deploy, I'm getting this error. I tried checking my Ubuntu version and its package details. Everything seems to be fine.I have Ubuntu 20.04 and python 3.8.5 installed on my system.Can someone help me on this?
update apt and install brlapi
sudo apt update
sudo apt install python3-brlapi
run pip list to check if its installed
pip list
anti#Datakriya:~$ pip list
Package Version
---------------------- --------------------
apturl 0.5.2
attrs 19.3.0
Automat 0.8.0
awscli 1.19.15
bcrypt 3.1.7
blinker 1.4
boto3 1.17.2
botocore 1.20.15
Brlapi 0.7.0

ImportError after Successful Installing Packages in Conda Environment

I installed python-3.5 on Ubuntu 16.04.3 and planned to have python-3.6 as well with conda environment. For the conda enviornment with python-3.6, I named it as py36. However, though I installed package a package in (py36) environment, python complained that there was no such module. Why was python confused?
Below is the code I ran:
$conda create --name py36 python=3.6
$ source activate py36
(py36) xxx#Alienware:~/crawler$ conda install --name py36 -c anaconda cached-pro
(py36) xxx#Alienware:~/crawler$ conda list -n py36
# packages in environment at /home/xxx/anaconda3/envs/py36:
#
ca-certificates 2018.03.07 0
cached-property 1.5.1 <pip>
cached-property 1.5.1 py36_0 anaconda
certifi 2018.11.29 py36_0
libedit 3.1.20170329 h6b74fdf_2
libffi 3.2.1 hd88cf55_4
libgcc-ng 8.2.0 hdf63c60_1
libstdcxx-ng 8.2.0 hdf63c60_1
ncurses 6.1 he6710b0_1
openssl 1.1.1a h7b6447c_0
pip 18.1 py36_0
python 3.6.7 h0371630_0
readline 7.0 h7b6447c_5
scrapy 1.5.1 py36_0
setuptools 40.6.3 py36_0
sqlite 3.26.0 h7b6447c_0
tk 8.6.8 hbc83047_0
wheel 0.32.3 py36_0
xz 5.2.4 h14c3975_4
zlib 1.2.11 h7b6447c_3
(py36) xxx#Alienware:~/crawler$ scrapy crawl transcripts --logfile output.log
Yet I got the following output. But I just checked that cached_property was installed in my environment. What did I miss here?
ImportError: No module named 'cached_property'

Installing libxml2 and libxslt in python 3.6

I am having some problems installing lxml 3.6.4 in python 3.6 64bit using Pycharm and PIP.
pip install lxml==3.6.4
ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
** make sure the development packages of libxml2 and libxslt are installed **
When installing libxml
pip install libxml2-dev
I get the following error:
Collecting libxml2-dev
Could not find a version that satisfies the requirement libxml2-dev (from versions: )
No matching distribution found for libxml2-dev
When running libxslt
pip install libxslt
I get this error
Collecting libxslt
Could not find a version that satisfies the requirement libxslt (from versions: )
No matching distribution found for libxslt
The ultimate goal is to install pyiso on Pycharm.
My specs - Windows 7 - 64
Python 3.6
On Linux, with the typo corrected, #pguardiario's comment above fixed this for me.
sudo apt-get install libxml2-dev libxslt-dev
Then:
conda install lxml
Or:
pip install lxml

Resources