📗
Essential Python For Genome Science
  • Before Start
  • Chapter Contents
  • Prerequisites
    • About the UNIX system
    • About python
  • UNDERSTAND RAW DATA
    • Stages of Genome Data Generation
    • From Bulk To Single Cell
    • Introduction To the Datasets
      • bulk RNA-seq
      • single-cell data
  • Work Environment
    • Chapter Ensemble
    • All About Installations
    • Keep Running
    • Coding Environment
    • Git and Github
    • Other Tips
  • Python and UNIX System
    • Run Python
    • File I/O
    • Run Shell Command In Python - I
    • 🎉Case Study: Mapping bulk RNA-seq reads with salmon
  • Data Cleaning
    • 🎉Key Concept of Pandas
    • 🎉Case Study: Aggregate Salmon Quant
    • Case Study: Exploring The Dataset 🚩
    • The "copy" and "inplace" Parameter 🚩
    • Case Study: Extract and Reformat GTF file 🚩
    • the correct vs. the wrong way of using pandas 🚩
    • Case Study: Bulk Sample PCA 🚩
  • PYTHON BASICS
    • Python can be lightning-fast ⚡️ 🚩
    • Run Shell Command In Python - II 🚩
    • Pointers In Python 🚩
    • Everything is an object 🚩
    • Thread and Process 🚩
    • Resource For Intermediate Python Knowledge 🚩
    • Python magic method 🚩
  • Genome Science Data
    • NGS Data Formats and Tools 🚩
      • SAM/BAM 🚩
      • BED 🚩
      • GTF 🚩
      • Bigwig / Bigbed 🚩
      • VCF / BCF 🚩
    • The Python Packages 🚩
  • Data visualization
    • Matplotlib Basics 🚩
    • Seaborn Basics 🚩
    • Interactive Data Visualization 🚩
  • Use R in Python
    • Why? 🚩
    • rpy2 🚩
  • Gotchas
    • Check whether package X is installed
    • BAM to FASTQ
    • Genomic Websites
Powered by GitBook
On this page
  • Method 1: In the shell
  • Method 2: In Jupyter Notebook

Was this helpful?

  1. Gotchas

Check whether package X is installed

Previousrpy2 🚩NextBAM to FASTQ

Last updated 5 years ago

Was this helpful?

Method 1: In the shell

If you are using as I introduced, all your third-party python packages are installed under the environment directory. And the python interpreter (i.e. the python command) already know where they locates, and allow you to import them, just like other built-in python packages.

To check this, just use python interpreter in the shell

# go into the environment

# hq @ Hanqings-iMac in ~ [19:58:58]
$ conda activate genome_book
(genome_book)


# you should see you are using the python interpreter
# from your environment directory

# hq @ Hanqings-iMac in ~ [19:59:14]
$ which python
/Users/hq/miniconda3/envs/genome_book/bin/python
(genome_book)


# Now start the python interpreter

# hq @ Hanqings-iMac in ~ [19:59:21]
$ python
Python 3.7.6 | packaged by conda-forge | (default, Mar 23 2020, 22:45:16)
[Clang 9.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.


>>> import pandas as pd  # import package X, pd is just a temporary alias for pandas, you can name it whatever you want
>>> pd.__version__  # the above command already confirmed pandas is installed. But this command tell you the exact version
'1.0.3'

Method 2: In Jupyter Notebook

I explained how to start Jupyter Notebook server under the genome_book environment.

If you can go into Jupyter, check out . (It's in the GitHub Repo as well)

the environment
this Jupyter Notebook
Here