Having trouble installing lxml on Python 2.7 - python

I ran the command line to install lxml but then it gave me this error:
C:\Users\username\AppData\Local\Temp\easy_install-y6y867l_\lxml-3.5.0\temp\xmlXPathInit67jlgy6a.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
Error: Setup script exited with error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
I also have MVC intstalled already. Any help would be greatly appreciated!

Just install Anaconda, It contains many libraries, including lxml.

Run this
set STATICBUILD=true && pip install lxml
And these dependencies will be downloaded and build together by the installer:
libxslt
iconv
zlib
libxml2
Or you can download the .whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml and install it by
pip install lxml‑3.5.0‑cp27‑none‑win32.whl
If it doesn't work,check this.
lxml-install-on-windows-7-using-pip-and-python-2-7
Hope this helps.

Related

unable to install psycopg2 on python3

I'm trying to install psycopg2 module on python3 on a CentOS Linux 7 and getting the following error
In file included from psycopg/psycopgmodule.c:28:0:
./psycopg/psycopg.h:36:22: fatal error: libpq-fe.h: No such file or directory
#include <libpq-fe.h>
^
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command 'gcc' failed with exit status 1
Any ideas as to what the solution would be?
Thanks

Create a Distributed Package that uses lxml

I've created a python package that uses lxml.
In setup.py I have defined:
packages=find_packages(), # Required
python_requires='>=3.8, <4',
install_requires=[
'typer[all]',
'packaging',
'lxml'
]
Tests, packaging and deployments work just fine.
However, after uploading the package to my company's PyPi repository, I'm trying to install the package with:
pip install -i <mypypirepo> <mypackage>
I get the a long error including:
fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 2
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python39\python.exe'
While trying to install manually the lxml I get the same exact error.
I found solutions on stackoverflow that talk about manually downloading a compatible wheel version of lxml and then installing it with pip.
However, the lxml is a part of the package that should be easily installed by the end-user.
Is there any way to solve the issue without forcing the user to manually install lxml?
Note: This issue only started happening after upgrading python from 3.8 to 3.9.
As of this writing 2020-10-12 there is no lxml wheel for python 3.9 on PyPI.
If using windows like I do there are unofficial wheels here:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

pip install mysqlclient with Python 3.8 not working [duplicate]

This question already has answers here:
pip install mysqlclient returns "fatal error C1083: Cannot open file: 'mysql.h': No such file or directory
(18 answers)
Closed 2 years ago.
I have a django project with Python 3.8 and I am trying to install mysqlclient library through: pip install mysqlclient command. I got this error:
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
I tried installation by using wheel file from where ( I tried every wheel from this site ) but I got the error: *...is not a supported wheel on this platform.*
I tried to install it from the source but when I run this command python setup.py install I got the same error:
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
I tried this command pip install --only-binary :all: mysqlclient and I got the error:
Could not find a version that satisfies the requirement mysqlclient (from versions: )
No matching distribution found for mysqlclient
Please let me know if you have some suggestions. Thank you!
Cannot open include file: 'mysql.h': No such file or directory
You are missing the mysql library that is needed as a requirement when compiling mysqlclient from source.
is not a supported wheel on this platform
I bet you have a 32-bit python installed. All the whl files for mysqlclient on pypi are for amd64, which would explain why there is no supported version for your setup. You can check by:
Check your installation path, if it contains something like python38-32, then you have the 32 bit version for sure
Type python in the cmd and check the first line. For me (64 bit python), it contains the string MSC v.1915 64 bit (AMD64)
What you can do about it is uninstall the 32 bit version and install the 64 bit one, after all mysqlclient will not be the last tool that does not have 32 bit whl files available on pypi OR you could download the 32 bit whl file for mysqlclient from here

Can't install BGSlibrary(pybgs) library from pypi for python using visual studio 2017

I have been trying for 3 days to install this library. It uses CMake and i can't understand how to add OpenCV path within visual studio. I have tried a lot of things like:
1.use CMake-GUI to generate .sln file then build there is also an error.
2.try to add through cmd with CMake but there I face another error.
I believe there is a simple way of directly doing it through visual studio which I am unfamiliar of and can't seem to find it. If someone is kind enough to tell me in simple way how to install library using visual studio python 3.6.
Here is the error I get in VS 2017 after I try to install pybgs library through pip install pybgs
ERROR: Failed building wheel for pybgs
Failed to build pybgs
Installing collected packages: pybgs
Running setup.py install for pybgs: started
Running setup.py install for pybgs: finished with status 'error'
ERROR: Command errored out with exit status 1:
CMake Error at CMakeLists.txt:113 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake

Error installing Willie irc bot for Python

Trying to install this Python IRC bot called Willie. This is what happens when I run setup.py:
C:\Python34\python.exe "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.1\helpers\pycharm\pycharm_setup_runner.py" C:\Users\Quibbles\Documents\willie-5.3.0\setup.py
Testing started at 1:35 PM ...
running pycharm_test
Searching for pygeoip
Best match: pygeoip 0.3.2
Processing pygeoip-0.3.2-py3.4.egg
Using c:\users\quibbles\documents\willie-5.3.0\.eggs\pygeoip-0.3.2-py3.4.egg
Searching for pyenchant
Best match: pyenchant 1.6.6
Processing pyenchant-1.6.6-py3.4-win32.egg
Using c:\users\quibbles\documents\willie-5.3.0\.eggs\pyenchant-1.6.6-py3.4-win32.egg
Searching for praw
Best match: praw 2.1.21
Processing praw-2.1.21-py3.4.egg
Using c:\users\quibbles\documents\willie-5.3.0\.eggs\praw-2.1.21-py3.4.egg
Searching for lxml
Reading https://pypi.python.org/simple/lxml/
Best match: lxml 3.4.4
Downloading https://pypi.python.org/packages/source/l/lxml/lxml-3.4.4.tar.gz#md5=a9a65972afc173ec7a39c585f4eea69c
Processing lxml-3.4.4.tar.gz
Writing C:\Users\Quibbles\AppData\Local\Temp\easy_install-p_x9naya\lxml-3.4.4\setup.cfg
Running lxml-3.4.4\setup.py -q bdist_egg --dist-dir C:\Users\Quibbles\AppData\Local\Temp\easy_install-p_x9naya\lxml-3.4.4\egg-dist-tmp-0expfysa
Building lxml version 3.4.4.
Building without Cython.
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 **
Using build configuration of libxslt
C:\Python34\lib\distutils\dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
cl : Command line warning D9025 : overriding '/W3' with '/w'
lxml.etree.c
C:\Users\Quibbles\AppData\Local\Temp\easy_install-p_x9naya\lxml-3.4.4\src\lxml\includes\etree_defs.h(14) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
error: Setup script exited with error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2
Process finished with exit code 1
What am I doing wrong? I downloaded the source code from https://github.com/embolalia/willie/releases/tag/v5.3.0 and tried running setup.py in PyCharm.
It should be fairly obvious by the error messages:
** make sure the development packages of libxml2 and libxslt are installed **
You need to have the dev libxml2 and libxslt installed. It appears either you have the wrong versions perhaps, or don't have them installed properly.
I'L'I's answer gives you a hint of where to start searching next, but isn't a useful answer.
After several attempts on my own, I found that to get the lxml library installed, I needed to do the following:
First, download the lxml library from http://www.lfd.uci.edu/~gohlke/pythonlibs/
This is necessary because the PiPy archives (https://pypi.python.org/pypi/lxml/3.4.4) are way out of date, only giving you the option to install for Python 3.2 for the 3+ series, which of course is useless if you're on 3.4. There's also issues if you're using 64-bit. They may be sufficient if you're using 2.7, though.
Then use the instructions here: How do I install a Python package with a .whl file? to install the .whl file.
However that only fixes half the problem. The willie package appears to be broken in other ways (on Windows) because of trying to reference a unix-like /tmp directory (absolute path) instead of the proper Windows Temp directory.
This issue describes the problem, though no fix has yet been made: https://github.com/embolalia/willie/issues/811
It indicates that it's a Windows-specific bug in the installer. To work around that, download the .tar.gz from https://pypi.python.org/pypi/willie/5.3.0
Unpack it. Go to the willie-5.3.0\willie.egg-info directory, and edit the SOURCES.txt file. The fifth line is /tmp/tmpeAhjCF/willie. Delete that line.
Repackage the directory into a .tar.gz archive. Install via pip install .\willie-5.3.0.tar.gz.
Now it's installed, and you're ready for the next round of problems of actually getting it to run on Windows. Since I haven't actually succeeded in doing that yet, that's as far as I can help for right now.

Categories

Resources