Cuquantum appliance: Can´t install and run own python package package in Cuquantum appliance when using apptainer
@mtjrider ya está trabajando en esto.
Desde el 15/11/2024.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Cuquantum appliance: Can´t install and run own python package package in Cuquantum appliance when using apptainer
I am a user of Cuquantum appliance 24.08 with apptainer container on HPC cluster, and I need to install my own local package VHA which has dependency on Qiskit and Qiskit Aer. After installation of this package by pip install --no-deps ./VHA, if I use pip show, the package is successfully found, but after running python script or interactive python console when trying to import VHA, I get module not found error, see below for more details.
Setting up the container
To ensure the container works properly with apptainer, and that correct conda environment is activated on every use, i build a container from following .def file.
Bootstrap: docker
From: nvcr.io/nvidia/cuquantum-appliance:24.08-x86_64
%post
# Ensure conda is initialized
conda init
# Ensure environment activation on every start
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc
echo "conda activate cuquantum-24.08" >> ~/.bashrc
%environment
source /opt/conda/etc/profile.d/conda.sh
conda activate cuquantum-24.08
And after that, I run
apptainer shell cuquantum-appliance.sif
and in the interactive shell, i use
pip install --no-deps ./vha
pip install --no-deps pyscf>=2.6 qiskit_algorithms>=0.3 qiskit_nature>=0.7.2 qiskit_ibm_runtime>=0.24.1 nlopt~=2.7 cma~=3.3.0 IPython traitlets stack_data executing asttokens pure_eval pygments decorator prompt_toolkit wcwidth click h5py
I also tried to install the local package directly to .sif image, but get the same result, i build this image from following .def file.
Bootstrap: docker
From: nvcr.io/nvidia/cuquantum-appliance:24.08-x86_64
%files
/home/tom/vha
%post
# Activate the conda environment and install the local package
# Ensure conda is initialized
conda init
# Ensure environment activation on every start
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc
echo "conda activate cuquantum-24.08" >> ~/.bashrc
/bin/bash -c "
source /opt/conda/etc/profile.d/conda.sh
conda activate cuquantum-24.08
pip install --no-deps /vha
pip install --no-deps pyscf>=2.6 qiskit_algorithms>=0.3 qiskit_nature>=0.7.2 qiskit_ibm_runtime>=0.24.1 nlopt~=2.7 cma~=3.3.0 IPython traitlets stack_data executing asttokens pure_eval pygments decorator prompt_toolkit wcwidth click h5py
"
%environment
source /opt/conda/etc/profile.d/conda.sh
conda activate cuquantum-24.08
Trying to use package
After setting the container, in both cases I get a same result.
I tried just to import the VHA package with following steps.
- Activate container
apptainer shell ./cuquantum-appliance.sif
- Use pip show to ensure VHA is installed, and get positive result.
This for installing the vha during building container.
(cuquantum-24.08) pip show vha
Name: vha
Version: 0.1.dev21+g451e767.d20241102
Summary:
Home-page:
Author:
Author-email:
License:
Location: /opt/conda/envs/cuquantum-24.08/lib/python3.11/site-packages
Requires: cma, nlopt, pyscf, qiskit, qiskit-aer, qiskit-algorithms, qiskit-ibm-runtime, qiskit-nature
Required-by:
This for installing the VHA after build
cuquantum-24.08) pip show vha
Name: vha
Version: 0.1.dev21+g451e767
Summary:
Home-page:
Author:
Author-email:
License:
Location: /home/tom/.local/lib/python3.11/site-packages
Requires: cma, nlopt, numpy, pyscf, qiskit, qiskit-aer, qiskit-algorithms, qiskit-ibm-runtime, qiskit-nature
Required-by:
- Trying to import VHA
cuquantum-24.08) python3
Python 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:36:13) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import vha
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'vha'
I also get the same error when trying to run a python script that import vha.
- Lenguaje dominante
- Jupyter Notebook
- Estrellas
- 503
- Forks
- 102
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NVIDIA/cuQuantum
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 94/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 8/100
-
CUDA 12 cuquantum-appliance image ships a UCX `libucm_cuda.so.0` linked against `libcudart.so.13`Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
-
`cutensornetTensorSVD` returns `CUTENSORNET_STATUS_INTERNAL_ERROR` with missing host workspaceAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100