Hey everyone, I’m having trouble setting up my own OpenAI Gym environment. I’m using Spyder in Anaconda 3 and followed the official guide to create a test environment. But when I try to install it, I’m getting an error.
I ran these commands in Anaconda Prompt as admin:
pip install gym
pip install -e .
But I get this error: “Directory ‘.’ is not installable. File ‘setup.py’ not found.” This is weird because I definitely have setup.py in the root folder.
Has anyone run into this before? What am I doing wrong? I’m pretty stuck and could use some help. Thanks!
yo, i had a similar issue. make sure ur in the right directory when running those commands. try cd-ing into the folder with setup.py first. also, double-check that setup.py has the correct info for ur environment. if that doesnt work, maybe try creating a virtual env first. good luck!
I’ve been through this rodeo before with custom Gym environments. One thing that’s often overlooked is the init.py file. Make sure you have one in your environment directory and it’s properly importing your custom environment class. Also, check your setup.py file - it should include ‘gym’ in the install_requires list.
If that doesn’t solve it, try running ‘pip install -e .’ from the parent directory of your project folder. Sometimes the relative path can cause issues. And if all else fails, you might want to consider using gym-registry instead. It’s a bit more straightforward for registering custom environments.
Remember, debugging custom environments can be a pain, but once you get it working, it’s incredibly rewarding. Keep at it!