Unable to install libxml2 and lxml on pypy - python 2.7 - python

I know there were many, many questions asked about installing lxml but I could not find anything that solves my problem. If I missed an answer, please refer me to it.
I'll try to give you as much as information as I can think of.
So I'm trying to install lxml .
I run on windows 10, platform.uname() output is:
import platform
platform.uname()
('Windows', 'DESKTOP-6AH7RBF', '10', '10.0.15063', 'AMD64', 'Intel64 Family 6 Model 142 Stepping 9, GenuineIntel')
And my interpreter is pypy:
import sys
sys.version
'2.7.13 (14f400f0498e, Mar 31 2017, 19:58:36)\n[PyPy 5.7.1 with MSC v.1500 32 bit]'
setuptools version is 36.2.7
When ran the pip command, got this output:
C:\WINDOWS\system32>c:\pypy27\bin\pip.exe install c:\Users\Jack\Downloads\lxml-cffi.zip
Processing c:\users\jack\downloads\lxml-cffi.zip
Complete output from command python setup.py egg_info:
Building lxml version 3.4.0.
Building without Cython.
ERROR: 'xslt-config' is not recognized as an internal or external command,
operable program or batch file.
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt _cffi__gf1d3c271xb1c86544.c
src\lxml-cffi\includes\__pycache__\_cffi__gf1d3c271xb1c86544.c(53) : fatal error C1083: Cannot open include file: 'libxml/chvalid.h': No such file or directory
Traceback (most recent call last):
File "<module>", line 1, in <module>
File "c:\users\jack\appdata\local\temp\pip-twwxp3-build\setup.py", line 232, in <module>
**setup_extra_options()
File "c:\users\jack\appdata\local\temp\pip-twwxp3-build\setup.py", line 145, in setup_extra_options
STATIC_CFLAGS, STATIC_BINARIES)
File "setupinfo.py", line 167, in ext_modules
import lxml.etree
File "src\lxml\../lxml-cffi\etree.py", line 8, in <module>
from .apihelpers import _assertValidNode, _assertValidDoc
File "src\lxml\../lxml-cffi\apihelpers.py", line 3, in <module>
from .includes.etree_defs import _isString, _getNs, _isElement
File "src\lxml\includes\../../lxml-cffi/includes\etree_defs.py", line 1, in <module>
from . import tree
File "src\lxml\includes\../../lxml-cffi/includes\tree.py", line 498, in <module>
libraries=['xml2'])
File "C:\pypy27\lib_pypy\cffi\api.py", line 438, in verify
lib = self.verifier.load_library()
File "C:\pypy27\lib_pypy\cffi\verifier.py", line 114, in load_library
self._compile_module()
File "C:\pypy27\lib_pypy\cffi\verifier.py", line 211, in _compile_module
outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
File "C:\pypy27\lib_pypy\cffi\ffiplatform.py", line 20, in compile
outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
File "C:\pypy27\lib_pypy\cffi\ffiplatform.py", line 56, in _build
raise VerificationError('%s: %s' % (e.__class__.__name__, e))
VerificationError: CompileError: command 'C:\\Users\\Jack\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\jack\appdata\local\temp\pip-twwxp3-build\
As the error and the lxml docs say, I need to install first libxml2 and libxslt . So I entered the download page of libxml2 and downloaded the latest version - 2.9.4
And ran pip install on the downloaded tar.gz:
C:\WINDOWS\system32>c:\pypy27\bin\pip.exe install c:\Users\Jack\Downloads\libxml2-2.9.4.tar.gz
Processing c:\users\jack\downloads\libxml2-2.9.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<module>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'c:\\users\\jack\\appdata\\local\\temp\\pip-4ww1fs-build\\setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\jack\appdata\local\temp\pip-4ww1fs-build\
Did the same for versions 2.9.3 and 2.9.2 and got similar results.
What am I missing? How can I fix it so I can install lxml?
Thanks in advance for all of those involved!

Related

Error installing pgi package in python 3.8

