doesn't work with Bio either.
Even after adding to path of system variables: C:\Users\Tania\.conda\envs\models\Lib\site-packages
Is something missing?
I'm working on windows. I think I installed biopython with pip in a specific conda environment. Cause with:
conda activate models
pip install biopython
says:
Requirement already satisfied: biopython in c:\users\tania\.conda\envs\models\lib\site-packages (1.74)
Requirement already satisfied: numpy in c:\users\tania\appdata\roaming\python\python35\site-packages (from biopython) (1.16.3)
However when running in pycharm:
import biopython
Gives the error:
ImportError: No module named 'biopython'
I'm sure it's installed in correct env cause I've installed other python modules there and they worked. Tried to add variable to user path as explained here: https://www.opentechguides.com/how-to/article/windows-10/113/windows-10-set-path.html but it still doesn't work.
1 answer
I don't think it's import biopython, it's import Bio.
Can you do the following experiments and see where things break:
- Open python within the
modelsconda env, then runimport Bioto see if that works - If 1 works, try running python outside the conda env, and then
import Bio. - If 2 works, then try
import Biofrom within PyCharm.
The above steps will tell you if it's python that's unable to see the module location or if PyCharm's the one acting funny. Step-1 confirms that you do have a working installation of biopython. Also, from each, print sys.path to see if the directory you added shows up in the PATH variable.
Fails at step 1:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'Bio'
>>> print(sys.path)
['', 'C:\\Users\\Tania\\.conda\\envs\\models\\python35.zip', 'C:\\Users\\Tania\\.conda\\envs\\models\\DLLs', 'C:\\Users\\Tania\\.conda\\envs\\models\\lib', 'C:\\Users\\Tania\\.conda\\envs\\models', 'C:\\Users\\Tania\\AppData\\Roaming\\Python\\Python35\\site-packages', 'C:\\Users\\Tania\\.conda\\envs\\models\\lib\\site-packages']
Is biopython listen as one of the installed packages when you run conda list -n models (before activating the environment)?
python and conda use virtual environments so you can make and throw away changes easily, but this flexibility comes at the cost of simplicity. Simply checking the PATH variable is not enough; if you know you installed it and the path is what it is, then it must not have been installed to the right virtual environment.
Log in to answer this question.