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

ImportError thrown when importing PY3 from torch._six #578

Closed
0xEljh opened this issue Mar 6, 2021 · 1 comment · Fixed by #579
Closed

ImportError thrown when importing PY3 from torch._six #578

0xEljh opened this issue Mar 6, 2021 · 1 comment · Fixed by #579
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@0xEljh
Copy link
Contributor

0xEljh commented Mar 6, 2021

🐛 Bug

ImportError is thrown by imagenet_dataset.py due to inability to import PY3 from torch._six.

PY3 is no longer available for import from torch._six as of PR #46579 in Torch.

To Reproduce

This bug was found when trying to import the AMDIM bolts package
Steps to reproduce the behavior:

  1. from pl_bolts.models.self_supervised import AMDIM
  2. This results in the following stack trace and error:
    from pl_bolts.datasets import BinaryMNIST
  File "C:\Users\Elijah\miniconda3\envs\torch\lib\site-packages\pl_bolts\datasets\__init__.py", line 11, in <module>
    from pl_bolts.datasets.imagenet_dataset import extract_archive, parse_devkit_archive, UnlabeledImagenet
  File "C:\Users\Elijah\miniconda3\envs\torch\lib\site-packages\pl_bolts\datasets\imagenet_dataset.py", line 12, in <module>
    from torch._six import PY3
ImportError: cannot import name 'PY3' from 'torch._six' (C:\Users\Elijah\miniconda3\envs\torch\lib\site-packages\torch\_six.py)

Expected behavior

Successful import

Environment

  • PyTorch Version 1.8.0
  • OS: Windows
  • Installation method: both pip install and conda install were tried
  • Python version: 3.8
@0xEljh 0xEljh added fix fixing issues... help wanted Extra attention is needed labels Mar 6, 2021
@github-actions
Copy link

github-actions bot commented Mar 6, 2021

Hi! thanks for your contribution!, great first issue!

@Borda Borda closed this as completed in #579 Mar 6, 2021
Borda pushed a commit that referenced this issue Mar 6, 2021
…579)

* Update imagenet_dataset.py dependencies

- The import PY3 from Torch._six no longer exists as of Torch PR #46579
- Updated to use PY37, which is the current only available import

* Remove torch._six dependency from imagenet_dataset.py

Removed dependency on torch._six for checking if Python 3 is used. This relaxes the condition of Python >=3.7 if dependency is to be kept.
@Borda Borda added bug Something isn't working and removed fix fixing issues... labels Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants