Install wheel file on off-line machine which has different processor - python-3.x

I have a wheel file for ARM64 based platform which should be installed by pip3 install MyWheelfile.whl on an offline computer.
How can I download all the required dependencies to an online computer which is x86-64 platform?

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 want
pip 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

ERROR: torch-1.10.0+cu113-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform

I tried to install pytorch from site using,
pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio===0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
That didn't work, so I downloaded it from
'https://download.pytorch.org/whl/cu113/torch_stable.html'
and now I have a file called torch-1.10.0+cu113-cp36-cp36m-win_amd64.whl
How do I install it using pip?
pip3 install torch-1.10.0+cu113-cp36-cp36m-win_amd64.whl
You need to ensure you have CPython 3.6 otherwise you may get an error saying the file is not a supported wheel on this platform. Also, this package is compiled for 64bit Windows, so you need to be on that architecture.
More on the naming convention in this answer:
https://stackoverflow.com/questions/37023557/what-does-version-name-cp27-or-cp35-mean-in-python#:~:text=win_amd64%20%2D%20this%20has%20been%20compiled,this%20is%20a%20wheel%20distribution.
Try:
pip install --find-links https://download.pytorch.org/whl/torch_stable.html
torch==1.10.0+cpu

Python Packages Installation from local directory

There is a need to install python packages on machine without internet connection
I used pip download to download the packages and their dependencies
I copied all the dependencies to the offline machine
I run pip from the local python packages repository using
pip install *
package with dependencies are trying to access the internet to download their dependencies even that they are locate in the same directory
I would like to avoid the requirement.txt file and would like it to install all the packages from the local directory with their dependencies.
Is there any way to do so?
It's possible to download the wheels directly for each package, and once you have them on the machine you can run pip install name-of-wheel.whl and it will install them without routing to pypi.
You can use on the online machine:
pip download -r requirements.txt
to download package without installing them.
Then, on the offline machine:
pip install --no-index --find-links /path/to/download/dir/ -r requirements.txt
Source: Python Packages Offline Installation

setuptools, use package on local system instead of getting it from PyPI

There is an open-source python package that I want to work on (toga-android). To test the code I write, I have to be able to build my own project that has said open-source package as a dependency. My project has to be built with setuptools, so I need setuptools to fulfill the dependency using my version of the package, and not get the package from PyPI.
The problem is that setuptools always gets the package from PyPI.
Whenever I build with setuptools I see:
Collecting toga-android==0.3.0.dev8
Downloading https://files.pythonhosted.org/packages/92/fe/348a39e2e0bbcac2d3ed511dd2b62943b488e7dcb8097c437416caf1c179/toga_android-0.3.0.dev8-py3-none-any.whl
or
Collecting toga-android==0.3.0.dev8
Using cached https://files.pythonhosted.org/packages/92/fe/348a39e2e0bbcac2d3ed511dd2b62943b488e7dcb8097c437416caf1c179/toga_android-0.3.0.dev8-py3-none-any.whl
Clearly it is getting the package from PyPI or using a cached version from it.
I have installed my version using pip install -e . , and that has no effect. I have also tried including the package's source in my project's directory with setup.py. Setuptools apparently includes this code because syntax errors there make the build fail, but it doesn't recognize that it can satisfy the dependency. It still gets the package from PyPI and any modules imported from the package are the PyPI versions.
How can I use of custom version of a package that is also in PyPI as a setuptools dependency?
Steps to reproduce:
pip install briefcase (using or not using virtualenv does not matter)
git clone https://github.com/pybee/toga.git
cd ~/toga/src/core; sudo pip install -e .
cd ~/toga/src/android/; sudo pip install -e .
cd ~/toga/examples/tutorial0
python setup.py android
The output will show that an older version of toga-android is downloaded even though it was already installed with pip.

Not able to install scipy, matplotlob and scikit-learn using pip 1.5.6

Trying to install
pip install numpy
pip install scipy
pip install matplotlib
pip install scikit-learn
It failed with scipy, matplotlib and scikit-learn.
(from https://pypi.python.org/simple/scipy/) because it is not compatible with this Python
Skipping
My python version is 3.4 and pip version is 1.5.6
please help me install those above package
With pip 1.5.6 it will try to compile those projects from source which requires a lot of system dependencies (especially for scipy, you need gfortran and an optimized BLAS/LAPACK implementation).
I assume you are using the system provided version of pip under Linux. I would recommend to either use the latest version of pip (8.1 or later) in an a virtualenv (to avoid replacing the files of the system installed version of pip). Then you should be able to install manylinux wheels which do not require the compilation step.
Alternatively you can install miniconda and install those packages with the conda command line instead of pip.
Forget shitty pip, which is flawed beyond repair (static linking etc.)
Download IPython with the Anaconda Suite.... https://www.continuum.io/downloads
It brings most of the needed modules for scientific computing (as it is a crappy task if you have to download stuff to site-packages and run python setup.py install 3781 times..)
I wrote several programs using matplotlib, scipy, numpy etc with it..
Moreover it sports module package manager (comparable to Synaptic on Ubuntu..) if you are to lazy for the above mentioned task (and you are..).
Greets Dr. Cobra

Why isn't pip v7.1.0 caching wheels?

I'm running pip v7.1.0 (latest as of this writing) and running into an issue where it's not caching at all.
Here is how I'm installing Django -
pip install --cache-dir=d:\pipcache django
The package installs successfully, but there is nothing cached. I've read the latest documentation and checked my AppData/Local path and it's empty. What I'm looking to do is have everything I install through pip cached, so all subsequent virtual environment creations are quick.
EDIT
Turns out that pip won't cache packages that have wheel files. I tried forcing pip to build the source --no-binary=django to no avail.
Having said that, how can I force pip to cache my requirements whether the maintainers have provided wheels or not?
Based on my understanding of pip, this should be the new default. Not sure why it isn't working, though.
Alternatively, I have to do this -
pip wheel --wheel-dir="D:/"-r reqs
pip install --no-index --find-links="D:/" -r reqs
Is this within a venv? If so, you may have to explicitly install wheel into the venv using pip install wheel. After that, pip should start automatically building/caching your wheels.

Resources