Hi @Amandeep ,
If you don’t need to work locally you could try using Google Colab or qBraid. In Google Colab all you need is to write !pip install pennylane
in the first cell (including the exclamation mark).
Edit: the two options below may not work because we require a minimum glibc library of 2.28 (ie RHEL 8 compatible and newer). Yours is glibc 2.17 (RHEL 7). So I would strongly suggest going for the options mentioned above.
If you need to work locally here are two options to solve your issue with lightning. If option 1 doesn’t work you can try option 2. If none of them work please share your output for qml.about()
and your full error traceback.
Option 1: Virtual environment with Conda
You can create a virtual environment with Conda and install PennyLane as follows:
- Install Miniconda following the instructions here.
- Open your terminal (Mac) or command line (Windows).
- Create a new Conda environment with: conda create --name <name_of_your_environment> python=3.10
- Activate the environment with: conda activate <name_of_your_environment>
- Install PennyLane with: python -m pip install pennylane
- Install other useful packages with: python -m pip install jupyter matplotlib
Note that you will be installing 3 packages here: PennyLane, Jupyter, and Matplotlib. Also, note that where it says <name_of_your_environment> you can choose any name that you want.
Option 2: Virtual environment with venv
You can create a virtual environment with venv and install PennyLane as follows (Mac & Windows):
- Download Python 3.10 or newer here.
- Double-click on the .pkg file (Mac) or .exe file (Windows).
- Double-click on the Install Certificates.command file. It will open a terminal/command
line window. You can close it after it says “process completed”. - Open your terminal/command line.
- Create the directory for your virtual environment with:
mkdir ~/.virtualenvs
- Create a new virtual environment with:
python3.X -m venv ~/.virtualenvs/new_venv
where X is the version of Python you installed. E.g. if you installed Python 3.10 then start withpython3.10
You can changenew_venv
to whatever name you want for your environment. - Activate the environment with:
source ~/.virtualenvs/new_venv/bin/activate
- Install PennyLane with:
python -m pip install pennylane
- Install other useful packages such as Jupyter and Matplotlib with:
python -m pip install jupyter matplotlib
- Write
jupyter notebook
in your terminal/command line and you will be ready to
create programs using PennyLane.
Every time you want to use PennyLane make sure to open a new terminal/command line, activate the environment with step 7, and open a Jupyter notebook with step 10.
Let me know if this works for you.