I've got a Python module which is distributed on PyPI, and therefore installable using easy_install. It depends on lxml, which in turn depends on libxslt1-dev. I'm unable to install libxslt1-dev with easy_install, so it doesn't work to put it in install_requires. Is there any way I can get setuptools to install it instead of resorting to apt-get?
setuptools can only install Python packages that in the package index you are using, either the default index of the one you specify with easy_install -i http://myindex.site/index.
Any non-Python dependencies have to be installed using the standard installation package for the platform (apt-get on Debian based Linux distros). libxml2 and libxslt fall into this category so you should install these in the standard way.
It's better use apt-get to install lxml (or the python packages that has c extensions) and then pull pure python package from pypi. Also I generally try to avoid using easy_install for top level install, I rather create a virtual env using virtualenv and then use easy_install created by virtualenv to keep my setups clean.
This strategy is working successfully for me for couple of production environments.
Related
I want to include a Python package dependency (installed using pip3 install) in an rpm package. I cannot install using dnf because its version is out of date. rpm returns the following error if I install the dependency using pip3 install:
error: Failed dependencies python3.6dist(dependency-package)
Any suggestions on how to include a Python package inside of an rpm?
OK. Some of your package require python3-somepackage or python3dist(somepackage). For rpm, it is just a string. Rpm does not care that the python module has been installed using pip. There must be some package which provides that string.
You have two options.
Prefered is use of pyp2rpm --srpm somepackage. That will download the latest version of the module from PyPI and produce the src.rpm. You can then build it using mock -r epel-8-x86_64 somepackage.src.rpm
The other option is to fake the provides. You can install the module using pip and then run: create-fake-rpm --build python3-somepackage 'python3dist(somepackage)'. This will generate the file fake-python3-somepackage-0-0.noarch.rpm which you can install using rpm. Then you can proceed with the install of your application. Be warned, that this is cheating. Future dnf upgrade will not update this module, you will have to take care of that yourself.
When I install packages with python 3 on ubuntu 16.04, they get installed to my local user ~/.local/lib/python3.5/site-packages. How do I force pip to install to the system-wide site packages?
I'm trying by using pip3 install <pkg>
Thanks.
This is NOT a duplicate of How to make my Python module available system wide on Linux? - because that is about creating your own module, not a a strange way that pip is working for a Pypi module. Not even close, actually, other than they both deal with modules.
After a failed attempt at a "streamlined" install of the SimpleCV framework superpack for Windows. I'm now working through a manual installation guide (which I'm OK with as I have more control over the installation and might finally learn about installing Python Packages properly in Windows!)
Rather than just blindly follow the guide I'm trying to understand each step, so I'm confused by this..
easy_install pyreadline
easy_install PIL
easy_install cython
easy_install pip
pip install ipython
pip install https://github.com/ingenuitas/SimpleCV/zipball/1.3
Why not easy_install pip as soon as possible then pip the other packages?..
easy_install pip {{{I intend to research and probably use get-pip.py here}}}
pip install pyreadline
pip install PIL
pip install cython
pip install ipython
pip install https://github.com/ingenuitas/SimpleCV/zipball/1.3
Is there a pitfall doing it this way? (My limited understanding is that it's always preferable to use pip rather than easy_install.)
I know this question relates directly to SimpleCV but I want to learn the correct approach for when I'm installing package collections in the future without the benefit of a guide.
pip fetches the source code of the packages you're trying to install and compiles them. So if you don't have a compiler installed and configured it will fail to do so for packages which contain extensions written in C, which in this case applies to pyreadline, PIL and cython.
easy_install uses the precompiled packages from pypi (at least for windows if they're available), which means you don't need to compile everything yourself.
For pure python packages it's no problem using pip instead of easy_install, and if you have a compiler and the neccessary build dependencies installed it should also work.
I believe the answer is that pip does not currently support the installation of binary distributions, i.e. Python packages that include pre-compiled C extension modules. easy_install does.
BTW, there is work afoot to provide replacements for pip (and easy_install) that will fully support binary distributions on all platforms. See here for an overview.
Hi recently i installed setup tools module and google app engine gives me errors . Is there a way to uninstall setuptool? can any one tell me step by step because i tried hard
The answer depends on how it was installed.
If it was installed using the ubuntu (debian) package manager, try:
sudo apt-get remove --purge python-setuptools
[updated]
If you installed manually, probably the setuptools final location will be something like (adjust for your environment/python version):
/usr/local/lib/python2.6/dist-packages
Just delete the setuptools stuff there.
Lame, I know, but it is your burden for not using the excellent package manager provided by ubuntu: stick to dpkg unless you need bleeding edge stuff. For other python modules installed by setuptools, it provides no "uninstall" feature (but pip does, that is why there is a lot of enthusiasm around virtualenv, pip and yolk).
[2017 update]
It is 2017 and installing Python modules changed a bit:
pip is now the preferred installer program. Starting with Python 3.4, it is included by default with the Python binary installers.
venv is the standard tool for creating virtual environments (semi-isolated Python environments that allow packages to be installed for use by a particular application, rather than being installed system wide), and has been part of Python since Python 3.3. Starting with Python 3.4, it defaults to installing pip into all created virtual environments.
virtualenv is a third party alternative (and predecessor) to venv and if not official it is still very popular because it allows virtual environments to be used on versions of Python prior to 3.4, which either don’t provide venv at all, or aren’t able to automatically install pip into created environments.
easy_install pip
pip uninstall pip setuptools
(pip and setuptools both use the same package formats, but pip has uninstall support. kinda hilarious that installing something is the easiest way to uninstall.)
I was having trouble with the method below because my pip wasn't up to date.
easy_install pip
pip uninstall pip setuptools
After upgrading pip like this:
sudo -H pip install --upgrade pip
I was able to successfully uninstall setuptools like so:
pip uninstall setuptools
Seems kinda weird that they'd require a package manager to install a package manager. I'm on Windows BTW.
Pip does require setuptools. Pip is really just a wrapper around setuptools to provide a better installer than easy_install and some nicer installation behaviors, plus uninstall, requirements files, etc. Even if you somehow got pip installed without setuptools it still won't run without it.
You can use Distribute instead of setuptools: it installs a package called setuptools (it's a fork of the latter). You can install Distribute by downloading and running distribute_setup.py.
Update: As Gringo Suave says, the above is obsolete now - distribute and setuptools have now merged, and the merged project is called setuptools.
You can download setuptools package as Windows installer from pypi/setuptools and then install pip or easy_install
Solution for Windows Users
If you installed ActivePython on Windows, then you have pip by default, as well as PyPM (ActiveState's package manager). The following excerpt is from What's included in ActivePython 2.7:
Additional Packages
PyPM: Python Package Manager to download and install binary packages. Also included: virtualenv, Distribute, pip, SQLAlchemy.
Solution for OS X Users
Not sure if setuptools is required when installing pip using homebrew. You might try that.
To install homebrew:
ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"
Then to install pip:
brew install pip
Sure, just grab the source from http://pypi.python.org/pypi/pip/0.8.2#downloads
unpack it, cd into it, and run python setup.py install