tudat-team / tudatpy

A Python platform to perform astrodynamics and space research.
https://tudat-space.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
29 stars 31 forks source link

Can not import tudatpy, why? #119

Closed spacefan closed 1 year ago

spacefan commented 1 year ago
(tudat) PS C:\Users\user> conda list
# packages in environment at C:\Users\user\.conda\envs\tudat:
#
# Name                    Version                   Build  Channel
anyio                     3.5.0           py310haa95532_0
argon2-cffi               21.3.0             pyhd3eb1b0_0
argon2-cffi-bindings      21.2.0          py310h2bbff1b_0
asttokens                 2.0.5              pyhd3eb1b0_0
attrs                     23.1.0          py310haa95532_0
babel                     2.11.0          py310haa95532_0
backcall                  0.2.0              pyhd3eb1b0_0
bleach                    4.1.0              pyhd3eb1b0_0
boost-cpp                 1.78.0               h9f4b32c_4    conda-forge
brotli                    1.1.0                hcfcfb64_1    conda-forge
brotli-bin                1.1.0                hcfcfb64_1    conda-forge
brotlipy                  0.7.0           py310h2bbff1b_1002
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2023.08.22           haa95532_0
certifi                   2023.7.22       py310haa95532_0
cffi                      1.15.1          py310h2bbff1b_3
charset-normalizer        2.0.4              pyhd3eb1b0_0
colorama                  0.4.6           py310haa95532_0
comm                      0.1.2           py310haa95532_0
contourpy                 1.1.1           py310h232114e_1    conda-forge
cryptography              41.0.3          py310h89fc84f_0
cspice-cmake              66                   hf38778d_6    tudat-team
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
debugpy                   1.6.7           py310hd77b12b_0
decorator                 5.1.1              pyhd3eb1b0_0
defusedxml                0.7.1              pyhd3eb1b0_0
entrypoints               0.4             py310haa95532_0
exceptiongroup            1.0.4           py310haa95532_0
executing                 0.8.3              pyhd3eb1b0_0
fonttools                 4.43.1          py310h8d17308_0    conda-forge
freetype                  2.12.1               hdaf720e_2    conda-forge
gettext                   0.21.1               h5728263_0    conda-forge
glib                      2.78.0               h12be248_0    conda-forge
glib-tools                2.78.0               h12be248_0    conda-forge
gst-plugins-base          1.22.6               h001b923_2    conda-forge
gstreamer                 1.22.6               hb4038d2_2    conda-forge
icu                       72.1                 h63175ca_0    conda-forge
idna                      3.4             py310haa95532_0
intel-openmp              2023.2.0         h57928b3_50496    conda-forge
ipykernel                 6.25.0          py310h9909e9c_0
ipython                   8.15.0          py310haa95532_0
ipython_genutils          0.2.0              pyhd3eb1b0_1
ipywidgets                8.0.4           py310haa95532_0
jedi                      0.18.1          py310haa95532_1
jinja2                    3.1.2           py310haa95532_0
json5                     0.9.6              pyhd3eb1b0_0
jsonschema                4.17.3          py310haa95532_0
jupyter                   1.0.0           py310haa95532_8
jupyter_client            7.4.9           py310haa95532_0
jupyter_console           6.6.3           py310haa95532_0
jupyter_core              5.3.0           py310haa95532_0
jupyter_server            1.13.5             pyhd3eb1b0_0
jupyterlab                3.3.2              pyhd3eb1b0_0
jupyterlab_server         2.10.3             pyhd3eb1b0_1
jupyterlab_widgets        3.0.5           py310haa95532_0
kiwisolver                1.4.5           py310h232114e_1    conda-forge
krb5                      1.20.1               h5b6d351_0
lcms2                     2.15                 he9d350c_2    conda-forge
lerc                      4.0.0                h63175ca_0    conda-forge
libblas                   3.9.0              19_win64_mkl    conda-forge
libbrotlicommon           1.1.0                hcfcfb64_1    conda-forge
libbrotlidec              1.1.0                hcfcfb64_1    conda-forge
libbrotlienc              1.1.0                hcfcfb64_1    conda-forge
libcblas                  3.9.0              19_win64_mkl    conda-forge
libclang                  16.0.6          default_heb8d277_1    conda-forge
libclang13                16.0.6          default_hc80b9e7_1    conda-forge
libcurl                   8.1.2                h68f0423_0    conda-forge
libdeflate                1.19                 hcfcfb64_0    conda-forge
libffi                    3.4.4                hd77b12b_0
libglib                   2.78.0               he8f3873_0    conda-forge
libhwloc                  2.9.3           default_haede6df_1009    conda-forge
libiconv                  1.17                 h8ffe710_0    conda-forge
libjpeg-turbo             2.1.5.1              hcfcfb64_1    conda-forge
liblapack                 3.9.0              19_win64_mkl    conda-forge
libogg                    1.3.5                h2bbff1b_1
libpng                    1.6.39               h19919ed_0    conda-forge
libsodium                 1.0.18               h62dcd97_0
libsqlite                 3.43.2               hcfcfb64_0    conda-forge
libssh2                   1.11.0               h7dfc565_0    conda-forge
libtiff                   4.6.0                h4554b19_1    conda-forge
libvorbis                 1.3.7                h0e60522_0    conda-forge
libwebp-base              1.3.2                h2bbff1b_0
libxcb                    1.15                 hcd874cb_0    conda-forge
libxml2                   2.11.5               hc3477c8_1    conda-forge
libzlib                   1.2.13               hcfcfb64_5    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
markupsafe                2.1.1           py310h2bbff1b_0
matplotlib                3.8.0           py310h5588dad_2    conda-forge
matplotlib-base           3.8.0           py310hc9baf74_2    conda-forge
matplotlib-inline         0.1.6           py310haa95532_0
mistune                   0.8.4           py310h2bbff1b_1000
mkl                       2023.2.0         h6a75c08_50496    conda-forge
msys2-conda-epoch         20160418                      1    conda-forge
munkres                   1.1.4                      py_0
nbclassic                 0.5.5           py310haa95532_0
nbconvert                 5.5.0                      py_0
nbformat                  5.9.2           py310haa95532_0
nest-asyncio              1.5.6           py310haa95532_0
notebook                  6.5.4           py310haa95532_1
notebook-shim             0.2.2           py310haa95532_0
nrlmsise-00               0.1                  h6240248_3    tudat-team
numpy                     1.26.0          py310hf667824_0    conda-forge
openjpeg                  2.5.0                h3d672ee_3    conda-forge
openssl                   3.1.4                hcfcfb64_0    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
pandas                    2.1.1           py310hecd3228_1    conda-forge
pandoc                    2.12                 haa95532_3
pandocfilters             1.5.0              pyhd3eb1b0_0
parso                     0.8.3              pyhd3eb1b0_0
pcre2                     10.40                h17e33f8_0    conda-forge
pickleshare               0.7.5           pyhd3eb1b0_1003
pillow                    10.0.1          py310h6abe1ea_1    conda-forge
pip                       23.3.1             pyhd8ed1ab_0    conda-forge
platformdirs              3.10.0          py310haa95532_0
ply                       3.11                       py_1    conda-forge
prometheus_client         0.14.1          py310haa95532_0
prompt-toolkit            3.0.36          py310haa95532_0
prompt_toolkit            3.0.36               hd3eb1b0_0
psutil                    5.9.0           py310h2bbff1b_0
pthread-stubs             0.4               hcd874cb_1001    conda-forge
pthreads-win32            2.9.1                hfa6e2cd_3    conda-forge
pure_eval                 0.2.2              pyhd3eb1b0_0
pybind11                  2.11.1          py310h232114e_2    conda-forge
pybind11-global           2.11.1          py310h232114e_2    conda-forge
pycparser                 2.21               pyhd3eb1b0_0
pygments                  2.15.1          py310haa95532_1
pyopenssl                 23.2.0          py310haa95532_0
pyparsing                 3.1.1              pyhd8ed1ab_0    conda-forge
pyqt                      5.15.9          py310h1fd54f2_5    conda-forge
pyqt5-sip                 12.12.2         py310h00ffb61_5    conda-forge
pyrsistent                0.18.0          py310h2bbff1b_0
pysocks                   1.7.1           py310haa95532_0
python                    3.10.12         h4de0772_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd3eb1b0_0
python-fastjsonschema     2.16.2          py310haa95532_0
python-tzdata             2023.3             pyhd3eb1b0_0
python_abi                3.10                    4_cp310    conda-forge
pytz                      2023.3.post1    py310haa95532_0
pywin32                   305             py310h2bbff1b_0
pywinpty                  2.0.10          py310h5da7b33_0
pyzmq                     23.2.0          py310hd77b12b_0
qt-main                   5.15.8              h2c8576c_12    conda-forge
qtconsole                 5.4.2           py310haa95532_0
qtpy                      2.2.0           py310haa95532_0
requests                  2.31.0          py310haa95532_0
scipy                     1.11.3          py310hf667824_1    conda-forge
send2trash                1.8.0              pyhd3eb1b0_1
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
sip                       6.7.12          py310h00ffb61_0    conda-forge
six                       1.16.0             pyhd3eb1b0_1
sniffio                   1.2.0           py310haa95532_1
sofa-cmake                1.0.0                hf38778d_7    tudat-team
stack_data                0.2.0              pyhd3eb1b0_0
tabulate                  0.9.0              pyhd8ed1ab_1    conda-forge
tbb                       2021.10.0            h91493d7_2    conda-forge
terminado                 0.17.1          py310haa95532_0
testpath                  0.6.0           py310haa95532_0
tk                        8.6.13               hcfcfb64_0    conda-forge
toml                      0.10.2             pyhd3eb1b0_0
tomli                     2.0.1           py310haa95532_0
tornado                   6.3.3           py310h8d17308_1    conda-forge
traitlets                 5.7.1           py310haa95532_0
tudat                     2.12.1               hf7be431_3    tudat-team
tudat-resources           2.1                  h802ae32_2    tudat-team
tudatpy                   0.7.3           py310hee2ac88_3    tudat-team
typing-extensions         4.7.1           py310haa95532_0
typing_extensions         4.7.1           py310haa95532_0
tzdata                    2023c                h04d1e81_0
ucrt                      10.0.22621.0         h57928b3_0    conda-forge
unicodedata2              15.1.0          py310h8d17308_0    conda-forge
urllib3                   1.26.16         py310haa95532_0
vc                        14.3                h64f974e_17    conda-forge
vc14_runtime              14.36.32532         hdcecf7f_17    conda-forge
vs2015_runtime            14.36.32532         h05e6639_17    conda-forge
wcwidth                   0.2.5              pyhd3eb1b0_0
webencodings              0.5.1           py310haa95532_1
websocket-client          0.58.0          py310haa95532_4
wheel                     0.41.2          py310haa95532_0
widgetsnbextension        4.0.5           py310haa95532_0
win_inet_pton             1.1.0           py310haa95532_0
winpty                    0.4.3                         4
xorg-libxau               1.0.11               hcd874cb_0    conda-forge
xorg-libxdmcp             1.1.3                hcd874cb_0    conda-forge
xz                        5.4.2                h8cc25b3_0
zeromq                    4.3.4                hd77b12b_0
zstd                      1.5.5                h12be248_0    conda-forge
(tudat) PS C:\Users\user> python
Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:34:57) [MSC v.1936 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tudatpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\.conda\envs\tudat\lib\site-packages\tudatpy\__init__.py", line 2, in <module>
    from .kernel import constants
ImportError: DLL load failed while importing kernel: Dynamic link library (DLL) initialization routine failed.
>>> import tudatpy.kernel
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\.conda\envs\tudat\lib\site-packages\tudatpy\__init__.py", line 2, in <module>
    from .kernel import constants
ImportError: DLL load failed while importing kernel: dynamic link library (DLL) initialization routine failed.

Getting same error in jupyterlab:

# Load standard modules
import numpy as np
from matplotlib import pyplot as plt

# Load tudatpy modules
from tudatpy.kernel.interface import spice
from tudatpy.kernel import numerical_simulation
from tudatpy.kernel.numerical_simulation import environment_setup, propagation_setup
from tudatpy.kernel.astro import element_conversion
from tudatpy.kernel import constants
from tudatpy.util import result2array
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[12], line 6
      3 from matplotlib import pyplot as plt
      5 # Load tudatpy modules
----> 6 from tudatpy.kernel.interface import spice
      7 from tudatpy.kernel import numerical_simulation
      8 from tudatpy.kernel.numerical_simulation import environment_setup, propagation_setup

File ~\.conda\envs\tudat\lib\site-packages\tudatpy\__init__.py:2
      1 from ._version import *
----> 2 from .kernel import constants
      3 from .kernel import astro
      4 from .kernel import interface

ImportError: DLL load failed while importing kernel: dynamic link library (DLL) initialization routine failed.
DominicDirkx commented 1 year ago

Hi, in the past an error like this has occured due to a virus scanner being paranoid. Could this be the case here?

spacefan commented 1 year ago

Probably not. I didn't find any prompts from the anti-virus software, and I didn't see any abnormalities in the quarantine area.

Maybe I should try tudatpy under Linux (such as ubuntu) and report the result back later.

DominicDirkx commented 1 year ago

In the past, the only time the above issue has popped up was with virus scanners (or Windows Defender, or whatever is standard nowadays). And, the version you're using has been using by several hundred Windows users, I think. But, Linux should not give this issues :)

spacefan commented 1 year ago

On Ubuntu 22.04, every example is OK! Issue closed.