question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installing 0.9.0 wheel on python 3.6 does not install dataclasses, causes import failure

See original GitHub issue

Describe the bug Installing pvlib 0.9.0 using the wheel currently on PyPI does not install dataclasses, causing pvlib to fail to import on python 3.6. I think this is because the wheel builder workflow uses python 3.8, so it ignores the dataclasses dependency when building the wheel (which is supposed to be universal across all our supported python versions):

https://github.com/pvlib/pvlib-python/blob/518cc35567baa15ae203bb8537452927ae10c7a7/.github/workflows/publish.yml#L24

https://github.com/pvlib/pvlib-python/blob/518cc35567baa15ae203bb8537452927ae10c7a7/setup.py#L49-L50

Opening the wheel (it’s just a zipfile) and viewing the pvlib-0.9.0.dist-info/METADATA file, there is no mention of dataclasses. Note that installing 0.9.0 from source (pip install pvlib --no-binary pvlib) works as intended because it is running setup.py locally in python 3.6. Our CI never has this kind of python version mismatch between what was used to build the wheel and what was used to run the tests, so it didn’t catch this.

To Reproduce

$ conda create -n py36test python=3.6
$ conda activate py36test
$ pip install pvlib==0.9.0
$ python -c "import pvlib"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\KANDERSO\Software\Anaconda3\envs\py36test\lib\site-packages\pvlib\__init__.py", line 3, in <module>
    from pvlib import (  # noqa: F401
  File "C:\Users\KANDERSO\Software\Anaconda3\envs\py36test\lib\site-packages\pvlib\ivtools\__init__.py", line 7, in <module>
    from pvlib.ivtools import sde, sdm, utils  # noqa: F401
  File "C:\Users\KANDERSO\Software\Anaconda3\envs\py36test\lib\site-packages\pvlib\ivtools\sdm.py", line 16, in <module>
    from pvlib.pvsystem import calcparams_pvsyst, singlediode, v_from_i
  File "C:\Users\KANDERSO\Software\Anaconda3\envs\py36test\lib\site-packages\pvlib\pvsystem.py", line 14, in <module>
    from dataclasses import dataclass
ModuleNotFoundError: No module named 'dataclasses'

Additional context Noticed in https://github.com/NREL/rdtools/pull/290

Possible solutions:

  • Switch the deploy workflow to use python 3.6, which will end up requiring dataclasses for all python versions
  • Upgrade dataclasses to be required for all versions in setup.py
  • Build separate wheels for each python version, maybe with cibuildwheel?
  • Remove the wheel file so that pip always installs from source?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
kanderso-nrelcommented, Sep 2, 2021

Ok, the pvlib and conda-forge channels have new builds (build 1) that work for me on both 3.6 and 3.7, so I think everything is fixed. If anyone discovers that’s not the case, please let me know.

1reaction
wholmgrencommented, Sep 2, 2021

Uploaded. See here for documentation on order of preference.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to import dataclasses module - python - Stack Overflow
The problem is that I can't seem to import dataclasses. I even tried installing the dataclasses module with pip3: pip3 install dataclasses ....
Read more >
dataclasses - PyPI
This is an implementation of PEP 557, Data Classes. It is a backport for Python 3.6. Because dataclasses will be included in Python...
Read more >
Python on Biowulf - NIH HPC
This is the python installed with the operating system and contains few packages ... However, if there is no GUI to connect to,...
Read more >
AllenNLP v2.10.1
⚠️ If you're using Python 3.7 or greater, you should ensure that you don't have the PyPI version of dataclasses installed after running...
Read more >
Install PyTorch on Raspberry Pi 4 - Q-engineering
We discuss two installations, one with a Python 3 wheel. The other method is the ... Less is no problem as long as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found