Is there any way to 'uninstall' a module from the python path other than removing the files manually?
Pip, easy_install, setuptools etc all have install options, but no remove options!
I'm using Ubuntu 9.10
pip supports uninstall.
pip is able to uninstall most installed packages with
pip uninstall package-name
Known exceptions include pure-distutils packages installed with python setup.py install (such packages leave behind no metadata allowing determination of what files were installed), and script wrappers installed by develop-installs (python setup.py develop).
pip also performs an automatic uninstall of an old version of a package before upgrading to a newer version, so outdated files (and egg-info data) from conflicting versions aren’t left hanging around to cause trouble. The old version of the package is automatically restored if the new version fails to download or install.
See http://pip.openplans.org/
Related
I'm developing an application based on django==1.7.x.
The problem I have is that the setup.py of one of my dependencies (let's call it foo) specifies Django>=1.3 as one of its requirements, but when such foo is being installed, it tries to install the latest version of django, which as of now is 1.8.3.
I thought that when specifying dependencies like package>=min_version in the setup.py file, pip would see that package is already installed, the installed version suffies the minimum required version and thus respect that installation of package.
Why is pip trying to install the latest version? and how can I force it to respect my current installed version?
Update: FYI, I'm using pip==7.1.0
Update: This only happens when installing manually, like pip install foo==X.Y. When the dependency is in a requirements file and is installed via pip install -r requirements.txt, installed versions of required packages are respected by pip.
Thanks!
I have python 3.3 working and can run some basic code (like print("Hello World")). Next I need so get PyOpenSSL set up. I've downloaded and unzipped the pyOpenSSL-master.zip from their github site, but I have no idea what to do with it next.
I moved the unzipped directory into /libs, cd into /libs/pyopenssl-master and did python setup.py install --user. But that failed with
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
Other than the directory not existing, which I assume that the installer would create, the bigger problem is that it appears to be trying to write to the python 2.7 folder and I'm using 3.3.
If you can't tell, I'm pretty much out of my element. I've never installed a Python library before and I'm also not great with OSX installations. Can anyone help me get this set up? Thanks.
Here's how you can install pyOpenSSL on OS X (or just about any other platform):
Install pip
Install it using a package for your operating system. For example, if you use brew, brew install pip.
If there is no package for your operating system, download https://raw.github.com/pypa/pip/master/contrib/get-pip.py
Run it (probably as root, unfortunately): sudo python get-pip.py
Install virtualenv using pip - pip install --user virtualenv
Create a virtualenv to install pyOpenSSL into - virtualenv ~/Environments/pyOpenSSL-stuff
Activate the virtualenv - . ~/Environments/pyOpenSSL-stuff/bin/activate
Install pyOpenSSL with pip - pip install pyopenssl
At this point you have pyOpenSSL installed in a virtualenv. Any time you want to use pyOpenSSL you'll need to activate the virtualenv. I suggest that you actually create a virtualenv for each project of yours that you work on and install all of the necessary dependencies for each project into that project's virtualenv.
This does result in a lot of duplicate installations of packages. Unfortunately this seems to be the state of the art for Python package installation. Fortunately most Python packages are rather small.
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
I am going through the Learn Python the Hard Way, 2nd Edition book, and I am stuck on this problem: "Use your setup.py to install your own module and make sure it works, then use pip to uninstall it."
If I type
setup.py install
in the command line, I can install the module.
But when I type
pip uninstall setup.py
it says:
Cannot uninstall requirement setup.py, not installed
The pip package index says, http://pypi.python.org/pypi/pip, says:
pip is able to uninstall most installed packages with pip uninstall package-name.
Known exceptions include pure-distutils packages installed with python setup.py install >(such packages leave behind no metadata allowing determination of what files were >installed)
Is there another way to install my module that pip will recognize?
By the way, I'm using a windows computer. Just wanted to mention that in case there are different solutions for Windows, Linux, and Mac.
You're giving pip a Python file and not a package name, so it doesn't know what to do. If you want pip to remove it, try providing the name of the package this setup.py file is actually part of.
There are some good suggestions in this related thread:
python setup.py uninstall
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