Using Python Virtual Environment with Conda?

Using python virtual environment with conda?

Are you experiencing an issue with Isaac ROS or Isaac Sim? It sounds like your question may be better suited for a Python- or Anaconda-specific forum. This forum exists for support with NVIDIA Isaac robotics products.

I use “conda env create -f environment.yml;conda activate isaac-sim” created the virtual env.

cd /home/lin/.local/share/ov/pkg/isaac_sim-2022.2.1

new standalone_examples/test/ file, the code as follow:

from omni.isaac.examples.base_sample import BaseSample
# This extension has franka related tasks and controllers as well
from omni.isaac.franka import Franka
from omni.isaac.core.objects import DynamicCuboid
import numpy as np

class HelloWorld(BaseSample):
    def __init__(self) -> None:

    def setup_scene(self):
        world = self.get_world()
        # Robot specific class that provides extra functionalities
        # such as having gripper and end_effector instances.
        franka = world.scene.add(Franka(prim_path="/World/Fancy_Franka", name="fancy_franka"))
        # add a cube for franka to pick up
                position=np.array([0.3, 0.3, 0.3]),
                scale=np.array([0.0515, 0.0515, 0.0515]),
                color=np.array([0, 0, 1.0]),

I run python standalone_examples/test/ ,but error as follow?

  1. from omni.isaac.examples.base_sample import BaseSample
    ModuleNotFoundError: No module named ‘omni’

  2. from omni.isaac.core import World

ModuleNotFoundError: No module named ‘omni.isaac.core’

  1. from . import _usd
    ImportError: cannot open shared object file: No such file or directory

Is there a shortcut to import Python Path and run it?

I hope the official can provide a detailed case, and if it is convenient, a video case can be provided so that consumers can better enjoy isaac, rather than wasting time on environmental configuration. Thanks very much.

There is no simple way to use our own conda environments. But I managed to import those packages with my own script. The key idea is to import the paths of the missing libraries one by one with “sys.path.append” command. The list of these paths can be extracted from the configuration of VScode. The list was intended for the syntax checker to ignore some alerts. But I found we can use it to run ISAAC SIM in my own python environment as well.

Hi @904798869 - This forum post will be useful to you. Cannot import `omni` related modules

Could you please list the detail path of “sys.path.append”?

From my understanding, the main problem with importing isaac python modules is that folders have been named in a psycho way. For example, “omni.isaac.franka” has inside the folders omni->isaac->franka, so the python interpreter, even if pointed to the right folder “exts” where “omni.isaac.franka” is tries to enter into the folder “omni” (when importing " . " means enter in the folder )that does not exist.

To solve it, I have created a Python script that scans the folder exts and create symbolic links for every module in a personal folder, and I have added that folder to the PYTHON_PATH variable (along with the other folder added in the “”). (5.4 KB)

If anybody has a better solution, please share it with us.

P.S. I cannot believe that Nvidia created such a mess on this, I am sincerely surprised that given this structure, Isaac itself is able to load the correct modules…

Sorry to reply so late. I didn’t see your question earlier.

To answer your question, I can’t provide you with my code, because I was using absolute path which contains my personal information. However, you can extract the path list from your_isaac_path/.vscode folder.

Potentially relevant: GitHub - j3soon/isaac-extended: Provide some examples, notes, and patches not yet included in the latest Isaac release.