Error in %conda list biopython in jupyter notebook (macOS) - jupyter-notebook

I use jupyter notebook, I have anaconda installed on the system. I get this error when I import Bio
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-de5ff3e63c39> in <module>
----> 1 from Bio import Phylo
2 import wget
3 import re
4 from Bio import SeqIO
5 from Bio.SeqRecord import SeqRecord
ModuleNotFoundError: No module named 'Bio'
and when I look at the packages in this path /Users/morteza/anaconda3/lib/python3.7/site-packages/, bio and biopython are there
Can somebody help me with this?
Thanks

I found a solution so I share here maybe will be useful for someone. I changed the name bio to Bio in the path /Users/morteza/anaconda3/lib/python3.7/site-packages/ using mv bio Bio command then the import worked properly.

Related

ImportError: cannot import name 'pytext_config_from_json' from 'pytext.config.serialize'

I'm trying to fine-tune XLM-R model by following this colab notebook.
While running the following cell in kaggle notebook
from pytext.config.serialize import pytext_config_from_json
I'm getting the error
ImportError: cannot import name 'pytext_config_from_json' from 'pytext.config.serialize' (/opt/conda/lib/python3.7/site-packages/pytext/config/serialize.py)
I have installed pytext by
!pip install --quiet git+https://github.com/facebookresearch/pytext
Thanks
Try
from pytext.config import pytext_config_from_json

Not able to import simpletransformers.ner in python as it says ImportError: cannot import name 'BertweetTokenizer'

I am trying to do bert based NER and trying to import,
from simpletransformers.ner import NERModel, NERArgs
I have installed simpletranformers in pip and when I try to import,
import simpletransformers.ner
it says, ImportError: cannot import name 'BertweetTokenizer'. When I try to install BertweetTokenizer, it throws
ERROR: No matching distribution found for BertweetTokenizer
Not sure, what I am missing. Kindly help

ImportError: cannot import name 'label_map_util'

I'm running on Python 3.6.5 (64bits) trying to run the object_detection_tutorial.
I receive this message when I run the programm :
ImportError: cannot import name 'label_map_util'
Any idea on what I should do ?
Edit : I tried to see whether or not I installed the API and got this :
C:\tensorflow\models-master>python object_detection/protos/label_map_util_test.py
python: can't open file 'object_detection/protos/label_map_util_test.py': [Errno 2] No such file or directory
Try this instead...
from object_detection.utils import label_map_util
Get current dir :
os.getcwd()
change current dir :
os.chdir( '../models/research/object_detection' )
CD to object_detection directory
And you can replace
from utils import label_map_util to
from object_detection.utils import label_map_util
and
from utils import visualization_utils as vis_util to
from object_detection.utils import visualization_utils as vis_util

Error in importing a new python module in knitr

I want to use a python engine in knitr. I have installed a module named undaqTools for python 2.7 using Anaconda3. If I run the following in IPython, it works fine:
from undaqTools import Daq
I tried the same in a python code chunk but that didn't work. I found a relevant question in SO, linked here. So, I first did following in IPython:
import undaqTools
import os
path = os.path.dirname(undaqTools.__file__)
path
Out[5]: 'C:\\Anaconda3\\envs\\py27\\lib\\site-packages\\undaqtools-0.2.3-py2.7.egg\\undaqTools'
Therefore, I created a new chunk in knitr and did following:
```{python}
import sys
sys.path.append('C:/Anaconda3/envs/py27/lib/site-packages/undaqtools-0.2.3-py2.7.egg/')
from undaqTools import Daq
```
But that gives me following error:
Traceback (most recent call last):
File "C:\Users\durraniu\AppData\Local\Temp\RtmpGOOQHX\chunk-code195061e728da.", line 13, in <module>
from undaqTools import Daq
File "C:\Anaconda3\envs\py27\lib\site-packages\undaqtools-0.2.3-py2.7.egg\undaqTools\__init__.py", line 5, in <module>
ImportError: No module named 'daq'
How can I fix this?

Can't import .sage file in same directory

I have Sage files called "a.sage" and "b.sage" in the same directory, and a.sage includes the line "from b import blah". However, when I run "sage a.sage" from the command line, I get "ImportError: No module named b".
I've tried preparsing b.sage and I've tried adding '.' to the end of SAGE_PATH in my .bashrc file. Can't find any more suggestions. I would appreciate someone's help with this, because I'm pulling my hair out!
The issue is that .sage files aren't Python modules.
Traceback (most recent call last):
File "a.sage.py", line 3, in <module>
from b import foo
ImportError: No module named b
If you want to import a module in this way, I think you will need to make a Python module.
$ mv b.sage b.py
$ sage a.sage
hi
However, you'll need to import things from Sage as need be in the Python file, e.g. from sage.all import ZZ.
Extra very useful info from #Dima Pasechnik:
You can do this alternately by doing sage b.sage which generates a Python file b.sage.py which you need to copy to b.py (or even better, create a symlink, i.e. ln -s b.sage.py b.py - you'd only need to do this once). Now import b will work.

Resources