Bug: Circular Import - `pyvista.FieldAssociation`
See original GitHub issueDescribe 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.
py -m venv .venv && .venv\Scripts\Activate.ps1
py -m pip install pyvista
- 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:
- Created a year ago
- Comments:11 (11 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.