I am new to programming and for a school project, I need to install pgi 0.0.11.2 package from PyPi. Whenever I try to install the package I get the following error:
Collecting pgi
Using cached pgi-0.0.11.2.tar.gz (239 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\user\AppData\Local\Temp\pip-install-5ymvp6rm\pgi_e8fc2c7d05e54b1083386e9ca52df18f\setup.py", line 18, in <module>
import pgi
File "C:\Users\user\AppData\Local\Temp\pip-install-5ymvp6rm\pgi_e8fc2c7d05e54b1083386e9ca52df18f\pgi\__init__.py", line 10, in <module>
from .importer import require_version, get_required_version
File "C:\Users\user\AppData\Local\Temp\pip-install-5ymvp6rm\pgi_e8fc2c7d05e54b1083386e9ca52df18f\pgi\importer.py", line 15, in <module>
from .clib.gir import GIRepository
File "C:\Users\user\AppData\Local\Temp\pip-install-5ymvp6rm\pgi_e8fc2c7d05e54b1083386e9ca52df18f\pgi\clib\gir\__init__.py", line 8, in <module>
from .giargument import GIArgument
File "C:\Users\user\AppData\Local\Temp\pip-install-5ymvp6rm\pgi_e8fc2c7d05e54b1083386e9ca52df18f\pgi\clib\gir\giargument.py", line 9, in <module>
from ..glib import gboolean, gint8, guint8, gint16, guint16, gint32, guint32
File "C:\Users\user\AppData\Local\Temp\pip-install-5ymvp6rm\pgi_e8fc2c7d05e54b1083386e9ca52df18f\pgi\clib\glib.py", line 16, in <module>
_glib = find_library("glib-2.0")
File "C:\Users\user\AppData\Local\Temp\pip-install-5ymvp6rm\pgi_e8fc2c7d05e54b1083386e9ca52df18f\pgi\clib\_utils.py", line 99, in find_library
_internal[name] = cdll.LoadLibrary(_so_mapping[name])
File "c:\users\user\appdata\local\programs\python\python38\lib\ctypes\__init__.py", line 447, in LoadLibrary
return self._dlltype(name)
File "c:\users\user\appdata\local\programs\python\python38\lib\ctypes\__init__.py", line 369, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'libglib-2.0-0.dll'. Try using the full path with constructor syntax.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Following the error, I tried manually registering libglib-2.0-0.dll following this link. It still gives me the same error.
I have tried to use conda to install pgi but it was no use.
I am working on 64-it Windows.
I am actively having a meltdown. I would appreciate any suggestion.
I was able to solve creating a conda environment and installing the libglib through conda first:
conda install -c conda-forge libglib

Command "python setup.py egg_info" failed with error code 1

Extracting in C:\Users\hkpra\AppData\Local\Temp\tmp3esvodcb
Traceback (most recent call last):
File "c:\program files\python35\lib\site-packages\ez_setup.py", line 143, in use_setuptools
raise ImportError
ImportError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\hkpra\AppData\Local\Temp\pip-build-imphcwak\unroll\setup.py", line 2, in <module>
ez_setup.use_setuptools()
File "c:\program files\python35\lib\site-packages\ez_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "c:\program files\python35\lib\site-packages\ez_setup.py", line 125, in _do_download
_build_egg(egg, tarball, to_dir)
File "c:\program files\python35\lib\site-packages\ez_setup.py", line 99, in _build_egg
_extractall(tar)
File "c:\program files\python35\lib\site-packages\ez_setup.py", line 467, in _extractall
self.chown(tarinfo, dirpath)
TypeError: chown() missing 1 required positional argument: 'numeric_owner'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\hkpra\AppData\Local\Temp\pip-build-imphcwak\unroll\
These are the things you need to do to fix this error when installing python. Make sure to follow in accordance.
check if PIP and setuptools are installed.
upgrade PIP and setuptools.
install ez_setup.
Should you want step by step guidance on how to go about it, you can go here.
install python again, then successed
I also install by pip,lick
pip install locustio
or
sudo pip install locustio
but error occur
Collecting locustio
Using cached locustio-0.7.5.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
error: Invalid distribution name or version syntax: locustio-0.7.5
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/yw/15gswkd13v37xjqjy66rc8xc0000gn/T/pip-build-hFFjxs/locustio/
I try pip, pip3, and so on. Finally, I install python again and then it is ok.
for python2.7
sudo pip install python
for python3
sudo pip install python3

pip - unable to find vcvarsall.bat

From last week, I tried to solve this but couldn't fix this error. While, I tried to install, following error comes:
C:\Users\#######>pip install pyproj
Collecting pyproj
Using cached pyproj-1.9.5.1.tar.gz
Complete output from command python setup.py egg_info:
using bundled proj4..
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\H~1\AppData\Local\Temp\pip-build-e4o66o1z\pyproj\setup.py", line 72, in <module>
objects = cc.compile(['nad2bin.c', 'src/pj_malloc.c'])
File "C:\Users\######\Anaconda3\lib\distutils\_msvccompiler.py", line 317, in compile
self.initialize()
File "C:\Users\########\Anaconda3\lib\distutils\_msvccompiler.py", line 210, in initialize
vc_env = _get_vc_env(plat_spec)
File "C:\Users\#######\Anaconda3\lib\distutils\_msvccompiler.py", line 85, in _get_vc_env
raise DistutilsPlatformError("Unable to find vcvarsall.bat")
distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\H~1\AppData\Local\Temp\pip-build-e4o66o1z\pyproj\
I couldn't proceed ahead without fixing this error. I have installed Microsoft Visual C++.
Installing some Python packages under Windows can be troublesome. You can find a precompiled package at
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyproj
Just download the .whl file that suits your Python version then install it using
pip install <filename>.whl

configparser not working in Python 3.4, NoSectionError but works fine in PyCharm

I worked on a Python 3.4 script in PyCharm 4.5. (repo: https://github.com/Djidiouf/bbot )
In it, I used import configparser without any problem for retrieving some values in a config.cfg:
config = configparser.RawConfigParser()
config.read('config.cfg')
server = config.get('bot_configuration', 'server')
channel = config.get('bot_configuration', 'channel')
botnick = config.get('bot_configuration', 'botnick')
port = config.getint('bot_configuration', 'port')
Now, I want to deploy it on a Debian 8.1 server. On that server, I have both Python 2.7 and Python 3.4 versions installed.
But when I ran the script on the machine, I have the following issue:
djidiouf#linuxserver:/home/djidiouf# /usr/bin/python3.4 /home/djidiouf/bbot/bbot.py
Traceback (most recent call last):
File "/usr/lib/python3.4/configparser.py", line 1116, in _unify_values
sectiondict = self._sections[section]
KeyError: 'bot_configuration'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/djidiouf/bbot/bbot.py", line 25, in <module>
import modules.steam # Contains specific Steam-Valve related functions
File "/home/djidiouf/bbot/modules/steam.py", line 13, in <module>
import modules.connection
File "/home/djidiouf/bbot/modules/connection.py", line 37, in <module>
server = config.get('bot_configuration', 'server')
File "/usr/lib/python3.4/configparser.py", line 754, in get
d = self._unify_values(section, vars)
File "/usr/lib/python3.4/configparser.py", line 1119, in _unify_values
raise NoSectionError(section)
configparser.NoSectionError: No section: 'bot_configuration'
I made a lot of research on Internet about that but I didn't find anything valuable. Some people made mention about a corrupt config.cfg file but mine is a LF EOL file with UTF8 without BOM as needed. I also recreated it again with vi on the machine.
I also tried to install configparser with pip (even if, if I understand it well, it's now build-in in Python 3) : pip3 install configparser But when I do that, I have the following error:
djidiouf#linuxserver:/home/djidiouf# sudo pip3 install -v configparser
[sudo] password for djidiouf:
Downloading/unpacking configparser
Ignoring link https://pypi.python.org/packages/source/c/configparser/configparser-3.5.0b1.tar.gz#md5=d60ca2c714acb4adaf5818c6a1ffd78b (from https://pypi.python.org/simple/configparser/), version 3.5.0b1 is a pre-release (use --pre to allow).
Ignoring link https://pypi.python.org/packages/source/c/configparser/configparser-3.5.0b2.tar.gz#md5=ad2a71db8bd9a017ed4735eac7acfa07 (from https://pypi.python.org/simple/configparser/), version 3.5.0b2 is a pre-release (use --pre to allow).
Using version 3.3.0r2 (newest of versions: 3.3.0r2, 3.3.0r1, 3.2.0r3, 3.2.0r2, 3.2.0r1)
Downloading configparser-3.3.0r2.tar.gz
Downloading from URL https://pypi.python.org/packages/source/c/configparser/configparser-3.3.0r2.tar.gz#md5=dda0e6a43e9d8767b36d10f1e6770f09 (from https://pypi.python.org/simple/configparser/)
Running setup.py (path:/tmp/pip-build-v7av3db7/configparser/setup.py) egg_info for package configparser
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 5, in <module>
import distutils.core
File "/usr/lib/python3.4/distutils/core.py", line 18, in <module>
from distutils.config import PyPIRCCommand
File "/usr/lib/python3.4/distutils/config.py", line 7, in <module>
from configparser import ConfigParser
File "/tmp/pip-build-v7av3db7/configparser/configparser.py", line 397
_KEYCRE = re.compile(ur"%\(([^)]+)\)s")
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 5, in <module>
import distutils.core
File "/usr/lib/python3.4/distutils/core.py", line 18, in <module>
from distutils.config import PyPIRCCommand
File "/usr/lib/python3.4/distutils/config.py", line 7, in <module>
from configparser import ConfigParser
File "/tmp/pip-build-v7av3db7/configparser/configparser.py", line 397
_KEYCRE = re.compile(ur"%\(([^)]+)\)s")
^
SyntaxError: invalid syntax
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-v7av3db7/configparser
Exception information:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 290, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python3/dist-packages/pip/req.py", line 1230, in prepare_files
req_to_install.run_egg_info()
File "/usr/lib/python3/dist-packages/pip/req.py", line 326, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/lib/python3/dist-packages/pip/util.py", line 716, in call_subprocess
% (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-v7av3db7/configparser
Storing debug log for failure in /root/.pip/pip.log
Here is a config example, I just changed the values and rename the file accordingly to config.cfg :
[bot_configuration]
server = your.irc.server.com
channel = ##your_channel
botnick = bbot
port = 6667
admins = You,Him
https://github.com/Djidiouf/bbot/blob/master/config_example.cfg
Finally, I just want to say that everything is working on PyCharm 4.5, I just made a git clone, rename the config_example.cfg, change the values, tried to run the script with Python 3.4.
The install error is from _KEYCRE = re.compile(ur"%\(([^)]+)\)s"), that is causing a syntax error as the ur prefix is not supported in python3, pip is trying to instal a python2 package.
Your first error is a keyError 'bot_configuration' which is not because of not having configparser installed, configparser is part of the standard library.
The bot_configuration KeyError is because python cannot find your config file, if you use config.read('foobar') in pycharm you will see the exact same output
I figured out that I had some inconsistency about running the script. When I was in another folder than my script, nothing worked but when I was in it, it worked. Perhaps because the config file is shared and used in the main script and in a module.
In fact it's due to the need to have an absolute path in config.read('/some/path/file.cfg')
Finally, I find that answer: https://stackoverflow.com/a/13800583/3301370
So here is the solution in the case of config.cfg being on the project root directory /config.cfg :
/bbot.py
import os
config.read(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'config.cfg'))
However, as the config file is shared and used in the main script and in a subpath, module, a correct path must be set for the sub module too:
/modules/connection.py
import os
config.read(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'config.cfg'))
It works fine in PyCharm because when you hit the run button for your script, it runs it with the path of the project. The fact that having a relative path for both config.read() statements worked only because of that.
The problem with installing configparser with pip is unrelated to that specific problem and can be ignore in that case as configparser is a built-in library in Python3.

Cannot install netCDF4 python package on OS X

I'm trying to install netCDF4 on OS X with pip install netCDF4 and I am getting the following error:
------------------------------------------------------------
/usr/local/bin/pip run on Wed Aug 7 23:02:37 2013
Downloading/unpacking netCDF4
Running setup.py egg_info for package netCDF4
HDF5_DIR environment variable not set, checking some standard locations ..
checking /Users/mc ...
checking /usr/local ...
checking /sw ...
checking /opt ...
checking /opt/local ...
checking /usr ...
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4/setup.py", line 114, in <module>
raise ValueError('did not find HDF5 headers')
ValueError: did not find HDF5 headers
Complete output from command python setup.py egg_info:
HDF5_DIR environment variable not set, checking some standard locations ..
checking /Users/mc ...
checking /usr/local ...
checking /sw ...
checking /opt ...
checking /opt/local ...
checking /usr ...
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4/setup.py", line 114, in <module>
raise ValueError('did not find HDF5 headers')
ValueError: did not find HDF5 headers
----------------------------------------
Command python setup.py egg_info failed with error code 1 in /var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4
Exception information:
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/basecommand.py", line 107, in main
status = self.run(options, args)
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/commands/install.py", line 256, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 1042, in prepare_files
req_to_install.run_egg_info()
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 236, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg/pip/util.py", line 612, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /var/folders/jj/0w0dd3n16jq4g5579g6c7h040000gn/T/pip-build/netCDF4
I already installed HDF5 to /usr/local/hdf5/ but I'm still getting the same error. I'm a new to Python so any help will be greatly appreciated.
Thank you.
You might need to set the HDF5_DIR environment variable to the location where you install HDF5; it's looking in the standard install paths and not finding the headers for HDF5 - hence at least one of your errors.
You can simply set it before calling pip:
HDF5_DIR=/usr/local/hdf5 pip install netCDF4
or export it and then call pip:
export HDF5_DIR=/usr/local/hdf5
pip install netCDF4
Simply try this procedure to install netCDF4
install HDF5 from link
install netcdf4 from link
install netcdf4-python from link
For detail visit link
If you don't need the latest version --prefer-binary flag to pip may solve it:
pip install netcdf4 --prefer-binary

Categories