Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere. It supports Python 2.7 and 3.5+. Note: Python 2.7 and 3.5 will no longer be supported in the next feature release (1.2). Pre-built Armadillo packages can also be installed via MacPorts or Homebrew the pre-built packages may not be the latest version; if you're encountering problems, use the official stable version provided here Windows.
This tutorial walks you through installing and using Python packages.
It will show you how to install and use the necessary tools and make strongrecommendations on best practices. Keep in mind that Python is used for a greatmany different purposes, and precisely how you want to manage your dependenciesmay change based on how you decide to publish your software. The guidancepresented here is most directly applicable to the development and deployment ofnetwork services (including web applications), but is also very well suited tomanaging development and testing environments for any kind of project.
Note
Install Python 3.6 Using Homebrew
This guide is written for Python 3, however, these instructionsshould work fine on Python 2.7—if you are still using it, for some reason.
Make sure you've got Python & pip¶
Before you go any further, make sure you have Python and that it's availablefrom your command line. You can check this by simply running:
You should get some output like 3.6.2
. If you do not have Python, pleaseinstall the latest 3.x version from python.org or refer to theInstalling Python section of this guide.
Note
If you're newcomer and you get an error like this:
It's because this command is intended to be run in a shell (also calleda terminal or console). See the Python for Beginnersgetting started tutorial for an introduction to using your operatingsystem's shell and interacting with Python.
Additionally, you'll need to make sure you have pip available. You cancheck this by running:
If you installed Python from source, with an installer from python.org, orvia Homebrew you should already have pip. If you're on Linux and installedusing your OS package manager, you may have to install pip separately.
Install Python Via Homebrew Emulator
Installing Pipenv¶
If you're newcomer and you get an error like this:
It's because this command is intended to be run in a shell (also calleda terminal or console). See the Python for Beginnersgetting started tutorial for an introduction to using your operatingsystem's shell and interacting with Python.
Additionally, you'll need to make sure you have pip available. You cancheck this by running:
If you installed Python from source, with an installer from python.org, orvia Homebrew you should already have pip. If you're on Linux and installedusing your OS package manager, you may have to install pip separately.
Install Python Via Homebrew Emulator
Installing Pipenv¶
Pipenv is a dependency manager for Python projects. If you're familiarwith Node.js' npm or Ruby's bundler, it is similar in spirit to thosetools. While pip can install Python packages, Pipenv is recommended asit's a higher-level tool that simplifies dependency management for common usecases.
Use pip
to install Pipenv:
Install Python Via Homebrew Ssh
Note
This does a user installation to prevent breaking any system-widepackages. If pipenv
isn't available in your shell after installation,you'll need to add the user base's binary directory to your PATH
.
On Linux and macOS you can find the user base binary directory by runningpython-msite--user-base
and adding bin
to the end. For example,this will typically print ~/.local
(with ~
expanded to theabsolute path to your home directory) so you'll need to add~/.local/bin
to your PATH
. You can set your PATH
permanently bymodifying ~/.profile.
On Windows you can find the user base binary directory by runningpy-msite--user-site
and replacing site-packages
withScripts
. For example, this could returnC:UsersUsernameAppDataRoamingPython36site-packages
so you wouldneed to set your PATH
to includeC:UsersUsernameAppDataRoamingPython36Scripts
. You can set youruser PATH
permanently in the Control Panel. You may need to logout for the PATH
changes to take effect.
Installing packages for your project¶
Pipenv manages dependencies on a per-project basis. To install packages,change into your project's directory (or just an empty directory for thistutorial) and run:
Pipenv will install the excellent Requests library and create a Pipfile
for you in your project's directory. The Pipfile is used to track whichdependencies your project needs in case you need to re-install them, such aswhen you share your project with others. You should get output similar to this(although the exact paths shown will vary):
Using installed packages¶
Now that Requests is installed you can create a simple main.py
file touse it:
Then you can run this script using pipenvrun
:
You should get output similar to this:
Using $pipenvrun
ensures that your installed packages are available toyour script. It's also possible to spawn a new shell that ensures all commandshave access to your installed packages with $pipenvshell
.
Next steps¶
Congratulations, you now know how to install and use Python packages! ✨ 🍰 ✨
libvips is a demand-driven, horizontallythreadedimage processing library. Compared to similarlibraries, libvips runs quickly and uses littlememory.libvips is licensed under the LGPL2.1+.
It has around 300 operations coveringarithmetic, histograms, convolution, morphological operations, frequencyfiltering, colour, resampling, statistics and others. It supports a largerange of numeric formats,from 8-bit int to 128-bit complex. Images can have any number of bands.It supports a good range of image formats, including JPEG, TIFF, PNG, WebP, FITS, Matlab, OpenEXR, PDF, SVG, HDR, PPM, CSV, GIF, Analyze,NIfTI, DeepZoom, and OpenSlide. It can also load images via ImageMagick orGraphicsMagick, letting it load formats like DICOM.
It comes with bindings for C,C++,and the command-line. Full bindingsare available for Ruby,Python,PHP, .NET, Go, andLua. libvipsis used as an image processing engine by sharp (onnode.js),bimg,sharp for Go,Ruby on Rails,carrierwave-vips,mediawiki,PhotoFlow and others.The official libvips GUI is nip2,a strange combination of a spreadsheet and an photo editor.
The download area has thesource code plus pre-compiled binaries for Windows; you can install on macOSwith homebrew, MacPorts or Fink; and it's available in most Linux packagemanagers. See the install notes.
News
- 2021-03-08 00:00:00 +0000
ruby-vips and image mutability
ruby-vips is now at version 2.1 with a few useful bug fixes and an interestingnew
mutate
feature. This new block makes it possible to modify imagesefficiently and safely. - 2020-09-01 00:00:00 +0000
libvips for WebAssembly
There's a new full libvips binding for the browser and Node.js. It supports reading and writing JPEG, PNG, WebP and TIFF images, it's on NPM, and it comes with TypeScript declarations. - 2020-06-18 00:00:00 +0000
What's new in 8.10
libvips 8.10 is now out, so here's a quick overview of what's new. Checkthe ChangeLogif you need more details.
- 2019-12-11 00:00:00 +0000
What's new in 8.9
libvips 8.9 is now done, so here's a quick overview of what's new. Checkthe ChangeLogif you need more details.
- 2019-11-29 00:00:00 +0000
True streaming for libvips
An interesting feature has just landed in libvips git master (and should bein the upcoming libvips 8.9): true streaming. This has been talked abouton and off for five years or more, but it's now finally happened! This postexplains what this feature is and why it could be useful.
- 2019-09-27 00:00:00 +0000
libvips on opencollective
Thanks to work by Lovell, libvips is now listed onopencollective.
- 2019-08-18 00:00:00 +0000
pyvips in conda
Thanks to work by Sebastian Luna-Valero (@sebastian-luna-valero) and others, pyvips is now in conda!
- 2019-08-18 00:00:00 +0000
libvips in OSS Fuzz
Thanks to work by Oscar Mira (@omira-sch), libvips has been in OSSFuzz for about three weeks. I'm veryhappy to be able to report that only one real bug has been found so far,and none in the last five days.
- 2019-04-22 00:00:00 +0000
What's new in 8.8
libvips 8.8 is now officiallyreleased, sohere's a quick overview of what's new. Check theChangeLogif you need more details.
- 2019-03-21 00:00:00 +0000
NIP getting started video
Here is a quick video on getting started with nip
- 2019-02-04 00:00:00 +0000
Libre Graphics Meeting 2016
I gave a 15m introduction to vips talk at LGM 2016, and just came across thevideo. It might be interesting.
- 2018-07-26 00:00:00 +0000
What's new in 8.7
libvips 8.7 is finally done!
- 2018-04-10 00:00:00 +0000
libvips for .NET
There's a new full libvips binding for .NET. It has a test-suite which passeswith no memory leaks, it's in
NuGet
, so it's easy to install on Linux,macOS and Windows, and it has nice documentation: - 2017-11-28 00:00:00 +0000
What's new in 8.6
libvips 8.6 is done! Though it's a bitlate. This post summarizes what's new – check theChangeLogif you need more details.
- 2017-09-02 00:00:00 +0000
libvips for Ruby
There's a new major release of
ruby-vips
, the Ruby binding for libvips:it's now version 2.0. It has the same API (it passes the same test suite),but it's simpler to install, works on Linux, macOS and Windows, it workswith any Ruby (including JRuby), it's smaller, more stable, and faster. - 2017-09-01 00:00:00 +0000
libvips for Python
There's a new libvips binding for Python. It has the same API as the one thatcomes with libvips (it passes the same test suite), it's very easy to installon Linux, macOS and Windows, it works with any Python, it should be smaller and more stable, and it has nice new documentation:
- 2017-06-01 00:00:00 +0000
libvips for Lua
LuaJIT now has a full libvips binding. It's the whole of libvips, it has atest-suite which passes with no memory leaks, and it's in
luarocks
so it'seasy to install. - 2017-03-28 00:00:00 +0000
New website
We have a new website running from github pages. Hopefully this will be easier to use and less work to maintain.
- 2017-03-16 00:00:00 +0000
What's new in 8.5
libvips 8.5 is done! This post summarizes what's new in this release. Check theChangeLog if you need more details.