SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
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?

Contenu connexe

Tendances

Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGeoff Hoffman
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewRueful Robin
 
Tcache Exploitation
Tcache ExploitationTcache Exploitation
Tcache ExploitationAngel Boy
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitLukas Fittl
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitColin Su
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsCarl Brown
 

Tendances (20)

Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Git & Github for beginners
Git & Github for beginnersGit & Github for beginners
Git & Github for beginners
 
Git basic
Git basicGit basic
Git basic
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Tcache Exploitation
Tcache ExploitationTcache Exploitation
Tcache Exploitation
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git 101
Git 101Git 101
Git 101
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
 
Introduction git
Introduction gitIntroduction git
Introduction git
 

Similaire à pip and virtualenv

Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Codemotion
 
Virtualenv
VirtualenvVirtualenv
VirtualenvWEBdeBS
 
Django district pip, virtualenv, virtualenv wrapper & more
Django district  pip, virtualenv, virtualenv wrapper & moreDjango district  pip, virtualenv, virtualenv wrapper & more
Django district pip, virtualenv, virtualenv wrapper & moreJacqueline Kazil
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvMarkus Zapke-Gründemann
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvMarkus Zapke-Gründemann
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesLarry Cai
 
5 minute intro to virtualenv
5 minute intro to virtualenv5 minute intro to virtualenv
5 minute intro to virtualenvamenasse
 
Python packaging and dependency resolution
Python packaging and dependency resolutionPython packaging and dependency resolution
Python packaging and dependency resolutionTatiana Al-Chueyr
 
Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Ivan Chernoff
 
Docker for data science
Docker for data scienceDocker for data science
Docker for data scienceCalvin Giles
 
Jenkins and Docker for native Linux packages
Jenkins and Docker for native Linux packagesJenkins and Docker for native Linux packages
Jenkins and Docker for native Linux packagesDaniel Paulus
 
First python project
First python projectFirst python project
First python projectNeetu Jain
 
Package Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π SupercomputerPackage Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π SupercomputerJianwen Wei
 
How to create a basic website with Python on Django
How to create a basic website with Python on DjangoHow to create a basic website with Python on Django
How to create a basic website with Python on DjangoArmağan Ersöz
 
Pip + virtualenv
Pip + virtualenvPip + virtualenv
Pip + virtualenvDaryl Yu
 
Using the pip package manager for Odoo
Using the pip package manager for OdooUsing the pip package manager for Odoo
Using the pip package manager for OdooOdoo
 

Similaire à pip and virtualenv (20)

Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
Christian Strappazzon - Presentazione Python Milano - Codemotion Milano 2017
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 
Django district pip, virtualenv, virtualenv wrapper & more
Django district  pip, virtualenv, virtualenv wrapper & moreDjango district  pip, virtualenv, virtualenv wrapper & more
Django district pip, virtualenv, virtualenv wrapper & more
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
Arbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenvArbeiten mit distribute, pip und virtualenv
Arbeiten mit distribute, pip und virtualenv
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
5 minute intro to virtualenv
5 minute intro to virtualenv5 minute intro to virtualenv
5 minute intro to virtualenv
 
Python packaging and dependency resolution
Python packaging and dependency resolutionPython packaging and dependency resolution
Python packaging and dependency resolution
 
Python environments
Python environmentsPython environments
Python environments
 
Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!Pipfile, pipenv, pip… what?!
Pipfile, pipenv, pip… what?!
 
Virtualenv
VirtualenvVirtualenv
Virtualenv
 
Python setup
Python setupPython setup
Python setup
 
Python+gradle
Python+gradlePython+gradle
Python+gradle
 
Docker for data science
Docker for data scienceDocker for data science
Docker for data science
 
Jenkins and Docker for native Linux packages
Jenkins and Docker for native Linux packagesJenkins and Docker for native Linux packages
Jenkins and Docker for native Linux packages
 
First python project
First python projectFirst python project
First python project
 
Package Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π SupercomputerPackage Management via Spack on SJTU π Supercomputer
Package Management via Spack on SJTU π Supercomputer
 
How to create a basic website with Python on Django
How to create a basic website with Python on DjangoHow to create a basic website with Python on Django
How to create a basic website with Python on Django
 
Pip + virtualenv
Pip + virtualenvPip + virtualenv
Pip + virtualenv
 
Using the pip package manager for Odoo
Using the pip package manager for OdooUsing the pip package manager for Odoo
Using the pip package manager for Odoo
 

Dernier

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Dernier (20)

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

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