How to import python packages?

I am new to Python and should use a python-based tool called the chromosome that imports some python packages, including bioformats. Bioformats has many modules, including a bed. When starting the chromosome, I get an error message:

smeeta:~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import chromosomer
>>> from chromosomer.cli import bioformats
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/chromosomer/cli.py", line 8, in <module>
    import bioformats.bed
ImportError: No module named bed
>>> import bioformats
>>> import bioformats.bed
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named bed
>>> 

How to install a batch chromosome and its dependent packages?

+4
source share
3 answers

Use pip

eg.

#>pip install <desired package>
#>pip install chromosomer

Official pipdocumentation link .

For Python 2.7.9+ and 3.4+ It must be pre-installed withpip

Python 2 ≤ 2.7.8 Python 3 ≤ 3.3 : https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip

: Python /?

+3

, python pip, Python.

:

pip install python-bioformats
+1

, , /.

Python - pip.

1. pip:

sudo apt-get install python-pip  # for Debian/Ubuntu
sudo yum -y install python-pip  # for CentOS/RHEL

: Python 2.7.9+ 3.4+ pip .


2. python:

sudo pip install chromosomer

It will install packages bioinformats, future, pyfaidx, PyVCF, sixas dependencies. Note : no need sudoif already a user root, or using vitualenv.

Verification - you can verify the installation using the command pip freeze:

(venv_bioinformatics)[nahmed@localhost virtualenvs]$ pip freeze
bioformats==0.1.14
chromosomer==0.1.3
future==0.16.0
pyfaidx==0.4.8.1
PyVCF==0.6.8
six==1.10.0
wheel==0.24.0

Test . I installed the chromosomer and imported, it worked fine:

(venv_bioinformatics)[nahmed@localhost virtualenvs]$ python 
Python 2.7.5 (default, Sep 15 2016, 22:37:39) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from chromosomer.cli import chromosomer
>>> 
0
source

Source: https://habr.com/ru/post/1664086/


All Articles