Skip to content

Commit

Permalink
Fixed setup.py when missing libjpeg (#7840)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Hug <nh.nicolas.hug@gmail.com>
  • Loading branch information
vfdev-5 and NicolasHug authored Aug 17, 2023
1 parent 69220e0 commit 4025fc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ Torchvision currently supports the following image backends:
- [libjpeg](http://ijg.org/) - can be installed via conda `conda install jpeg` or any of the package managers for
debian-based and RHEL-based Linux distributions. [libjpeg-turbo](https://libjpeg-turbo.org/) can be used as well.

**Notes:** `libpng` and `libjpeg` must be available at compilation time in order to be available. Make sure that it is
available on the standard library locations, otherwise, add the include and library paths in the environment variables
`TORCHVISION_INCLUDE` and `TORCHVISION_LIBRARY`, respectively.
**Notes:** `libpng` and `libjpeg` are optional dependencies. If any of them is available on the system,
torchvision will provide encoding/decoding image functionalities from `torchvision.io.image`.
When building torchvision from source, `libpng` and `libjpeg` can be found on the standard library locations.
Otherwise, please use `TORCHVISION_INCLUDE` and `TORCHVISION_LIBRARY` environment variables to set up include and library paths.

## Video Backend

Expand Down
2 changes: 1 addition & 1 deletion torchvision/csrc/io/image/cpu/decode_jpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ torch::Tensor decode_jpeg(const torch::Tensor& data, ImageReadMode mode) {
#endif // #if !JPEG_FOUND

int64_t _jpeg_version() {
#ifdef JPEG_FOUND
#if JPEG_FOUND
return JPEG_LIB_VERSION;
#else
return -1;
Expand Down

0 comments on commit 4025fc5

Please sign in to comment.