Skip to content

TypeError: 'NoneType' object is not callable; ImportError: sys.meta_path is None, Python is likely shutting down #2102

Open
@ingamt

Description

@ingamt

🔍 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

🐞 Description of the bug

Hi,
I'm new using Pyansys. I would need to use Ansys 2021 R2 but it seems to have some version issues, which come with several different Python versions both not using and using virtual environment. I tried the installation check code:

from ansys.dpf.core import Model
from ansys.dpf.core import examples
model = Model(examples.find_simple_bar())
print(model)

This gives results but additionally list of errors:

DPF Model
------------------------------
Static analysis
Unit system: MKS: m, kg, N, s, V, A, degC
Physics Type: Mecanic
Available results:
     -  displacement: Nodal Displacement
     -  element_nodal_forces: ElementalNodal Element nodal Forces
     -  elemental_volume: Elemental Volume
     -  stiffness_matrix_energy: Elemental Energy-stiffness matrix
     -  artificial_hourglass_energy: Elemental Hourglass Energy
     -  thermal_dissipation_energy: Elemental thermal dissipation energy
     -  kinetic_energy: Elemental Kinetic Energy
     -  co_energy: Elemental co-energy
     -  incremental_energy: Elemental incremental energy
     -  structural_temperature: ElementalNodal Temperature
------------------------------
DPF  Meshed Region:
  3751 nodes
  3000 elements
  Unit: m
  With solid (3D) elements
------------------------------
DPF  Time/Freq Support:
  Number of sets: 1
Cumulative     Time (s)       LoadStep       Substep
1              1.000000       1              1

server_types.py:1184: UserWarning: couldn't prepare shutdown: (<grpc._channel._RPCState object at 0x00000196F2591BB0>,)
server_types.py:1203: UserWarning: Traceback (most recent call last):
  File "server_types.py", line 1191, in shutdown
    self._shutdown_func[0](self._shutdown_func[1])
TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "server_types.py", line 1194, in shutdown
    if self.meet_version("4.0"):
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "server_types.py", line 568, in meet_version
    return server_meet_version(required_version, self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "check_version.py", line 29, in server_meet_version
    return meets_version(version, required_version)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "check_version.py", line 82, in meets_version
    from packaging.version import parse
ImportError: sys.meta_path is None, Python is likely shutting down

📝 Steps to reproduce

Is there some way to get these errors away by modifying versions etc.?

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

ANSYS 2021R2

🐍 Which Python version are you using?

3.12

📦 Installed packages

aiohappyeyeballs                      2.4.6
aiohttp                               3.11.12
aiosignal                             1.3.2
ansicon                               1.89.0
ansys-api-mapdl                       0.5.1
ansys-api-platform-instancemanagement 1.1.2
ansys-dpf-core                        0.9.0
ansys-dpf-gate                        0.4.1
ansys-dpf-gatebin                     0.4.1
ansys-dpf-post                        0.9.2
ansys-grpc-dpf                        0.3.0
ansys-mapdl-core                      0.64.0
ansys-mapdl-reader                    0.54.2
ansys-math-core                       0.2.2
ansys-platform-instancemanagement     1.1.2
ansys-tools-path                      0.7.1
ansys-tools-visualization-interface   0.8.1
appdirs                               1.4.4
attrs                                 24.2.0
blessed                               1.20.0
cachetools                            5.5.1
certifi                               2025.1.31
charset-normalizer                    3.4.1
click                                 8.1.8
colorama                              0.4.6
contourpy                             1.3.1
cycler                                0.12.1
editor                                1.6.6
fonttools                             4.56.0
frozenlist                            1.5.0
geomdl                                5.3.1
google-api-core                       2.24.1
google-api-python-client              2.161.0
google-auth                           2.38.0
google-auth-httplib2                  0.2.0
googleapis-common-protos              1.67.0
grpcio                                1.70.0
httplib2                              0.22.0
idna                                  3.10
importlib_metadata                    8.6.1
inquirer                              3.4.0
jinxed                                1.3.0
kiwisolver                            1.4.8
matplotlib                            3.10.0
more-itertools                        10.6.0
msgpack                               1.1.0
multidict                             6.1.0
numpy                                 2.2.3
packaging                             24.2
pillow                                11.1.0
pip                                   25.0.1
platformdirs                          4.3.6
pooch                                 1.8.2
propcache                             0.3.0
proto-plus                            1.26.0
protobuf                              3.20.3
psutil                                7.0.0
pyansys-tools-versioning              0.6.0
pyasn1                                0.6.1
pyasn1_modules                        0.4.1
pyiges                                0.3.1
pyparsing                             3.2.1
python-dateutil                       2.9.0.post0
pyvista                               0.44.2
readchar                              4.2.1
requests                              2.32.3
rsa                                   4.9
runs                                  1.2.2
scipy                                 1.15.2
scooby                                0.10.0
setuptools                            75.8.0
six                                   1.17.0
tabulate                              0.9.0
tqdm                                  4.67.1
trame                                 3.8.0
trame-client                          3.5.2
trame-server                          3.3.0
trame-vtk                             2.8.15
trame-vuetify                         2.8.1
typing_extensions                     4.12.2
uritemplate                           4.1.1
urllib3                               2.3.0
vtk                                   9.3.1
wcwidth                               0.2.13
websockets                            14.2
wslink                                2.3.1
xmod                                  1.8.1
yarl                                  1.18.3
zipp                                  3.21.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions