Global-Biofoundries-Alliance/SynBioPython

No module named synbiopython.genbabel found when importing synbiopython on Colab Notebook

eyesmo opened this issue · 6 comments

Hi, I'm trying to learn to use SynBioPython with Google Colab python notebooks. I'm able to pip install synbiopython and import synbiopython with Colab notebooks, but when I try to import synbiopython.genbabel as stdgen, it throws this error:
Screen Shot 2021-03-14 at 11 55 33 AM

Zulko commented

It seems that the PyPI version is very outdated unfortunately. Does it work if you use the Github version instead?

pip install --user git+https://github.com/Global-Biofoundries-Alliance/SynBioPython

Still doesn't work, but it does provide more info about what might be going wrong:
Screen Shot 2021-03-14 at 1 49 21 PM

Zulko commented

Hmm. Not sure what's wrong here, the github install works for me locally. Looks like there is a some Jupyter requirement that clashes with what Google Collab allows.

I'm continuing to have issues, even with a local Jupyter Notebook.
If I try

!pip3 install --user git+https://github.com/Global-Biofoundries-Alliance/SynBioPython
import synbiopython
import synbiopython.genbabel as stdgen
print(synbiopython.__version__)

Here's the output I get:

Collecting git+https://github.com/Global-Biofoundries-Alliance/SynBioPython
  Cloning https://github.com/Global-Biofoundries-Alliance/SynBioPython to /private/var/folders/hw/6j9xcdd57nd0_t2gmtsgzt8r0000gp/T/pip-req-build-hyik2f0t
  Running command git clone -q https://github.com/Global-Biofoundries-Alliance/SynBioPython /private/var/folders/hw/6j9xcdd57nd0_t2gmtsgzt8r0000gp/T/pip-req-build-hyik2f0t
Requirement already satisfied: pandas>=0.22 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from synbiopython==0.0.1) (0.25.1)
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from synbiopython==0.0.1) (1.17.2)
Requirement already satisfied: dnaplotlib in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from synbiopython==0.0.1) (1.0)
Requirement already satisfied: biopython in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from synbiopython==0.0.1) (1.76)
Requirement already satisfied: reportlab in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from synbiopython==0.0.1) (3.5.65)
Requirement already satisfied: tesbml in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from synbiopython==0.0.1) (5.18.1.1)
Requirement already satisfied: nbgitpuller in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from synbiopython==0.0.1) (0.9.0)
Requirement already satisfied: python-dateutil>=2.6.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from pandas>=0.22->synbiopython==0.0.1) (2.8.0)
Requirement already satisfied: pytz>=2017.2 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from pandas>=0.22->synbiopython==0.0.1) (2019.3)
Requirement already satisfied: six>=1.5 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from python-dateutil>=2.6.1->pandas>=0.22->synbiopython==0.0.1) (1.12.0)
Requirement already satisfied: notebook>=5.5.0 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbgitpuller->synbiopython==0.0.1) (6.2.0)
Requirement already satisfied: tornado in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbgitpuller->synbiopython==0.0.1) (6.1)
Requirement already satisfied: Send2Trash>=1.5.0 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (1.5.0)
Requirement already satisfied: traitlets>=4.2.1 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (5.0.5)
Requirement already satisfied: jupyter-client>=5.3.4 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (6.1.12)
Requirement already satisfied: jupyter-core>=4.6.1 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (4.7.1)
Requirement already satisfied: jinja2 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (2.11.2)
Requirement already satisfied: ipykernel in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (5.5.0)
Requirement already satisfied: terminado>=0.8.3 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.9.3)
Requirement already satisfied: argon2-cffi in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (20.1.0)
Requirement already satisfied: prometheus-client in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.9.0)
Requirement already satisfied: pyzmq>=17 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (22.0.3)
Requirement already satisfied: nbconvert in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (6.0.7)
Requirement already satisfied: ipython-genutils in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.2.0)
Requirement already satisfied: nbformat in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (5.1.2)
Requirement already satisfied: ptyprocess in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from terminado>=0.8.3->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.7.0)
Requirement already satisfied: cffi>=1.0.0 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from argon2-cffi->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (1.14.5)
Requirement already satisfied: pycparser in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (2.20)
Requirement already satisfied: appnope in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.1.2)
Requirement already satisfied: ipython>=5.0.0 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (7.21.0)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from ipython>=5.0.0->ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (3.0.17)
Requirement already satisfied: jedi>=0.16 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from ipython>=5.0.0->ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.18.0)
Requirement already satisfied: pygments in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from ipython>=5.0.0->ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (2.8.1)
Requirement already satisfied: pexpect>4.3 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from ipython>=5.0.0->ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (4.8.0)
Requirement already satisfied: backcall in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from ipython>=5.0.0->ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.2.0)
Requirement already satisfied: pickleshare in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from ipython>=5.0.0->ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.7.5)
Requirement already satisfied: decorator in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from ipython>=5.0.0->ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (4.4.2)
Requirement already satisfied: setuptools>=18.5 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from ipython>=5.0.0->ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (41.2.0)
Requirement already satisfied: parso<0.9.0,>=0.8.0 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from jedi>=0.16->ipython>=5.0.0->ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.8.1)
Requirement already satisfied: wcwidth in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=5.0.0->ipykernel->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.2.5)
Requirement already satisfied: MarkupSafe>=0.23 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from jinja2->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (1.1.1)
Requirement already satisfied: defusedxml in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.7.1)
Requirement already satisfied: jupyterlab-pygments in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.1.2)
Requirement already satisfied: entrypoints>=0.2.2 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.3)
Requirement already satisfied: bleach in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (3.3.0)
Requirement already satisfied: pandocfilters>=1.4.1 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (1.4.3)
Requirement already satisfied: testpath in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.4.4)
Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.5.3)
Requirement already satisfied: mistune<2,>=0.8.1 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.8.4)
Requirement already satisfied: async-generator in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (1.10)
Requirement already satisfied: nest-asyncio in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (1.5.1)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from nbformat->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (3.1.1)
Requirement already satisfied: importlib-metadata in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.23)
Requirement already satisfied: attrs>=17.4.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (19.3.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.15.4)
Requirement already satisfied: webencodings in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from bleach->nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.5.1)
Requirement already satisfied: packaging in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from bleach->nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (20.9)
Requirement already satisfied: zipp>=0.5 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from importlib-metadata->jsonschema!=2.5.0,>=2.4->nbformat->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (0.6.0)
Requirement already satisfied: more-itertools in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from zipp>=0.5->importlib-metadata->jsonschema!=2.5.0,>=2.4->nbformat->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (7.2.0)
Requirement already satisfied: pyparsing>=2.0.2 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from packaging->bleach->nbconvert->notebook>=5.5.0->nbgitpuller->synbiopython==0.0.1) (2.4.7)
Requirement already satisfied: pillow>=4.0.0 in /Users/isaac/Library/Python/3.8/lib/python/site-packages (from reportlab->synbiopython==0.0.1) (8.1.2)
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-31-de19b3a42358> in <module>()
      3 
      4 
