FYI: this is NOT a duplicate!
Before running my python code I installed biopython in the cmd prompt:
pip install biopython
I then get an error saying 'No module named Bio' when try to import it in python
import Bio
The same thing happens with
import biopython
It should be noted I have updated PIP and run python 3.5.2
I appreciate anyone's help.
3. Confirm that Biopython has been correctly installed by starting a Python terminal session and entering this line: import Bio If you do not receive an error message, then Biopython has been properly installed!
Basically, Biopython is a collection of python modules that provide functions to deal with DNA, RNA & protein sequence operations such as reverse complementing of a DNA string, finding motifs in protein sequences, etc.
Install Anaconda Navigator, go to " Environments " and select the appropriate environment (base or your own) and click " not installed ". Scroll down to biopython click the box and then install...
use this:
pip3 install biopython
and then import Bio
worked for me
When I came across this problem I noticed that after I installed biopython using pip install biopython the module directory in the site-packages folder was written with lowercase instead of uppercase letters. All in all, the folder was named bio instead Bio, so I just renamed the folder and everything started to work just fine. I am new to programing so I am aware this isn't the most elegant solution but it worked for me so I hope my answer will be useful to some of you. :)
I just hit this issue with the problem being lower-case bio vs upper-case Bio. Turns out the problem was that it installs differently on python 2 and 3. In Python 2 you do import Bio
, but in python 3 import bio
. If you're hitting this issue it might be for the same reason, and the solution is probably to make sure you use the right name for the Python version you're on.
pip3
❌ didn't fully work for me as there was a problem with importing a function.
conda install biopython
✔️ worked for me.
Rename the site-package name from bio into Bio
C:\Users\user\Anaconda3\Lib\site-packages\bio
C:\Users\user\Anaconda3\Lib\site-packages\Bio
it works for me!
On windows it installs the bio package in a top level directory named bio with lower case b. To fix the problem rename the directory to upper case b, Bio.
Obviously the biopython people don't pay much attention to the win
As stated by others Biopython appears to work only with python 3.5. In my current environment I had python 2.7, so creating a Conda environment with python 3.5 solved the problem for me.
conda create -n mypython3.5 python=3.5
Then activate the environment:
conda activate mypython3.5
And installing Biopython on it:
conda install -c conda-forge biopython
In my case I also had to install Prodigal in the new environment to run my script:
conda install -c bioconda prodigal
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With