How do I install biopython for a specific version of python - python

I have attempted to install biopython for python2.7 on a cluster of machines.
I have a tonne of scripts that are written in python2.7 and I need to use biopython, but the refactoring of the scripts is more hassle than it is worth - so I thought it would be easier to use an install workaround.
pip install python2 biopython
and
pip install python2.7 biopython
and all variations of these calls do nothing.
They tell me everything is satisfied because there is an installation of biopython for python3.4.
Does anyone know this installation command?

Since version 0.8 you can use the following:
$ pip-2.5 install package
$ pip-2.6 install package
$ pip-2.7 install package
Also see this question: pip: dealing with multiple Python versions?

Related

I'm confused about the difference between pip and pip3, in anaconda env

TL;DR: a package is installed under pip3, but it cannot be found under Python3. Why?
All of this is happening in my anaconda base environemnt:
So I've been struggling with tensorflow and its versions (another post coming up).Turns out version 2.1 is only available at pip and not with conda install. So after upgrading pip3 install --upgrade pip I install pip3 install tensorflow==2.1.0. I open Jupyer-Notebook afterwards, and turns out tensorflow is not installed(running Python3). I check from the terminal first for the version, and then to uninstall tensorflow. It is not installed under pip (as expected) but it is indeed installed under pip3. I also get this message when uninstalling via pip3:
"pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly."
which might be related. I was under the impression that pip installs packages for the default python (3.7.4 in my case) but pip3 installs them only for Python3. What am I missing?
Thanks!
a package is installed under pip3, but it cannot be found under Python3. Why?
Because you have many different Pythons. pip doesn't install packages for all Pythons; pip3 doesn't install packages for Python3. They install packages for that particular Pythons they're running under. You cannot expect to install a package with one Python and import it in another eve if they're of the same version.
To see what Python is used with a particular pip see its shebang:
head -1 $(which pip)
head -1 $(which pip3)
If the shebang is #!/usr/bin/env python continue investigating with which python (or which python3).
Finding the Python run python -m site to see where from the packages are imported.

How to use pip with python3.5 after upgrade from 3.4?

I'm on Ubuntu and I have python2.7, (it came pre-installed) python3.4, (used before today) and python3.5, which I upgraded to today, installed in parallel. They all work fine on their own.
However, I want to use pip to install some packages, and I can't figure out how to do this for my 3.5 installation because pip installs for 2.7 and pip3 installs python 3.4 packages.
For instance, I have asyncio installed on 3.4, but I can't import it from 3.5. When I do pip3 install aysncio, it tells me the requirement is already satisfied.
I'm a bit of a newbie, but I did some snooping around install directories and couldn't find anything and I've googled to no avail.
I suppose you can run pip through Python until this is sorted out. (https://docs.python.org/dev/installing/)
A quick googling seems to indicate that this is indeed a bug. Try this and report back:
python3.4 -m pip --version
python3.5 -m pip --version
If they report different versions then I guess you're good to go. Just run python3.5 -m pip install package instead of pip3 install package to install 3.5 packages.
Another way would be to setup a virtual environment:
$ python3.4 -m venv envdir
$ source envdir/bin/activate
$ pip --version
Obviously, this won't install the packages globally and you'll have to source venv/bin/activate every time you wan to make use of it.

how to manage multiple Python distributions on one device

I have a macbook pro, and I have Python 2.7,3.3 and 3.4 and Anaconda 2.7 installed, and I am having a hard time managing all these multiple Python distributions. These are the problems I am facing :
pip install installs for anaconda 2.7 by default, how do I make it install for PYthon 2.7 ?
how do I make pip3 install work for different Python distributions? i.e is there some way I can use something like pip3 install -v 3.3.6 or something similar.
how do I find a workaround for these problems. I wish to know the answer in both the basic sense (how Python and Anaconda work, and what happens when I use pip install, and how do I use these to solve my problem), and also in the practical sense (is there some simple way to manage this problem).
To install packages for specific python versions, it is easiest to run python with the -m flag. The -m flag will run the specified module as a script. Calling python -m pip install _package_ will run pip for whatever python you specify.
Examples:
python -m pip install _package_
python3 -m pip install _package_
python2.7 -m pip install _package_
python3.7 -m pip install _package_

Should I manually install all my system wide packages after upgrading to Python 3?

I have some systemwide packages I've installed and I'm unclear whether I'm supposed to install another copy of them all for Python3 or if there is some way to 'point' Python3 at them. I'm on a Mac.
I still have Python 2.7.9 which has all the packages (most installed with either brew or pip and maybe one or two manually like pyqt). Do I basically have to redo the installation process for every single package again? Or is there some way to simply have Python3 'inherit' everything I've installed so far under 2.7.9?
Also, from what I understand, to install under Python3 with pip I would use pip3 install, is that correct? How would I do the same with ones installed with Homebrew? Is there a brew3 command? Or does Homebrew install to all versions of Python?
You do need to reinstall, but I would step away from systemwide installs in general and start using project-specific package installation.
Use pyenv for version switching and virtualenv for isolated environments.
pyvenv works rather well.
Install Python 3
python -m venv "my_virtual_env"
my_virtual_env\Scripts\activate
pip search lib
pip install ...
You will have to look up what the activate command is for osx. pip is the standard package manager now. You can search, install, and uninstall with pip. Pip is also moving towards wheels when installing packages. You probably don't have to worry about wheels too much though.

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