How to install the latest python module via pip? - python

I can see openbabel 3.0.0 with pip3 search. But when I install it with pip3 install, I get only 2.4.1. Is there anything wrong? How to get the latest version installed? Thanks.
When I try to specify the version, pip does not find it. This is strange given the version on pypi is 3.0.0. https://pypi.org/project/openbabel/
$ pip3 install openbabel==3.0.0
ERROR: Could not find a version that satisfies the requirement openbabel==3.0.0 (from versions: 1.8, 1.8.1, 1.8.2, 1.8.4, 2.4.0, 2.4.1)
ERROR: No matching distribution found for openbabel==3.0.0
$ pip3 search openbabel
openbabel (3.0.0) - openbabel: Python interface to the Open Babel chemistry library
pyOBabel (0.1.1) - A python binding to openbabel chemical toolbox (http://openbabel.org)
$ pip3 install openbabel
Collecting openbabel
Using cached https://files.pythonhosted.org/packages/9c/30/eb9c3d3d3b86981f6c6a7b8eceb6f4a13b9a12673efbc842b7cebe0ce39a/openbabel-2.4.1.tar.gz
Installing collected packages: openbabel
Running setup.py install for openbabel ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/mktemp/pip-install-6d4dkzh2/openbabel/setup.py'"'"'; __file__='"'"'/private/tmp/mktemp/pip-install-6d4dkzh2/openbabel/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/mktemp/pip-record-xr3vrvho/install-record.txt --single-version-externally-managed --compile
cwd: /private/tmp/mktemp/pip-install-6d4dkzh2/openbabel/
Complete output (64 lines):
running install
running build_ext
Warning: package openbabel-2.0 could not be found by pkg-config.
Guessing Open Babel location:
- include_dirs: ['/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8m', '/usr/local/include/openbabel-2.0']
- library_dirs: ['/usr/local/lib']
building '_openbabel' extension
swigging openbabel-python.i to openbabel-python_wrap.cpp
swig -python -c++ -small -O -templatereduce -naturalvar -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8m -I/usr/local/include/openbabel-2.0 -o openbabel-python_wrap.cpp openbabel-python.i
openbabel-python.i:225: Error: Unable to find 'openbabel/babelconfig.h'
openbabel-python.i:227: Error: Unable to find 'openbabel/data.h'
openbabel-python.i:228: Error: Unable to find 'openbabel/rand.h'
openbabel-python.i:229: Error: Unable to find 'openbabel/obutil.h'
openbabel-python.i:230: Error: Unable to find 'openbabel/math/vector3.h'
openbabel-python.i:232: Error: Unable to find 'openbabel/math/matrix3x3.h'
openbabel-python.i:233: Error: Unable to find 'openbabel/math/transform3d.h'
openbabel-python.i:234: Error: Unable to find 'openbabel/math/spacegroup.h'
openbabel-python.i:238: Error: Unable to find 'openbabel/base.h'
openbabel-python.i:240: Error: Unable to find 'openbabel/generic.h'
openbabel-python.i:241: Error: Unable to find 'openbabel/griddata.h'
openbabel-python.i:243: Error: Unable to find 'openbabel/chains.h'
openbabel-python.i:244: Error: Unable to find 'openbabel/typer.h'
openbabel-python.i:252: Error: Unable to find 'openbabel/plugin.h'
openbabel-python.i:257: Error: Unable to find 'openbabel/oberror.h'
openbabel-python.i:258: Error: Unable to find 'openbabel/format.h'
openbabel-python.i:259: Error: Unable to find 'openbabel/obconversion.h'
openbabel-python.i:260: Error: Unable to find 'openbabel/residue.h'
openbabel-python.i:261: Error: Unable to find 'openbabel/internalcoord.h'
openbabel-python.i:262: Error: Unable to find 'openbabel/atom.h'
openbabel-python.i:263: Error: Unable to find 'openbabel/bond.h'
openbabel-python.i:264: Error: Unable to find 'openbabel/reaction.h'
openbabel-python.i:282: Error: Unable to find 'openbabel/mol.h'
openbabel-python.i:289: Error: Unable to find 'openbabel/ring.h'
openbabel-python.i:290: Error: Unable to find 'openbabel/parsmart.h'
openbabel-python.i:291: Error: Unable to find 'openbabel/alias.h'
openbabel-python.i:292: Error: Unable to find 'openbabel/atomclass.h'
openbabel-python.i:294: Error: Unable to find 'openbabel/fingerprint.h'
openbabel-python.i:296: Error: Unable to find 'openbabel/descriptor.h'
openbabel-python.i:301: Error: Unable to find 'openbabel/forcefield.h'
openbabel-python.i:303: Error: Unable to find 'openbabel/builder.h'
openbabel-python.i:304: Error: Unable to find 'openbabel/op.h'
openbabel-python.i:306: Error: Unable to find 'openbabel/chargemodel.h'
openbabel-python.i:309: Error: Unable to find 'openbabel/phmodel.h'
openbabel-python.i:310: Error: Unable to find 'openbabel/graphsym.h'
openbabel-python.i:311: Error: Unable to find 'openbabel/isomorphism.h'
openbabel-python.i:312: Error: Unable to find 'openbabel/query.h'
openbabel-python.i:313: Error: Unable to find 'openbabel/canon.h'
openbabel-python.i:315: Error: Unable to find 'openbabel/stereo/stereo.h'
openbabel-python.i:318: Error: Unable to find 'openbabel/bitvec.h'
openbabel-python.i:321: Error: Unable to find 'openbabel/rotor.h'
openbabel-python.i:323: Error: Unable to find 'openbabel/rotamer.h'
openbabel-python.i:324: Error: Unable to find 'openbabel/spectrophore.h'
openbabel-python.i:374: Error: Unable to find 'openbabel/obiter.h'
stereo.i:1: Error: Unable to find 'openbabel/stereo/tetranonplanar.h'
stereo.i:2: Error: Unable to find 'openbabel/stereo/tetraplanar.h'
stereo.i:3: Error: Unable to find 'openbabel/stereo/tetrahedral.h'
stereo.i:4: Error: Unable to find 'openbabel/stereo/cistrans.h'
stereo.i:5: Error: Unable to find 'openbabel/stereo/squareplanar.h'
stereo.i:6: Error: Unable to find 'openbabel/stereo/bindings.h'
Error: SWIG failed. Is Open Babel installed?
You may need to manually specify the location of Open Babel include and library directories. For example:
python setup.py build_ext -I/usr/local/include/openbabel-2.0 -L/usr/local/lib
python setup.py install
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/mktemp/pip-install-6d4dkzh2/openbabel/setup.py'"'"'; __file__='"'"'/private/tmp/mktemp/pip-install-6d4dkzh2/openbabel/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/mktemp/pip-record-xr3vrvho/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
open-babel 3.0.0 is installed by homebrew.
$ brew info open-babel
open-babel: stable 3.0.0 (bottled), HEAD
Chemical toolbox
https://openbabel.org
/usr/local/Cellar/open-babel/3.0.0 (328 files, 19.5MB) *
Poured from bottle on 2019-11-02 at 02:42:41
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/open-babel.rb
==> Dependencies
Build: cmake ✘, pkg-config ✔, rapidjson ✘, swig ✔
Required: cairo ✔, eigen ✔, python ✘
==> Options
--HEAD
Install HEAD version
``

From the looks of it, the maintainers of openbabel did not publish any usable distribution of the project for your system. You seem to be using Linux, but there are only pre-built wheels for Windows, and no source distribution (sdist):
https://pypi.org/project/openbabel/3.0.0/#files
You could downgrade to an earlier version, or install directly from their source code repository with something like the following:
pip install 'git+https://github.com/openbabel/openbabel.git#openbabel-3-0-0#egg=openbabel&subdirectory=scripts/python'
Note: sadly this doesn't actually work, because some files seem to require a pre-process step beforehand. There are some alternative installation instructions on this document.
Your best bet, would still be to ask the maintainers to release an sdist or Linux-wheels on PyPI.
Related issue: https://github.com/openbabel/openbabel/issues/2067

Related

Error while installing mysqlclient for python in Windows 10

I use this command for installing MySQL client:
pip install mysqlclient
And then I see this problem:
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279
Cleaning up... Command C:\Python34\python.exe -c "import setuptools,
tokenize;file='C:\Users\Jayed\AppData\Local\Temp\pip_build_Jayed\mysqlclient\setup.py';exec(compile(getattr(tokenize,
'open', open)(file).read().replace('\r\n', '\n'), file,
'exec'))" install --record
C:\Users\Jayed\AppData\Local\Temp\pip-l4c6dhkk-record\install-record.txt
--single-version-externally-managed --compile failed with error code 1 in C:\Users\Jayed\AppData\Local\Temp\pip_build_Jayed\mysqlclient
Storing debug log for failure in C:\Users\Jayed\pip\pip.log
Actually I went down this path. While I suppose you can find all the libraries and components you need to get the client to compile, it is telling you it can't find a compiled copy of the client and is trying to compile it to install it.
Follow the instructions here: https://pypi.org/project/mysqlclient/ (it has notes about windows doing what you are describing) or download the wheel file (from downloads link on the page) and type
pip install mysqlclient.whl
and it will install without demanding C++ in order to use mysql with python.

pip install package - failed with error code 1/2

I'm having issues installing pygrib using pip. I tried installing pygrib by using easy_install, and I get a similar error.
Using pip I get this error:
Command "C:\Users\Brandon\AppData\Local\Enthought\Canopy\edm\envs\User\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Brandon\\AppData\\Local\\Temp\\pip-build-veulay9n\\pygrib\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Brandon\AppData\Local\Temp\pip-ff_s5247-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Brandon\AppData\Local\Temp\pip-build-veulay9n\pygrib\
Using easy_install I get this error:
c:\users\brandon\appdata\local\enthought\canopy\edm\envs\user\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
pygrib.c(242): fatal error C1083: Cannot open include file: 'grib_api.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 status 2
In fact, pygrib is the only package that doesn't work when I try pip or easy_install - it works for any package I try to install. What's going on here and how do I fix this issue?
pygrib is a Python wrapper for libgrib-api. To compile pygrib you need to compile libgrib-abi and install the library and the header files. Download sources from https://software.ecmwf.int/wiki/display/GRIB/Releases.
pygrib includes one or more Python extension modules written in C which need to be compiled as part of the installation, and this C code depends upon some library that provides a header file named "grib_api.h". Find and install that C library, and pygrib installation should then work.

installing a python package from tar.gz

I need to use the cvxopt package for python 3. I run Ubuntu.
So I downloaded cvxopt-1.1.9.tar.gz and extracted the content (a single folder called cvxopt-1.1.9) into a folder
/home/myname/TargetFolder/
manually, not via the command window.
When I run the sequence .configure, then make and then sudo make install, none of them works.
There is a setup.py file in /home/myname/TargetFolder/cvxopt-1.1.9/. When I go to that directory in the command window and type python setup.py install, then I get the following error message:
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/home/myname/anaconda3/lib/python3.5/site-packages/test-easy-install-6110.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/home/myname/anaconda3/lib/python3.5/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://pythonhosted.org/setuptools/easy_install.html
That link doesn't exist anymore.
So I follow the advice on http://cvxopt.org/install/ . Apart from the "python setup.py install" command, which didn't work for me, I tried the second thing on their list. Namely "pip install cvxopt"
This gave:
Collecting cvxopt
Downloading cvxopt-1.1.9.tar.gz (1.9MB)
100% |████████████████████████████████| 1.9MB 271kB/s
Building wheels for collected packages: cvxopt
Running setup.py bdist_wheel for cvxopt
Complete output from command /home/myname/anaconda3/bin/python3 -c >"import setuptools;file='/tmp/pip-build-r3o_hfm6/cvxopt/setup.py';>exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" bdist_wheel -d /tmp/tmpv0ura7txpip-wheel-:
running bdist_wheel
running a lot of other stuff
and then
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Failed building wheel for cvxopt
Failed to build cvxopt
and then
Installing collected packages: cvxopt
Running setup.py install for cvxopt
Complete output from command /home/myname/anaconda3/bin/python3 -c "import setuptools, tokenize;file='/tmp/pip-build-r3o_hfm6/cvxopt/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-1f4yz1xm-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
UPDATING build/lib.linux-x86_64-3.5/cvxopt/_version.py
set build/lib.linux-x86_64-3.5/cvxopt/_version.py to '1.1.9'
running build_ext
building 'base' extension
and then after some more lines it says:
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Command "/home/myname/anaconda3/bin/python3 -c "import setuptools, tokenize;file='/tmp/pip-build-r3o_hfm6/cvxopt/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-1f4yz1xm-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-r3o_hfm6/cvxopt
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
If I understood more about Linux and Python I could have focused on the important things and shortened the post a little. But since I know nothing, I post everything I did to maximize the possibility of helpful responses.
Maybe I just don't understand how python works. When I include a package I do this with the
import package
command. But import cvxopt doesn't work. So if I understood what it is exactly doing, then maybe I could use logic to give her or him that cvxopt package, where it is looking for it.
Since you are running Ubuntu, simply run sudo apt-get install python-cvxopt
I can install it this way on 16.04. Not sure what version you are running.
It does look like the compiler (gcc) is complaining because you are missing dependencies (blas). Installing via the package manager should solve your issues.

Why am I receiving this error when trying to install pyquery python module?

I'm using the following command
!pip install pyquery
I'm able to install other modules. Does anyone know why this is happening? Thanks!
src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found
#include "libxml/xmlversion.h"
^
1 error generated.
Compile failed: command 'cc' failed with exit status 1
creating var
creating var/folders
creating var/folders/p1
creating var/folders/p1/xg17tts541n1__p_srg1n2j80000gn
creating var/folders/p1/xg17tts541n1__p_srg1n2j80000gn/T
cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /var/folders/p1/xg17tts541n1__p_srg1n2j80000gn/T/xmlXPathInit9XZ4sL.c -o var/folders/p1/xg17tts541n1__p_srg1n2j80000gn/T/xmlXPathInit9XZ4sL.o
/var/folders/p1/xg17tts541n1__p_srg1n2j80000gn/T/xmlXPathInit9XZ4sL.c:1:10: fatal error: 'libxml/xpath.h' file not found
#include "libxml/xpath.h"
^
1 error generated.
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
Perhaps try: xcode-select --install
*********************************************************************************
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;file='/private/var/folders/p1/xg17tts541n1__p_srg1n2j80000gn/T/pip-build-nn9QXj/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/p1/xg17tts541n1__p_srg1n2j80000gn/T/pip-X97yGE-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/p1/xg17tts541n1__p_srg1n2j80000gn/T/pip-build-nn9QXj/lxml
Based on this reference http://forums.fedoraforum.org/showthread.php?t=297730 ,
I was tried installing libffi-devel, libxml2-devel, libxslt-devel and it solved the issue. I'm using CentOS 7.
src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h'
file not found
include "libxml/xmlversion.h"
I had encountred this type of errors. In most cases installing development package of shared libraries the module requires fix it.
In Debian libxml2-dev has all the header files of libxml2 pacakge.
libxml2:amd64/jessie 2.9.1+dfsg1-5 uptodate
libxml2-dev:amd64/jessie 2.9.1+dfsg1-5 uptodate
lxml module requires libxml2-dev and libxslt1-dev.

Unable to install pyodbc

I am using python 3.3.0 .. Within this package C:\Python34\Scripts is my pip and I have added this path to my system and user environment variable PATH the link to this pip folder,I have installed Visual C++ 2010 but i don't know what needs to be done once it is installed if or not i need to configure something, yet when I do :
C:\Python33\Scripts>pip install https://pyodbc.googlecode.com/files/pyodbc-3.0.7.zip
It gives me the following error:
This is what stackoverflow editor has changed it to :
Fatal error in launcher: Unable to create process using
'"C:\Python33\python.exe " "C:\Python33\Scripts\pip.exe" install
https://pyodbc.googlecode.com/files/pyo dbc-3.0.7.zip'
C:\Python33\Scripts>pip
Fatal error in launcher: Unable to create process using
'"C:\Python33\python.exe " "C:\Python33\Scripts\pip.exe" '
And this is the actual error that i see at console:
ValueError: ['path']
----------------------------------------
Command "C:\Python33\python.EXE -c "import setuptools, tokenize;__file__='c
\users\elyon\appdata\local\temp\pip-inh3nq-build\setup.py';exec(compi
e(getattr(tokenize, 'open', open)(file).read().replace('\r\n',
'\n'), __fil
__, 'exec'))" install --record c:\users\elyon\appdata\local\temp\pip-x45j1j-
ecord\install-record.txt --single-version-externally-managed
--compile" failed ith error code 1 in c:\users\elyon\appdata\local\temp\pip-inh3nq-build
Since you're on Windows with Python 3.3, the easiest way to install pyodbc is to use the provided installers.
You should then be able to manage future upgrades using pip if you so desire.
C:\Python33\Scripts> .\pip.exe install --upgrade --allow-external pyodbc --allow-unverified pyodbc pyodbc
Requirement already up-to-date: pyodbc in c:\python33\lib\site-packages

Categories

Resources