----> 5 import synbiopython
      6 import synbiopython.genbabel as stdgen
      7 print(synbiopython.__version__)

ImportError: No module named synbiopython

And here's what happens when I try with pip instead of pip3:

!pip install --user git+https://github.com/Global-Biofoundries-Alliance/SynBioPython
import synbiopython
print(synbiopython.__version__)

Output:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting git+https://github.com/Global-Biofoundries-Alliance/SynBioPython
  Cloning https://github.com/Global-Biofoundries-Alliance/SynBioPython to /private/var/folders/hw/6j9xcdd57nd0_t2gmtsgzt8r0000gp/T/pip-req-build-pupqaS
ERROR: Package 'synbiopython' requires a different Python: 2.7.15 not in '>=3.6'
WARNING: You are using pip version 20.3.3; however, version 20.3.4 is available.
You should consider upgrading via the '/Users/isaac/anaconda/bin/python -m pip install --upgrade pip' command.
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-30-4ddc79921afe> in <module>()
      1 get_ipython().system(u'pip install --user git+https://github.com/Global-Biofoundries-Alliance/SynBioPython')
----> 2 import synbiopython
      3 print(synbiopython.__version__)

ImportError: No module named synbiopython
veghp commented

Hi, I also had a look into this now; tellurium was missing from the setup requirements, so it needs to be installed separately. (At the time of publishing this package, there was a small bug in the PyPI version of tellurium so it was included in requirements.txt only). @JingWui and I will look into this and also publish the current version on PyPI.

Google colab works for me the following way:

!pip install tellurium
!pip install git+https://github.com/Global-Biofoundries-Alliance/SynBioPython
import synbiopython
import synbiopython.genbabel as stdgen
print(synbiopython.__version__)

Just in case there is still any problem, I recommend running each line in separate cells, so you can see the output for each. I have not tried with the --user option.

As for running locally, the error is different. It is at the import synbiopython line, therefore the package wasn't installed in the Python that is running in the notebook. I see you are using conda, so perhaps try running pip install git+https://github.com/Global-Biofoundries-Alliance/SynBioPython then pip install tellurium from the command line, in the environment that you use for the notebook (this environment must use Python3). When you use conda, there is no need for the --user option. Either this was the problem or !pip3 called the system Python as it looks from the output.

As for the difference in the output with pip and pip3: pip installs into Python2 and pip3 into Python3.

veghp commented

I uploaded the new release to PyPI so pip install --upgrade synbiopython should work too.