Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name '_core' from partially initialized module 'pychrono' (most likely due to a circular import) #471

Open
e-chesoni opened this issue Nov 13, 2023 · 0 comments

Comments

@e-chesoni
Copy link

e-chesoni commented Nov 13, 2023

Issue

I recently installed Pychrono on Windows, following the instructions for option A) here. I was able to install everything as directed, but when I try to run the demo file demo_CH_coords.py from spyder and vscode I get the following error:

PS C:\Users\USERNAME\anaconda3\envs\chrono\Lib\site-packages\pychrono\demos> conda activate chrono
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if 
a path was included, verify that the path is correct and try again.
At line:1 char:1
+ conda activate chrono
+ 
    + CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
PS C:\Users\USERNAME\anaconda3\envs\chrono\Lib\site-packages\pychrono\demos> & C:/Users/USERNAME/anaconda3/envs/chrono/python.exe c:/Users/TLab_PC_00/anaconda3/envs/chrono/Lib/site-packages/pychrono/demos/core/demo_CH_coords.py
First tutorial for PyChrono: vectors, matrices etc.
Traceback (most recent call last):
  File "c:\Users\USERNAME\anaconda3\envs\chrono\Lib\site-packages\pychrono\demos\core\demo_CH_coords.py", line 17, in <module>
    import pychrono as chrono
  File "C:\Users\USERNAME\anaconda3\envs\chrono\lib\site-packages\pychrono\__init__.py", line 54, in <module>
    from .core import *
  File "C:\Users\USERNAME\anaconda3\envs\chrono\lib\site-packages\pychrono\core.py", line 13, in <module>
    from . import _core
ImportError: cannot import name '_core' from partially initialized module 'pychrono' (most likely due to a circular import) (C:\Users\USERNAME\anaconda3\envs\chrono\lib\site-packages\pychrono\__init__.py)

I have read that this is a circular import issue online (and in the error obviously) but I have no idea where it is coming from, or how to fix it, seeing as this is all part of the installation process and I have not written any code yet myself.

What I've Tried

I did try creating a simple test file called test.py with only the import statement in it:
import pychrono as chrono
I get the same error when trying to run this file from the chrono venv in vscode.

Following the debug process in post #140 I tried installing Spyder in the chrono venv
conda install spyder
Opening it via the anaconda navigation terminal, and running demo_CH_coords.py. I get the same error

...
ImportError: cannot import name '_core' from partially initialized module 'pychrono' (most likely due to a circular import) (C:\Users\USERNAME\anaconda3\envs\chrono\lib\site-packages\pychrono\__init__.py)

I have also tried adding ...\anaconda3 and ...\anaconda3\Scripts paths to environment variables as suggested by RichiGit97 on post #423:
Screenshot 2023-11-13 at 10 17 49 AM

I get the same result running from spyder:

...
ImportError: cannot import name '_core' from partially initialized module 'pychrono' (most likely due to a circular import) (C:\Users\USERNAME\anaconda3\envs\chrono\lib\site-packages\pychrono\__init__.py)

Additional Information

For reference, I installed this version of pychrono: win-64_pychrono-8.0.0-py310_3631.tar.bz2 using this line from the instructions:
conda install win-64_pychrono-8.0.0-py310_3631.tar.bz2

And I have the following packages installed in the virtual environment chrono: (all installed during the installation process referenced above)

 Name                    Version                   Build  Channel
