ImportError when importing from Bio.PDB - biopython

I want to use Biopython's PDBParser to download PDB files, but this error appears when I try to import it:
Traceback (most recent call last):File "C:\Python27\TAREA 3 FINAL.PY", line 33, in [HTML] from Bio.PDB import * File "C:\Python27\lib\site-packages\Bio\PDB_init_.py", line 15, in [HTML] from PDBParser import PDBParser File "C:\Python27\lib\site-packages\Bio\PDB\PDBParser.py", line 13, in [HTML] import numpy ImportError: No module named numpy
What's going on here?

Biopython requires the numpy module. You need to install numpy in order to use Biopython. You can find the latest version here.

Related

SyntaxError: future feature annotations is not defined for dockerize

Im trying to dockerize my project, but ran into the following error, not sure what is the error about.
Traceback (most recent call last):
File "server/main.py", line 5, in
from fastai.vision.all import *
File "/usr/local/lib/python3.6/site-packages/fastai/vision/all.py", line 1, in from . import models
File "/usr/local/lib/python3.6/site-packages/fastai/vision/models/init.py", line 1, in
from . import xresnet
File "/usr/local/lib/python3.6/site-packages/fastai/vision/models/xresnet.py", line 12, in
from ...torch_basics import *
File "/usr/local/lib/python3.6/site-packages/fastai/torch_basics.py", line 9, in
from .imports import *
File "/usr/local/lib/python3.6/site-packages/fastai/imports.py", line 30, in
from fastcore.all import *
File "/usr/local/lib/python3.6/site-packages/fastcore/all.py", line 3, in
from .dispatch import *
File "/usr/local/lib/python3.6/site-packages/fastcore/dispatch.py", line 4
from future import annotations
^
SyntaxError: future feature annotations is not defined
Im doing this on VSCode
Managed to trouble shoot the problem and resolved it.
For python version issue
Dockerfile to change python version from 3.6 to 3.10
for the various requirement issue
update requirement.txt to latest versions as prompted by the terminal as you run the dockerize process in the terminal.
hope this helps for all future people who encounters the same problem

Ray cluster ModuleNotFoundError

I am new to Ray and wanted to set up a cluster with some dependencies. I first set up a cluster with some dependencies supported out of the box and everything worked fine. Now, I have the following scenario that I simplified to this demonstration. There is a problem with joblib even though I specify it in a runtime env as to be downloaded with pip and then pass it to ray.init.
from ray.util.joblib import register_ray
import joblib
import ray
import numpy as np
# connect to ray
runtime_env={"pip": ["joblib"]}
ray.init(address='auto', _redis_password=..., runtime_env=runtime_env)
#ray.remote(num_cpus=1)
def train_ray(...):
...
register_ray()
with joblib.parallel_backend('ray'):
...
return ...
I get the following error:
from ray.util.joblib import register_ray
File "/home/ray/anaconda3/lib/python3.7/site-packages/ray/util/joblib/__init__.py", line 1, in <module>
from joblib.parallel import register_parallel_backend
ModuleNotFoundError: No module named 'joblib'
command terminated with exit code 1
Thanks for any suggestions.

ImportError during python run

Currently I am executing doamusic python codes from
https://github.com/yump/doamusic.git
I am using python 3.7.2. (Python IDLE) on windows.
My directory tree is
F:\doamusic_project\doamusic\music.py
when I run music.py, I am getting the following error
Traceback (most recent call last):
File "F:\doamusic_project\doamusic\music.py", line 31, in
from . import util
File "..\doamusic__init__.py", line 1, in
from doamusic.music import *
File "..\doamusic\music.py", line 32, in
from . import _music
ImportError: cannot import name '_music' from 'doamusic' (..\doamusic__init__.py)
What is the reason for not importing _music ?.
You are trying to do an import from .pyx file. A .pyx file must be compiled unlike a .py file.
Try to do that before the import of _music:
import pyximport
pyximport.install()
More info Cython

Jython: where is itertools?

In Jython 2.5.3, trying to import itertools:
>>> from itertools import product
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name product
Yet if you see this page from Jython docs itertools looks a core part of Jython since 2.3.
What do I need on the syspath to import iterools?
itertools.product is not available in Jython 2.5. The function was added in CPython 2.6, and is available in Jython 2.7.
See also https://wiki.python.org/jython/JythonFaq/GeneralInfo#Is_Jython_the_same_language_as_Python.3F.

How to solve CUDA PATH Error?

I recently installed NVIDIA CUDA and test run a code :
from numba import cuda
from numba import *
import numpy as np
from pylab import imshow, show
from timeit import default_timer as timer
But I got this error in ubuntu 16.0.4. How can I resolve this error:
#cuda.jit(argtypes=[f8, f8, f8, f8, uint8[:,:], uint32])
File "/usr/local/lib/python2.7/dist-packages/numba/cuda/decorators.py", line 92, in kernel_jit
kernel.bind()
File "/usr/local/lib/python2.7/dist-packages/numba/cuda/compiler.py", line 489, in bind
self._func.get()
File "/usr/local/lib/python2.7/dist-packages/numba/cuda/compiler.py", line 366, in get
cuctx = get_context()
File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/devices.py", line 194, in get_context
return _runtime.get_or_create_context(devnum)
File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/devices.py", line 162, in get_or_create_context
return self.push_context(self.gpus[devnum])
File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/devices.py", line 40, in __getitem__
return self.lst[devnum]
File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/devices.py", line 26, in __getattr__
numdev = driver.get_device_count()
File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/driver.py", line 307, in get_device_count
self.cuDeviceGetCount(byref(count))
File "/usr/local/lib/python2.7/dist-packages/numba/cuda/cudadrv/driver.py", line 248, in __getattr__
self.initialization_error)
CudaSupportError: Error at driver init:
CUDA driver library cannot be found.
If you are sure that a CUDA driver is installed,
try setting environment variable NUMBA_CUDA_DRIVER
with the file path of the CUDA driver shared library.
Try to introduce following variables
export NUMBAPRO_NVVM=/home/cuda-7.5/nvvm/lib64/libnvvm.so
export NUMBAPRO_LIBDEVICE=/home/cuda-7.5/nvvm/libdevice/
in your .bashrc file which is usually located in home/username/
In your case the paths above should be corrected in accordance to your cuda installation paths. Note, that even if you use just umba, not numbapro the names of the variables should be as shown above.

Resources