'"Error: package not found" even after using pip to install

I have successfully finished the first problem I had with pip.main being moved, but I installed pyfirmata which I am using for my Arduino UNO, but even though I used pip and successfully installed it, there was still an error that said "package pyfirmata not found". I don't understand this. This is my code:

#install pyfirmata
import pip
from pip._internal import main as pipmain
pipmain(['install', 'pyfirmata'])
#import pyfirmata
from pyfirmata import Arduino, util
import time

board = Arduino('') #put port into "('')"


Solution 1:[1]

if you are getting error no module named pyfirmata and it is sucessfully installed than again type pip install pyfirmata you see requirment satisfy and location of site packages open location search pyfimata and locate pyfirmata file to your project directory now it possible pyfirmata need more module so also locate them with in the directory

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SCI FI