Installing biopython for python2 - linux

I have python 2 and 3 installed and need to run a script written for python 2. Said script needs biopython. So, how do I install biopython such that it's available specifically for python 2? (Linux environment btw). Thanks!

Related

Installing Python 2.7 projects in a system with Python 3.10

I've come to a delicate situation:
My company's projects are all based in Python 2.7 and use specific PATH and PYTHONPATH exports to get around each other. The new machine I received has Ubuntu 22.04 and Python 3.10 preinstalled. My previous used to have Python 2.7 and I just installed 3.x on top and it worked just fine, at the beginning. I ended up messing up all the version altogether and everything seemed broken. So now I'm cautious on how to proceed
I've watched numerous tutorials online about setting up a virtual environment and how 'easy' it is to work with multiple version but seems that don't do the trick.
I would like to set up a virtual environment in Python 2.7 where I can just
python setup.py install ....
with all my packages and install them using python 2.7
At the same time, I'd like Python 3 to be available (because I'm futurizing some of these projects) to also install them using Python 3:
python3 setup.py install ...
What is the best strategy to implement this on my machine? Python 2 looks like it's not installed at all. Should I just install it on top of 3.10 ?

autopep8 not found in cygwin

If I try to use autopep8 in cygwin (64bit, WIndows10) i get the message "command not found".
$ autopep8
-bash: autopep8: command not found
I tried pip install autopep8 but pip is also not found, only pip2 and pip3.
If I use python -m pip install autopep8 it works so I can call
python -m autopep8
but I want to run a script where just autopep8 is called:
if ! type -p autopep8 >/dev/null; then
echo "autopep8 not found" >&2
autopep8() {
Any ideas how to solve this?
First, you must install PyPi packages to the correct Python installation, and second, you must install the same package to every Python installation in which you want to use it.
Now, a special note about installing Python on Cygwin. You have a choice of several Python versions to install, and scores of packages for use with each of those versions. Avoid Python version 2 unless you have a clearly define reason, as it is post End-of-Life. Instead, install one of the versions of Python 3. As of today, version 3.6 and 3.7 have the more complete sets of optional packages. Version 3.8 beta 4 is available.
For a my install of Python 3.8, I used the Cygwin setup app to install these packages: Python38 (Py3K language interpreter), Python38-pip (Python package installation tool), Python38-setuptools (Python package management tool), Python38-virtualenv (Creates isolated Python environments), and Python38-wheel (Python package format module). To write X11 GUI apps, add Python38-tkinter (Py3K Tkinter GUI module). To install binary packages, add Python38-devel (Py3K language interpreter).
You will be able to install pure Python packages from PyPI. To install binary packages you will also need to have the GNU compiler tool chain installed, and you will need to handle dependencies with other Cygwin packages on your own.
The Python 3.6 and 3.7 installations have addition packages which, in many cases, contain binary packages with the above mentioned dependencies already resolved, or have some useful customizations for the Cygwin environment.
Cygwin has both Python 2 and Python 3. As of today, after installation, you execute Python 2 by python and Python 3 by python3. Be careful which Python you execute as you may get a windows version of Python, if installed, and in your path. which python will always tell where the executable lives, and python -V, etc., will tell you which version you are running. Generally, you want to run a Cygwin version of Python from the bash prompt and Windows versions of Python only from the command prompt or windows GUI.
The safest way to use pip is to use the module version for the Python executable you have chosen, i.e., python -m pip, etc. This avoids having to also remember to use pip with Python and pip3 with Python3.

Nosetests execution with different Python versions?

I'm having trouble with Python 2.7 & 3.5. Right now I use GIT to acquire repositories and their python folders all have 2.7 syntax.
The problem: When i'm attempting to Automate using repositories, my .local/bin nosetests first line of code shows:
#!/usr/bin/python3
so, it checks for
.local/lib/Python3.5/site-packages/nose
Nowhere to be found is a Python 2.7 folder with similar directories to Python 3.5.
So I will always get a syntax error, as its checking my repositories Python coding, and since they are not Python3 syntax, it will give me errors. I checked using command
python -v
python3 -V
and indeed have 2.7 and 3.5 installed.
So I just need guidance/help on how to just gain Python 2.7 site packages with nosetests, so I can automate correctly using the same version as the repositories python. If I left out anything, I will try my best to fill in the gaps/add more details. I will of course troubleshoot.
Nowhere to be found is a Python 2.7 folder with similar directories to Python 3.5.
First, uninstall nosetests for python 3 with pip3 uninstall nose.
Then install nosetests for 2.7 with pip2.7 install nose.
After you do this, the default nosetests should be for python 2.7.
You may want to look into the default python for your project to python2.7 by using virtualenv.

How to configure atom to use python 3.x ide?

I am using Linux (solus Linux). I installed atom and need to know what package to install to use python 3.x.I have tried one of the package but it works with python 2.7
adding a code
!# /usr/bin/python3
at the top of my script helped me.
Also install scripts and configure it to use python3 instead

Installing python 3 into venv?

I wish to develop and deploy python 3 codes, along with python 3 modules to OSX Yosemite and CentOS 7, both come with python 2 preinstalled.
I had installed python modules via pip and got the idea around developing with python 3 on Fedora 21, but I am not sure what's the best way to do this with OSX and CentOS.
I am aware that we can install python modules into a venv environment to keep it isolated from the system. Is it possible to have the whole python 3 environment isolated in venv and deploy that on CentOS/OSX? I have experimented this approach with Docker, but am feeling this is too much of a sledgehammer approach.
Is there a standard python way to develop python 3 code on primarily python 2 OS like OSX and CentOS without populating what's already on the system?
sunnz,
$ virtualenv venv_name --python=python3
Btw, if you install python3 directly in your system (OSX or CentOS) nothing bad will happen.

Resources