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

screeninfo could not find dataclasses in python 3.8 #35

Closed
kevinsmia1939 opened this issue Apr 30, 2020 · 4 comments
Closed

screeninfo could not find dataclasses in python 3.8 #35

kevinsmia1939 opened this issue Apr 30, 2020 · 4 comments

Comments

@kevinsmia1939
Copy link

Hello,

I tried to use superpaper which depend on screeninfo.
https://github.com/hhannine/superpaper
hhannine/superpaper#39

However, there seems to be an issue where screeninfo could not find dataclasses in python 3.8.
From the link below, dataclasses was merge to python 3.7.
https://pypi.org/project/dataclasses/

Traceback (most recent call last):
  File "/usr/bin/superpaper", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3252, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3235, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'dataclasses' distribution was not found and is required by screeninfo

Thanks.

@rr-
Copy link
Owner

rr- commented Apr 30, 2020

This doesn't make sense, if you're using Py3.8 it should have been built in right into your Python, and if Py3.6 or earlier, it should be covered with this line https://github.com/rr-/screeninfo/blob/master/setup.py#L14

@kevinsmia1939
Copy link
Author

This doesn't make sense, if you're using Py3.8 it should have been built in right into your Python, and if Py3.6 or earlier, it should be covered with this line https://github.com/rr-/screeninfo/blob/master/setup.py#L14

Hello,
I tried running test with python 3.8 and got error below.

python3.8 setup.py test
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
WARNING: The wheel package is not available.
running egg_info
creating screeninfo.egg-info
writing screeninfo.egg-info/PKG-INFO
writing dependency_links to screeninfo.egg-info/dependency_links.txt
writing requirements to screeninfo.egg-info/requires.txt
writing top-level names to screeninfo.egg-info/top_level.txt
writing manifest file 'screeninfo.egg-info/SOURCES.txt'
reading manifest file 'screeninfo.egg-info/SOURCES.txt'
writing manifest file 'screeninfo.egg-info/SOURCES.txt'
running build_ext
screeninfo (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: screeninfo (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: screeninfo
Traceback (most recent call last):
  File "/usr/lib64/python3.8/unittest/loader.py", line 470, in _find_test_path
    package = self._get_module_from_name(name)
  File "/usr/lib64/python3.8/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/home/kev/python-screeninfo/screeninfo-0.6.5/screeninfo/__init__.py", line 1, in <module>
    from .common import Enumerator, Monitor
  File "/home/kev/python-screeninfo/screeninfo-0.6.5/screeninfo/common.py", line 7, in <module>
    class Monitor:
  File "/home/kev/python-screeninfo/screeninfo-0.6.5/.eggs/dataclasses-0.6-py3.8.egg/dataclasses.py", line 958, in dataclass
    return wrap(_cls)
  File "/home/kev/python-screeninfo/screeninfo-0.6.5/.eggs/dataclasses-0.6-py3.8.egg/dataclasses.py", line 950, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
  File "/home/kev/python-screeninfo/screeninfo-0.6.5/.eggs/dataclasses-0.6-py3.8.egg/dataclasses.py", line 800, in _process_class
    cls_fields = [_get_field(cls, name, type)
  File "/home/kev/python-screeninfo/screeninfo-0.6.5/.eggs/dataclasses-0.6-py3.8.egg/dataclasses.py", line 800, in <listcomp>
    cls_fields = [_get_field(cls, name, type)
  File "/home/kev/python-screeninfo/screeninfo-0.6.5/.eggs/dataclasses-0.6-py3.8.egg/dataclasses.py", line 659, in _get_field
    if (_is_classvar(a_type, typing)
  File "/home/kev/python-screeninfo/screeninfo-0.6.5/.eggs/dataclasses-0.6-py3.8.egg/dataclasses.py", line 550, in _is_classvar
    return type(a_type) is typing._ClassVar
AttributeError: module 'typing' has no attribute '_ClassVar'


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
Test failed: <unittest.runner.TextTestResult run=1 errors=1 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=1 errors=1 failures=0>

@kevinsmia1939
Copy link
Author

But if I use this, it is different.


python setup.py test 
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
WARNING: The pip package is not available, falling back to EasyInstall for handling setup_requires/test_requires; this is deprecated and will be removed in a future version.
Searching for dataclasses
Reading https://pypi.org/simple/dataclasses/
Downloading https://files.pythonhosted.org/packages/7a/71/fdbab71f1f714e03ead2d264bf444f88379bc09b2937d54ec83894057f80/dataclasses-0.7.tar.gz#sha256=494a6dcae3b8bcf80848eea2ef64c0cc5cd307ffc263e17cdf42f3e5420808e6
Best match: dataclasses 0.7
Processing dataclasses-0.7.tar.gz
Writing /tmp/easy_install-GmFb8x/dataclasses-0.7/setup.cfg
Running dataclasses-0.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-GmFb8x/dataclasses-0.7/egg-dist-tmp-hhJ3Zs
  File "build/bdist.linux-x86_64/egg/dataclasses.py", line 202
    class InitVar(metaclass=_InitVarMeta):
                           ^
SyntaxError: invalid syntax

zip_safe flag not set; analyzing archive contents...
Moving dataclasses-0.7-py2.7.egg to /home/kev/python-screeninfo/screeninfo-0.6.5/.eggs

Installed /home/kev/python-screeninfo/screeninfo-0.6.5/.eggs/dataclasses-0.7-py2.7.egg
running egg_info
creating screeninfo.egg-info
writing requirements to screeninfo.egg-info/requires.txt
writing screeninfo.egg-info/PKG-INFO
writing top-level names to screeninfo.egg-info/top_level.txt
writing dependency_links to screeninfo.egg-info/dependency_links.txt
writing manifest file 'screeninfo.egg-info/SOURCES.txt'
reading manifest file 'screeninfo.egg-info/SOURCES.txt'
writing manifest file 'screeninfo.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

@kevinsmia1939
Copy link
Author

This patch fix it
https://github.com/rr-/screeninfo/pull/36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants