Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed setup.py when missing libjpeg #7840

Merged
merged 3 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good to clarify that libjpeg and libpng are optional, but I don't think we need to remove that sentence:

libpng and libjpeg must be available at compilation time in order to be available.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I do not understand what you ask. Libs are optional and this sentence "libpng and libjpeg must be available at compilation time in order to be available." does not make sense (without speaking that it is unclear what it is exactly "in order be available")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the sentence means

libjpeg and libpng need to be available at compile time when you build from source.

We don't need to remove it

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should say that. It depends on whether the user installed them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you detail what is incorrect here?

Copy link
Member

@NicolasHug NicolasHug Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't know whether those libraries can be found on the standard library locations. If users didn't install them, then they won't be found there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think I need to rephrase the sentence I wrote: "libpng and libjpeg are first searched 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