How to install Python libraries without using the pip command ?
To install any python library without pip command, we can download the package from pypi.org in and run it's setup.py file using python. This will install the package on your system. In this article, We'll talk about this process step by step.
1. Downloading the package files from pypi.org
- Go to https://pypi.org/ and search for the package that you want.
- From Navigation menu on left side, click on Download files
- Download .tar.gz file
2. Installing downloaded python package
- Extract all the files from .tar.gz file from wherever you have downloaded them.
- Open command prompt as administrator.
- Navigate to your extracted directory using cd command
- Run setup.py file with python - Use following command to do so.
python setup.py install
After this the required package must be installed on your system. You can verify the same by open python interpreter and importing the package that you just installed.
Troubleshooting python package installation
Sometimes you might encounter errors while installing any downloaded python package, you should check following things to make sure you are doing it correctly:
- Are you running command prompt with admin rights ?
- Do you have prerequisites of the package installed on your system ?
Depending upon your installation location of python, packages will require you to have write permission to the directory where python is installed. On most of the systems, Its stored in C drive. In order to write in C drive, you need to run command prompt with admin rights.
Other issues that you might encounter while installing any downloaded python package is, lack of its dependent packages on your system or mismatch of versions. To fix this issue, you need to take a look into the requirements.txt file of the package and see if your system has those packages installed or not.
Hopefully, this will resolve your issues and you will have your python packages available to be imported and used.