How to install python-devel when using virtualenv - python

Before asking my question, let me introduce my computing environment first.
OS: Red Hat Enterprise Linux Server 6.5.
Python: Python 2.6 (by rpm install), Python 2.7 (based on virtualenv)
Question:
I want to install a library that requires python-devel. However, when using
yum install python-devel
The system installs python-devel-2.6.*, because the installed (yum-packaged) python is version 2.6. My question is , how to install python-devel that matches the version of the python in virtualenv (which is version 2.7 in my case).
Thanks!

This question has nothing to do with pip or virtualenv. python-dev is a Linux system package, not something you install with pip. You just need to explicitly install python-devel-2.7 - you can search your distribution's package repository for the exact package name.

Related

How can I check if pip can find python dev headers?

I'm trying to install Mujoco on a Ubuntu server and have a problem which very much looks like this: https://github.com/openai/mujoco-py/issues/265
The solution in that issue thread is to install the devel version of python3. Apparently that brings in python.h which is needed by Mujoco.
But things are complicated: I don't have root access on the machine. Pip comes from a conda environment and even on conda-forge, I don't see any dev version of python (Equivalent of apt-get install python3.6-dev for conda)
The installation guide for the server installs some packages with linuxbrew. There is a python package on brew and apparently it automatically ships with the python devel version: how to install python-devel in Mac OS?
Now I have anaconda python and brew python. How can I see which paths are picked up by pip and verify if it sees the python dev headers ?

Python package installation via yum

What could be the difference of installing python packages via yum vs. via pipon Centos in terms of security? Is it even possible to install a python package only via yum?
yum can be used to install Python on CentOS.
pip is used to install Python libraries (packages). Not Python itself.
No "security" issue. But with yum you could overwrite your native Python installation, which can be a problem.
Instead of that, it is recommended to use virtualenv.

Zope installed to wrong version (easy_install and pip)

I downloaded the python egg for zope.interface version 4.0.5 and tried to install it with easy_install and then pip. Both installed it to python 2.7, which is the default on my computer. Is there any way to install it to python3?
I'm on Mac OSX 10.8.3. I've looked around for some solution, but the only one I found with this problem was here: easy_install with various versions of python installed, mac osx, but the answer doesn't work.
I would suggest installing the Homebrew package manager, and installing python 3 with it.
Installing Homebrew:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Installing Python 3
brew install python3
Pip for Python 3 would be installed as pip3 by the above command.
easy_install is depretiated with homebrew, and you don't need to use sudo with pip3 or gem
Note, easy_install is deprecated. We install pip (or pip3 for python3) along with python/python3.
source

how to install python-devel for 2.6 version?

i use centos 5.4 ,the default python version is python2.4,so i use the python2.6.2.tar.gz compile a python 2.6 version
and now i want to intstall board review project it need install python-devel package,if i use
yum install python-devel,it will install the python2.4 relevent version python-devel,
how could i get a python2.6 version devel package install?
If you enable the EPEL repo, you can install python 2.6 and the devel headers using yum:
# yum install python26
# yum install python26-devel
These packages won't then conflict with the python 2.4 ones.
Looks like it is more system administration than it should be required. Here are some helpful pointers:
http://blog.milford.io/2010/08/new-method-for-installing-python-2-6-4-with-mysql-python-on-centos-5-5/
How to install python2.6-devel package under CentOs 5
However, if you are just installing reviewboard software, you can go to http://www.python.org download the package, do a ./configure, make and make altinstall to a local version and then point that interpreter to your reviewboard download's setup.py file.

How to Uninstall setuptools python

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

Categories