HyperAIHyperAI

Dependency Management with Conda

The Conda dependency management introduced here involves creating a completely independent environment, which typically means you need an environment with a different Python version than the system's default. If you don't have this requirement, there's no need to create an independent environment. Using pip install --user can fully accomplish this. Please refer to the documentation Installing Additional Dependencies Under the Default Python Version.

Python in HyperAI is managed through Conda. The default installation environment path can be obtained with the following command:

$ conda env list

# conda environments:
#
base                  *  /usr/local

You can see that the default environment is in /usr/local. The dependencies in each environment can be obtained through conda list. A complete list of installed dependencies is also provided under "Runtime Environment" on the left side of the documentation.

Creating a New Environment with Conda

1. Create a new environment under /openbayes/home

conda create -p open-mmlab python=3.9 -y

After installation is complete, activate the new environment with conda activate /openbayes/home/open-mmlab.

The key to being able to save the environment is to store the new environment's save path under /openbayes/home. Through "Continue Execution", this content can be bound again to a new execution.

2. Install other dependencies according to the documentation

conda install pytorch torchvision -c pytorch

git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection

# Continue installation according to official documentation
pip install mmcv
pip install -r requirements/build.txt
pip install "git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI"
pip install -v -e .  # or "python setup.py develop"

After completing the installation, mmdetection-related dependencies are installed in /openbayes/home/open-mmlab (which is also under /output/open-mmlab).

3. Open the original execution through continue execution

Bind the mmdetection environment prepared in the previous execution to a new execution through "Continue Execution". The previously configured environment can be activated again and used by running the command conda activate /openbayes/home/open-mmlab/.

Integrating the Newly Created Conda with Jupyter Workspace

Jupyter workspace can integrate with Conda to allow different notebooks to specify different Conda environments. Follow these steps to add a custom Conda environment to your Jupyter workspace.

conda activate /openbayes/home/open-mmlab/
(/openbayes/home/open-mmlab/)$ conda install ipykernel
(/openbayes/home/open-mmlab/)$ python -m ipykernel install --user --name=open-mmlab --display-name="Python (open-mmlab)"

After reopening the Jupyter workspace page, you can see an additional option: