This is my first post, so I apologize in advance if you do not follow all the rules, but I just wanted to share my solution with using the Isaac Sim with PyCharm, which includes auto complete, ect.
I am using PyCharm version 2022.2 (Proffesional Edition) on Windows 10
Since I am more comfortable using it, then VS Code, I found a way to use these two.
NOTE: I am also using Anaconda virtual env, but that is not mandatory.
Steps:
1.1 (optional) Create/Choose virtual environment that you want to use
1.2 (optional) if using virtual environment edit python.bat inside isaac-gym folder, so that PYTHONEXE now points to virtual env executable
2. Go to File->Settings->Project Interpreter in the drop down menu select Show All and find your interpreter.
3. Edit interpreter and set python executable to previously edited python.bat file. Wait for PyCharm to finish indexing and you are good to go.
Now you can run simulation from python using simple RUN (Shift + F10) command directly in PyCharm .
I hope this helps anyone who wanted to use PyCharm with Isaac Sim.
Hi,
Thanks for the tip.
I’m using Anaconda virtual env on Ububtu and step 1.2 is unclear to me - which “python.bat inside isaac-gym folder” do you mean?
Thanks
Just to clear up things, Isaac Sim uses its own python installation.
This python is isolated from the rest of the system (conda, poetry, etc), it has its own site-packages folder and in Isaac Sim 2022.2.1 uses Python 3.7.
Read this docs if you need more details, but in short, under <Isaac Sim Install Folder>/kit there should be a python.bat (Windows) or python.sh (Linux) script that directly uses the Isaac Sim python installation.
In <Isaac Sim Install Folder>/kit/python you can find the python installation (binary, Scripts folder, packages, etc).
sorry didn’t see your post before..I have Isaac sim rl’s and use pycharm as my IDE for more than a year now and it works great but as issaac sim.
Im running in ubuntu, I think you are overthinking the interpreter as its going to direct to the python interpreter within omniverse anyway so it doesn’t actually matter too much - see below for my case in point
here my configuration
interpreter for isaacSIM 2022.2.1
/usr/bin/python3.8
and interpreter I use for 2023.1.0
/home/sujit/.local/share/ov/pkg/isaac_sim-2023.1.0/kit/python/bin/python3.10
next, open a terminal in Pycharm and cd to your isaacgymenvs directory
e.g. ~/Desktop/OmniIsaacGymEnvs/omniisaacgymenvs
you can then run an example using
/home/sujit/.local/share/ov/pkg/isaac_sim-2022.2.1/python.sh scripts/rlgames_train.py task=Cartpole
a more complex example
/home/sujit/.local/share/ov/pkg/isaac_sim-2022.2.1/python.sh scripts/rlgames_demo.py task=AnymalTerrain num_envs=64 checkpoint=omniverse://localhost/NVIDIA/Assets/Isaac/2022.2.1/Isaac/Samples/OmniIsaacGymEnvs/Checkpoints/anymal_terrain.pth
You can also directly run isaac sim bypassing the omniverse launcher in case you have any authentication problems
/home/sujit/.local/share/ov/pkg/isaac_sim-2022.2.1/isaac-sim.selector.sh
/home/sujit/.local/share/ov/pkg/isaac_sim-2022.2.1/isaac-sim.sh
I presume it should be very similar with Windows but I prefer a linux environment
Having spent a little time I think I understand the situation now.
What is needed to make all the code linting/finding features work in Pycharm is a complete PYTHONPATH.
Sadly, neither the environment created by the isaac_sim/setup_python_env.sh or the environment in isaac_sim/kit/setup_python_env.sh provide a complete PYTHONPATH.
The kit/setup_python_env.sh only provides the omni.kit packages, plus a few other ones, like carb, etc, and no omni.isaac packages at all.
If you use the PYTHONPATH provided in the kit/setup_python, and then enhance it by scanning the omni.issacsim packages and adding them in, then you can obtain a fully working lint, autocomplete and one-touch search.
In the end, I figured I might as well use VSCode, because it has remote debugging, which is basically required if you want to debug. Pycharm Community does not have remote debugging.
Hi Duane
I reviewed and you’re exactly right - didn’t see that he wanted autocomplete…any chance you could post a step by step to get autocomplete working?
sincerely
Sujit
Start with a python environment based on the kit/setup file using the first gif.
Then follow the steps to get the PYTHONPATH using the script I wrote below
#!/bin/python3
from pathlib import Path
import os
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('isaacsim_path', help='path to isaacsim_directory')
args = parser.parse_args()
isaacsim_path = Path(args.isaacsim_path)
assert isaacsim_path.exists(), f"{args.isaacsim_path} not found"
isaacsim_path = isaacsim_path.resolve()
print(",".join([f"\"{str(f)}\"" for f in isaacsim_path.glob("exts/*")]))
use text editor to write above to file
chmod +x generate_isaac_path.py
point at your issacsim install and run it… it will generate a massive PYTHONPATH
Then add that using the steps second animated gif I posted… it will probly work.
by the way, the way I’m doing this is a bit hacky.
I think if you use the omniverse kit command, there should be a supported way to recover the pythonpath for all the extensions.
I’m just a bit lazy to go read all that stuff right now.
I tried Anaconda + Pycharm + Isaac sim + Isaac Gym extension + omniisaacgymenvs for my RL project too, but it doesn’t work well.
python environment of Isaac sim + Pycharm/terminal/vscode + Isaac sim + Isaac Gym extension + omniisaacgymenvs works well
conda environment + terminal/vscode + Isaac sim + Isaac Gym extension + omniisaacgymenvs works well too, as long as I run source setup_conda_env.sh in the terminal before running my Python script.
conda environment + Pycharm + Isaac sim + Isaac Gym extension + omniisaacgymenvs never work.
I don’t know how to make Pycharm run the setup_python_env.sh before the Python script automatically, so I tried to figure out what environment valuables were added by the setup_python_env.sh. Even though I added these valuables to Pycharm, I still failed and got the error below. I also tried to launch the Pycharm IDE in a terminal after running with a setup_conda_env.sh, and failed again.
RuntimeError: Failed to acquire interface: omni::kit::IApp (pluginName: nullptr)
So eventually, I have to do my work with the Python environment provided by Isaac Sim. So if there is any solution, I’ll be very very appreciated.