Wheel file installation
You normally use a tool like pip
to install wheels. Leave it to the tool to discover and download the file if this is for a project hosted on PyPI.
For this to work, you do need to install the wheel
package:
pip install wheel
You can then tell pip
to install the project (and it'll download the wheel if available), or the wheel file directly:pip install project_name # discover, download and install
pip install wheel_file.whl # directly install the wheel
Also see the wheel
project documentation. How do I install a Python package with a .whl file?
I just used the following which was quite simple. First open a console then cd to where you've downloaded your file like some-package.whl and use
pip install some-package.whl
Note: if pip.exe is not recognized, you may find it in the "Scripts" directory from where python has been installed. If pip is not installed, this page can help:How do I install pip on Windows?
Note: for clarification
If you copy the *.whl
file to your local drive (ex. C:\some-dir\some-file.whl) use the following command line parameters --
pip install C:/some-dir/some-file.whl
Installing and running Wheel file Pypi
I found the solution:
the setup.cfg
file was missing the options.entry_points
:
[options.entry_points]
console_scripts = tool = MyTool:main
The syntax for entry points is specified as follows:
<name> = [<package>.[<subpackage>.]]<module>[:<object>.<object>]
url: https://setuptools.pypa.io/en/latest/userguide/entry_point.html
Install local wheel file with requirements.txt
This is called a direct reference. Since version 19.3, pip support this in both command line and requirement files. Check out an example from the official documentation.
As to OP's question, simply put the local wheel's relative path, i.e., ./<my_wheel_dir>/<my_wheel.whl>
, in requirement.txt
, e.g.,
./local_wheels/ABC-0.0.2-py3-none-any.whl
Flask==1.1.2
flask-restplus==0.13.0
gunicorn==20.0.4
Install wheel file on off-line machine which has different processor
You can use the --platform flag with pip download to get the desired version of the wheel. You probably can't get the ARM wheels from PyPi (I haven't done enough with ARM myself to be sure), but piwheels should have them.
This worked for me to get numpy:
pip download --index-url=https://www.piwheels.org/simple --platform linux_armv7l --no-deps numpy
You can of course combine this with a requirements.txt file to get all of your packages at once if you wantpip download --index-url=https://www.piwheels.org/simple --platform linux_armv7l --no-deps -r requirements.txt
In requirements.txt (example):pandas==1.0.1
numpy>=1.18.1
I'm not sure exactly what version you need, but you can see available versions at piwheels (e.g. for numpy go to https://www.piwheels.org/simple/numpy/)
Related Topics
Simple Way to Query Connected Usb Devices Info in Python
Python & Pandas: How to Query If a List-Type Column Contains Something
Strip/Trim All Strings of a Dataframe
Matplotlib: How to Show a Figure That Has Been Closed
Statistics: Combinations in Python
Is It Bad Practice to Use a Built-In Function Name as an Attribute or Method Identifier
Django Post_Save() Signal Implementation
Pivot Tables or Group by for Pandas
Using Configparser to Read a File Without Section Name
Shell Script: Execute a Python Program from Within a Shell Script
What Is the Default _Hash_ in Python
Python Observer Pattern: Examples, Tips
How to Format a Date in Jinja2
Quickest Way to Make a Get_Dummies Type Dataframe from a Column with a Multiple of Strings