SlideShare a Scribd company logo
and now, for something completely different…
pip & virtualenv
Alex Maneu !
@zouave
@PyBcn 20/03/2014
what is this about?
package management
when you need something
someone else has written
some examples
SciPy
lxml requests
django pymongo
jars gems eggs
(wheels)
where to find them?
PyPI
pypi.python.org
Python Package Index
pip
Recommended tool for
installing uninstalling upgrading
packages from PyPI
pip basic commands
pip install [—-upgrade] <package>
Installs a Python package or upgrades it to the latest
available version.
!
Examples
pip install pymongo=1.2
pip install /some/dir/mypackage.tgz
pip install http://someserver/mypackage.zip
pip install git+ssh://myserver/myrepo.git@feature#egg=MyPackage
!
!
pip uninstall <package>
Deletes an already installed package
pip basic commands
pip list [—-outdated]
Lists installed packages
!
!
pip search <string>
Searches for packages whose description contains the
specified string
> pip list --outdated
amqp (Current: 1.3.3 Latest: 1.4.4)
billiard (Current: 3.3.0.8 Latest: 3.3.0.16)
celery (Current: 3.1.5 Latest: 3.1.9)
…
Examples
> pip search cassandra
cqlengine - Cassandra CQL 3 Object Mapper for Python
CassandraLauncher - Command line utilities for launching Cassandra clusters in EC2
pycassa - Python client library for Apache Cassandra
…
what happens if…?
> pip install pymongo
!
(…)
error: could not create '/Library/Python/
2.7/site-packages/bson': Permission
denied
virtualenv
Tool for creating
Python environments
i s o l a t e d
virtualenv
v1 v2 v3
django
lxml
+
site packages
numpy=1.8.0
pymongo
requests>=2.2.0
site packages
pyOpenSSL, pip, numpy=1.6.2
creating a virtual env
virtualenv [options] <dest_dir>
Create a new virtual environment at the specified
path. It will contain a copy of all system-wide
packages.
!
Useful options
—-no-site-packages
Create a new empty virtual environment.
—-python=<python path>
Use the specified Python executable.
switching to a virtual env
> source <dir>/bin/activate
(v1)>
!
!
Exiting current virtualenv
(v1)> deactivate
>
cool stuff with pip +
virtualenv
!
pip freeze > requirements.txt
Create a description file with the packages and
versions installed under the current virtualenv.
!
pip install -r requirements.txt
Install all packages according to the specification
in requirements.txt.
summary
• Packages: code someone else has written
(SciPy, Django, lxml, pymongo)
• Find packages on PyPI: pypi.python.org
• Install them using pip
• Keep your environment clean by using
virtualenv
Thank you!
questions?

More Related Content

PDF
Cpu Cache and Memory Ordering——并发程序设计入门
PDF
Porting Motif Applications to Qt - Webinar
 
PDF
JSLT: JSON querying and transformation
PDF
SQLAlchemy Primer
PPTX
Php File Operations
PDF
08. handling file streams
PDF
How Prometheus Store the Data
PDF
SOA OSB suite cluster installation
Cpu Cache and Memory Ordering——并发程序设计入门
Porting Motif Applications to Qt - Webinar
 
JSLT: JSON querying and transformation
SQLAlchemy Primer
Php File Operations
08. handling file streams
How Prometheus Store the Data
SOA OSB suite cluster installation

What's hot (20)

PDF
How deep is your buffer – Demystifying buffers and application performance
PDF
Python Class | Python Programming | Python Tutorial | Edureka
PDF
Java Complete Reference Fifth Edition
PPTX
OWASP AppSecCali 2015 - Marshalling Pickles
PDF
Course 102: Lecture 12: Basic Text Handling
PDF
Oracle Database Management Basic 1
PPTX
Java concurrency - Thread pools
PPT
Core java concepts
PDF
Upping the APT hunting game: learn the best YARA practices from Kaspersky
PDF
Intro to Linux Shell Scripting
PDF
Course 102: Lecture 13: Regular Expressions
PDF
Java Deserialization Vulnerabilities - The Forgotten Bug Class
PDF
Introduction to WebSockets Presentation
PPTX
C++ GUI 라이브러리 소개: Qt & Nana
PPTX
Utilizing the OpenNTF Domino API
PPT
Introduction to python
PDF
BKK16-201 Play Ready OPTEE Integration with Secure Video Path lhg-1
PPTX
Zabbix e SNMP - Zabbix Conference LatAm - André Déo
PPT
Python ppt
PDF
Troubleshooting Native Memory Leaks in Java Applications
How deep is your buffer – Demystifying buffers and application performance
Python Class | Python Programming | Python Tutorial | Edureka
Java Complete Reference Fifth Edition
OWASP AppSecCali 2015 - Marshalling Pickles
Course 102: Lecture 12: Basic Text Handling
Oracle Database Management Basic 1
Java concurrency - Thread pools
Core java concepts
Upping the APT hunting game: learn the best YARA practices from Kaspersky
Intro to Linux Shell Scripting
Course 102: Lecture 13: Regular Expressions
Java Deserialization Vulnerabilities - The Forgotten Bug Class
Introduction to WebSockets Presentation
C++ GUI 라이브러리 소개: Qt & Nana
Utilizing the OpenNTF Domino API
Introduction to python
BKK16-201 Play Ready OPTEE Integration with Secure Video Path lhg-1
Zabbix e SNMP - Zabbix Conference LatAm - André Déo
Python ppt
Troubleshooting Native Memory Leaks in Java Applications
Ad

