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.

Bug: Circular Import - `pyvista.FieldAssociation`

See original GitHub issue

Describe the bug, what’s wrong, and what you expected.

Reposting from pyvistaqt issue #168, for some unknown reason, pyvista seems to have a circular import bug when importing in some (but not all) virtual environments.

Steps to reproduce the bug.

  1. py -m venv .venv && .venv\Scripts\Activate.ps1
  2. py -m pip install pyvista
  3. Run python in terminal:
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvista
Traceback (most recent call last):   
  File "<stdin>", line 1, in <module>
  File "%USERPROFILE%\example\.venv\lib\site-packages\pyvista\__init__.py", line 14, in <module>
    from pyvista.core import *
  File "%USERPROFILE%\example\.venv\lib\site-packages\pyvista\core\__init__.py", line 3, in <module>
    from .dataset import DataSet, DataObject
  File "%USERPROFILE%\example\.venv\lib\site-packages\pyvista\core\dataset.py", line 36, in <module>
    from .filters import DataSetFilters, _get_output
  File "%USERPROFILE%\example\.venv\lib\site-packages\pyvista\core\filters\__init__.py", line 58, in <module>
    from .data_set import DataSetFilters
  File "%USERPROFILE%\example\.venv\lib\site-packages\pyvista\core\filters\data_set.py", line 9, in <module> 
    from pyvista import FieldAssociation, _vtk
ImportError: cannot import name 'FieldAssociation' from partially initialized module 'pyvista' (most likely due to a circular import) (%USERPROFILE%\example\.venv\lib\site-packages\pyvista\__init__.py)

System Information

--------------------------------------------------------------------------------
  Date: Mon Aug 08 13:26:22 2022 Pacific Daylight Time

                OS : Windows
            CPU(s) : 96
           Machine : AMD64
      Architecture : 64bit
       Environment : Python
        GPU Vendor : NVIDIA Corporation
      GPU Renderer : Quadro RTX 8000/PCIe/SSE2
       GPU Version : 4.5.0 NVIDIA 516.94

  Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64
  bit (AMD64)]

           pyvista : 0.36.1
               vtk : 9.1.0
             numpy : 1.23.1
           imageio : 2.21.1
           appdirs : 1.4.4
            scooby : 0.5.12
        matplotlib : 3.5.2
--------------------------------------------------------------------------------

Screenshots

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
adeakcommented, Aug 9, 2022

Well, I still don’t get it, but as long as it’s fixed.

1reaction
adam-grant-hendrycommented, Aug 9, 2022

Well, I still don’t get it, but as long as it’s fixed.

I literally opened the file in my editor and hit save (force of habit), so I’m sure that’s why it edited it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for pyvista.utilities.helpers
""" # import needs to happen here to prevent a circular import from pyvista.core.errors import DeprecationError raise DeprecationError('DEPRECATED: Please use ...
Read more >
installing pyvista with pip results in vtk related error · Issue #534
trying to install pyvista via pip install pyvista (or similar) currently ... module 'vtkmodules' (most likely due to a circular import) ...
Read more >
VTK import error when trying to import PyVista on Python 3.10
But when I import pyvista, it gives the following error. ImportError: cannot import name 'vtkExtractEdges' from 'vtkmodules.vtkFiltersExtraction ...
Read more >
pyvista · PyPI
PyVista is a helper module for the Visualization Toolkit (VTK) that wraps the VTK library ... Import meshes from many common formats (use...
Read more >
pyiges 0.1.3 documentation - GitHub Pages
The pyiges module can read in many entities as raw text, but only NURBS surfaces and bsplines can be converted to pyvista meshes....
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