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

AttributeError: partially initialized module 'genesis' has no attribute 'init' #562

Closed
manumerous opened this issue Jan 14, 2025 · 7 comments

Comments

@manumerous
Copy link

manumerous commented Jan 14, 2025

Unfortunately there seems to be a problem with the installation of genesis resulting in the examples failing to run. I saw that there have already been similar issues raised (#113 #31 ) but they contain no solution to the problem. Since that is rather unfortunate for everyone searching for a solution to this I opened this new issue.

To install genesis on my local linux system i did the following steps:

conda create -n genesis python=3.11
conda activate genesis
conda install pytorch torchvision -c pytorch
pip install genesis-world

From the terminal output all the steps seem to be successful. When trying to run the example code with active conda environmnet:

import genesis as gs

gs.init(backend=gs.cpu)

scene = gs.Scene(show_viewer=True)
plane = scene.add_entity(gs.morphs.Plane())
franka = scene.add_entity(
    gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"),
)

scene.build()

for i in range(1000):
    scene.step()

I get the following error:

python genesis.py 
Traceback (most recent call last):
  File "/home/manu/src/genesis_test/genesis.py", line 1, in <module>
    import genesis as gs
  File "/home/manu/src/genesis_test/genesis.py", line 3, in <module>
    gs.init(backend=gs.cpu)
    ^^^^^^^
AttributeError: partially initialized module 'genesis' has no attribute 'init' (most likely due to a circular import)

Do you know how to fix this or how to install the "right version" of genesis?

When doing a pip feeze command I can see that genesis world is installed int he following version: genesis-world==0.2.1.

@pgi512
Copy link

pgi512 commented Jan 15, 2025

same here.

@JisuHann
Copy link

JisuHann commented Jan 16, 2025

Same error exist for docker too whenever re-installing genesis.

@Kira-Pgr
Copy link

I solved the issue by renaming genesis.py to something else

@KafuuChikai
Copy link
Contributor

KafuuChikai commented Jan 17, 2025

Hi there,

The error you're encountering is due to a naming conflict with the genesis.py file. Running genesis.py directly will cause a circular import error because the file name conflicts with the genesis module. However, you don't need to run the test files directly.

  • If you encounter this issue while running other files, it might be due to an unclean Python or conda environment. To resolve this, you can create a clean environment and install the necessary dependencies.

  • Or just export the path:

    export PYTHONPATH=/path/to/Genesis:$PYTHONPATH

@manumerous
Copy link
Author

manumerous commented Jan 17, 2025

Thank you, the renaming of the file fixed the error for me. Exporting the path and not renaming the file did not work for me. It might be worth changing the file name in the examples to avoid everyone from running into this error.

@tawfiqmakram
Copy link

I solved the issue by renaming genesis.py to something else

rename what?

@manumerous
Copy link
Author

I had the file that i executed named as genesis.py. Renaming that solved the issue.

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

6 participants