Similar to pip and virtualenv (20)

PDF
Virtualenv
PDF
Pip + virtualenv
PPT
10 11-hart installing pythonsoftware
PDF
Arbeiten mit distribute, pip und virtualenv
PDF
Welcome to the Cheese Shop: setuptools, virtualenv and PyPUG
ODP
Python-specific packaging
PDF
Django district pip, virtualenv, virtualenv wrapper & more
PPT
Python virtualenv & pip in 90 minutes
PDF
Python packaging and dependency resolution
PDF
Django Dev Environment Howto
PDF
Packaging in Python? Don't Roll the Dice.
PDF
Arbeiten mit distribute, pip und virtualenv
PPTX
Supply Chainsaw
PDF
Using the pip package manager for Odoo
PDF
Using the "pip" package manager for Odoo/OpenERP - Opendays 2014
PDF
Effectively using Open Source with conda
PPTX
Pipenv - The Python Companion You Wish You Always Had
PDF
Installing Anaconda Distribution of Python
PDF
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
PDF
Current State of Python Packaging
Virtualenv
Pip + virtualenv
10 11-hart installing pythonsoftware
Arbeiten mit distribute, pip und virtualenv
Welcome to the Cheese Shop: setuptools, virtualenv and PyPUG
Python-specific packaging
Django district pip, virtualenv, virtualenv wrapper & more
Python virtualenv & pip in 90 minutes
Python packaging and dependency resolution
Django Dev Environment Howto
Packaging in Python? Don't Roll the Dice.
Arbeiten mit distribute, pip und virtualenv
Supply Chainsaw
Using the pip package manager for Odoo
Using the "pip" package manager for Odoo/OpenERP - Opendays 2014
Effectively using Open Source with conda
Pipenv - The Python Companion You Wish You Always Had
Installing Anaconda Distribution of Python
Conda: A Cross-Platform Package Manager for Any Binary Distribution (SciPy 2014)
Current State of Python Packaging
Ad

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Encapsulation theory and applications.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
1. Introduction to Computer Programming.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
cuic standard and advanced reporting.pdf
Approach and Philosophy of On baking technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectroscopy.pptx food analysis technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
NewMind AI Weekly Chronicles - August'25-Week II
Advanced methodologies resolving dimensionality complications for autism neur...
Encapsulation theory and applications.pdf
A Presentation on Artificial Intelligence
Mobile App Security Testing_ A Comprehensive Guide.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Machine learning based COVID-19 study performance prediction
Assigned Numbers - 2025 - Bluetooth® Document
1. Introduction to Computer Programming.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Encapsulation_ Review paper, used for researhc scholars
cuic standard and advanced reporting.pdf

pip and virtualenv

  • 1. and now, for something completely different…
  • 2. pip & virtualenv Alex Maneu ! @zouave @PyBcn 20/03/2014
  • 3. what is this about? package management when you need something someone else has written
  • 6. where to find them? PyPI pypi.python.org Python Package Index
  • 7. pip Recommended tool for installing uninstalling upgrading packages from PyPI
  • 8. pip basic commands pip install [—-upgrade] <package> Installs a Python package or upgrades it to the latest available version. ! Examples pip install pymongo=1.2 pip install /some/dir/mypackage.tgz pip install http://someserver/mypackage.zip pip install git+ssh://myserver/myrepo.git@feature#egg=MyPackage ! ! pip uninstall <package> Deletes an already installed package
  • 9. pip basic commands pip list [—-outdated] Lists installed packages ! ! pip search <string> Searches for packages whose description contains the specified string > pip list --outdated amqp (Current: 1.3.3 Latest: 1.4.4) billiard (Current: 3.3.0.8 Latest: 3.3.0.16) celery (Current: 3.1.5 Latest: 3.1.9) … Examples > pip search cassandra cqlengine - Cassandra CQL 3 Object Mapper for Python CassandraLauncher - Command line utilities for launching Cassandra clusters in EC2 pycassa - Python client library for Apache Cassandra …
  • 10. what happens if…? > pip install pymongo ! (…) error: could not create '/Library/Python/ 2.7/site-packages/bson': Permission denied
  • 11. virtualenv Tool for creating Python environments i s o l a t e d
  • 12. virtualenv v1 v2 v3 django lxml + site packages numpy=1.8.0 pymongo requests>=2.2.0 site packages pyOpenSSL, pip, numpy=1.6.2
  • 13. creating a virtual env virtualenv [options] <dest_dir> Create a new virtual environment at the specified path. It will contain a copy of all system-wide packages. ! Useful options —-no-site-packages Create a new empty virtual environment. —-python=<python path> Use the specified Python executable.
  • 14. switching to a virtual env > source <dir>/bin/activate (v1)> ! ! Exiting current virtualenv (v1)> deactivate >
  • 15. cool stuff with pip + virtualenv ! pip freeze > requirements.txt Create a description file with the packages and versions installed under the current virtualenv. ! pip install -r requirements.txt Install all packages according to the specification in requirements.txt.
  • 16. summary • Packages: code someone else has written (SciPy, Django, lxml, pymongo) • Find packages on PyPI: pypi.python.org • Install them using pip • Keep your environment clean by using virtualenv