bzip2                     1.0.8            vc14h5832a3a_5  [vc14]  intel
ca-certificates           2023.7.22            h56e8100_0    conda-forge
cuda-cccl                 11.7.58                       0    nvidia/label/cuda-11.7.0
cuda-command-line-tools   11.7.0                        0    nvidia/label/cuda-11.7.0
cuda-compiler             11.7.0                        0    nvidia/label/cuda-11.7.0
cuda-cudart               11.7.60                       0    nvidia/label/cuda-11.7.0
cuda-cudart-dev           11.7.60                       0    nvidia/label/cuda-11.7.0
cuda-cuobjdump            11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-cupti                11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-cuxxfilt             11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-documentation        11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-libraries            11.7.0                        0    nvidia/label/cuda-11.7.0
cuda-libraries-dev        11.7.0                        0    nvidia/label/cuda-11.7.0
cuda-memcheck             11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-nsight-compute       11.7.0                        0    nvidia/label/cuda-11.7.0
cuda-nvcc                 11.7.64                       0    nvidia/label/cuda-11.7.0
cuda-nvdisasm             11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-nvml-dev             11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-nvprof               11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-nvprune              11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-nvrtc                11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-nvrtc-dev            11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-nvtx                 11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-nvvp                 11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-sanitizer-api        11.7.50                       0    nvidia/label/cuda-11.7.0
cuda-toolkit              11.7.0                        0    nvidia/label/cuda-11.7.0
cuda-tools                11.7.0                        0    nvidia/label/cuda-11.7.0
cuda-visual-tools         11.7.0                        0    nvidia/label/cuda-11.7.0
expat                     2.5.0                h63175ca_1    conda-forge
fontconfig                2.14.2               hbde0cde_0    conda-forge
freetype                  2.12.1               hdaf720e_2    conda-forge
glfw                      3.3.8                hcfcfb64_2    conda-forge
intel-openmp              2023.2.0         h57928b3_50497    conda-forge
intelpython               2023.2.0                      0    intel
irrlicht                  1.8.5                h65f4d7e_4    conda-forge
libblas                   3.9.0                     8_mkl    conda-forge
libcblas                  3.9.0                     8_mkl    conda-forge
libcublas                 11.10.1.25                    0    nvidia/label/cuda-11.7.0
libcublas-dev             11.10.1.25                    0    nvidia/label/cuda-11.7.0
libcufft                  10.7.2.50                     0    nvidia/label/cuda-11.7.0
libcufft-dev              10.7.2.50                     0    nvidia/label/cuda-11.7.0
libcurand                 10.2.10.50                    0    nvidia/label/cuda-11.7.0
libcurand-dev             10.2.10.50                    0    nvidia/label/cuda-11.7.0
libcusolver               11.3.5.50                     0    nvidia/label/cuda-11.7.0
libcusolver-dev           11.3.5.50                     0    nvidia/label/cuda-11.7.0
libcusparse               11.7.3.50                     0    nvidia/label/cuda-11.7.0
libcusparse-dev           11.7.3.50                     0    nvidia/label/cuda-11.7.0
libexpat                  2.5.0                h63175ca_1    conda-forge
libffi                    3.4.2                h8ffe710_5    intel
libiconv                  1.17                 h8ffe710_0    conda-forge
libjpeg-turbo             3.0.0                hcfcfb64_1    conda-forge
liblapack                 3.9.0                     8_mkl    conda-forge
libnpp                    11.7.3.21                     0    nvidia/label/cuda-11.7.0
libnpp-dev                11.7.3.21                     0    nvidia/label/cuda-11.7.0
libnvjpeg                 11.7.2.34                     0    nvidia/label/cuda-11.7.0
libnvjpeg-dev             11.7.2.34                     0    nvidia/label/cuda-11.7.0
libpng                    1.6.39               h19919ed_0    conda-forge
libsqlite                 3.42.0               hcfcfb64_0    intel
libzlib                   1.2.13               hcfcfb64_5    intel
mkl                       2020.4             hb70f87d_311    conda-forge
nsight-compute            2022.2.0.13                   0    nvidia/label/cuda-11.7.0
numpy                     1.24.0           py39hbccbffa_0    conda-forge
occt                      7.4.0                h823b557_3    conda-forge
openssl                   3.1.4                hcfcfb64_0    conda-forge
pip                       23.1.2             pyhd8ed1ab_0    intel
python                    3.9.16              h11da44f_23    intel
python_abi                3.9                      2_cp39    conda-forge
pythonocc-core            7.4.1            py39h3d1c7c5_0    conda-forge
sdl                       1.2.68               h21dd15a_0    conda-forge
sdl2                      2.28.4               h63175ca_0    conda-forge
setuptools                67.7.2             pyhd8ed1ab_0    intel
six                       1.16.0             pyh6c4a22f_0    conda-forge
tbb                       2020.3           vc14_intel_311  [vc14]  intel
tk                        8.6.12               h2bbff1b_0    intel
tzdata                    2023c                h71feb2d_0    intel
ucrt                      10.0.22621.0         h57928b3_0    intel
vc                        14.3                hb25d44b_16    intel
vc14_runtime              14.34.31931         h5081d32_16    intel
vs2015_runtime            14.34.31931         hed1258a_16    intel
wheel                     0.40.0             pyhd8ed1ab_0    intel
xz                        5.2.8                h8cc25b3_0    intel`

Plea

Please let me know if I can offer any more information to help get this issue resolved. Would really love to get Pychrono working :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant