Pennylane's Numpy's deprecated msort causing issues

I was coding along for the Pennylane Variational Quantum Eigensolver Video: https://www.youtube.com/watch?v=qiRtUUZ5s9s

# Put code here

# Importing all required libraries

import pennylane as qml
from pennylane import numpy as np
from pennylane import qchem


print("PennyLane version:", qml.__version__)
print("NumPy version:", np.__version__)

# Define Molecule in an Array
symbols = ["H", "H", "H"]

# Specify the Geometry of the Molecule
coordinates_without_sorting = np.array([[0.0102, 0.0442, 0.0],
                                        [0.9867, 1.6303, 0.0],
                                        [1.8720, -0.0085, 0.0]])

# Sort the coordinates if needed (e.g., sort within each axis separately)
coordinates = np.sort(coordinates_without_sorting, axis=0)

# Find the Hamiltonian and number of qubits
hamiltonian, qubits = qchem.molecular_hamiltonian(symbols, coordinates, charge=1)

# Print the number of qubits required to calculate the Hamiltonian
print(qubits)

# Use Hartree-Fock approximation
hf = qchem.hf_state(electrons=2, orbitals=6)

# Print the Hartree-Fock state
print(hf)

If you want help with diagnosing an error, please put the full error message below:

# Put full error message here

  Message=module 'numpy' has no attribute 'msort'
  Source=C:\Users\ghosh\source\repos\Variational Quantum Eigensolver using PennyLane - QML\Variational_Quantum_Eigensolver_using_PennyLane___QML.py
  StackTrace:
  File "C:\Users\ghosh\source\repos\Variational Quantum Eigensolver using PennyLane - QML\Variational_Quantum_Eigensolver_using_PennyLane___QML.py", line 3, in <module> (Current frame)
    import pennylane as qml
AttributeError: module 'numpy' has no attribute 'msort'

Hi @deborishi_g , welcome to the Forum!

I’m not being able to replicate your error. It seems to me like you have an installation issue or you’re using an old version of PennyLane.

I recommended that you create a new virtual environment to avoid any installation issues. You can create a virtual environment with Conda and install PennyLane as follows:

  1. Install Miniconda following the instructions here.
  2. Open your terminal (mac) or command line (Windows).
  3. Create a new Conda environment with: conda create --name <name_of_your_environment> python=3.10
  4. Activate the environment with: conda activate <name_of_your_environment>
  5. Install PennyLane with: python -m pip install pennylane
  6. 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.

Also note that if you want to get the version of PennyLane and Numpy being used you should use qml.about() instead of qml.__version__ and np.__version__.

I hope this helps you!