How can i download Linux python version module on Win? [duplicate] - python

This question already has answers here:
How to download pip module for linux using windows
(2 answers)
Closed 1 year ago.
I want to download some python package from Win to Linux.
I run pip download -r requirements.txt -d wheelhouse on Win10,
but it will download the win version package numpy-1.19.1-cp37-cp37m-win_amd64.whl
Can i download with linux verson of package on win.

I'm not entirely sure why you would want to do this. By default, pip uses your local architecture so it downloads the windows files. The pip download options has a --platform option.
You can try: pip download -r requirements.txt -d wheelhouse_linux --platform manylinux1_x86_64 [--only-binary=:all: or --no-deps]
The documentation for pip download is available here with examples.

Related

install boto3 on an offline RHEL server [duplicate]

This question already has answers here:
How to install packages offline?
(12 answers)
Closed 1 year ago.
I am trying to install boto3 on rhel 7 server.
I have pip3 installed, all the other things needed for boto3.
yum list installed | grep -i python3
I have python3.x86_64, python3-libs.x86_64, python3-pip.noarch and python3-setuptools.noarch
whereis python3
As internet connection is not setup, I am getting an error with respect to accessing
pip install boto3 #does not work due to external connection problem.
Got latest code from boto3 https://github.com/boto/boto3.git
has issues with dependencies from it.
Does anyone know of any links which might help with list of steps to follow to install boto3 when server is not connected to internet
thanks
Dan
Like raLdza pointed out
How to install packages offline?
Here are the steps:
On the system that has access to internet
The pip download command lets you download packages without installing them:
pip download -r requirements.txt
(In previous versions of pip, this was spelled pip install --download -r requirements.txt.)
On the system that has no access to internet
Then you can use
pip install --no-index --find-links /path/to/download/dir/ -r requirements.txt
to install those downloaded modules, without accessing the network.

Does Python pip work in offline environments? [duplicate]

This question already has answers here:
How to install packages offline?
(12 answers)
Closed 1 year ago.
I am currently using an offline Windows 10 environment and I need to use pip to install a package.
The traditional pip install "myPackage.tar.gz" is not working because pip makes a network request and fails because my machine has no internet.
With this in mind I tried the following command to ignore dependency checking. pip install myPackage.tar.gz -f./ --no-index –-no-deps. The command did install “Successfully ” but when I tried to use the package I got a ModuleNotFoundError.
My question is does pip work offline? If not what would be a work around?
Thank you,
Marco
Do you have those packages already downloaded in your computer?
If not, at some point you will need an internet connection.
There's pip download command which lets you download packages without installing them:
pip download -r requirements.txt
(In previous versions of pip, this was spelled pip install --download -r requirements.txt.)
When you have your packages downloaded, use pip install --no-index --find-links /path/to/download/dir/ -r requirements.txt to install what you have previously downloaded, without the need to access on internet

Download & Install pip packages offline [duplicate]

This question already has answers here:
How to install packages offline?
(12 answers)
Closed 2 years ago.
I have a virtual machine on my workplace that has no internet connection (and no docker and git). I want to install Rasa (it's an chatbot installed by Python pip package). Normally you would just type: "pip install rasa". This command doesn't function because the VM has no internet connection.
Now I installed Rasa on my private linux laptop to create a full list of dependencys that Rasa needs. How can I download all these pip packages at once? There are about 50 packages and downloading them all manually step-by-step would take many hours.
My intention is to download all requiered pip packages on my private laptop and move them (the .tar.gz files) to my Linux VM at work. After that I want to install all packages offline so that an internet connection isn't required.
Just make a requirements file:
pip freeze > requirements.txt
Then download all the packages and their dependencies:
pip download -r requirements.txt
Copy the packages to the target machine and deploy (into current dir with modules):
pip install -r requirements.txt --no-index --find-links .
Further reading is here: How to install packages offline?

How to download pip module for linux using windows

I am trying to download some modules on my windows machine, transfer them to offline Linux server via FTP where Python 3 and pip are installed. Then install the modules there using pip.
pip download --platform linux_x86_64 --only-binary=:all: --no-binary=:none: pandas
gives the error:
Could not find a version that satisfies the requirement pandas (from versions: )
No matching distribution found for pandas
I can download using the below command but it is the windows version
pip download pandas
The platform linux_x86_64 is now named manylinux1_x86_64. So run
pip download --platform manylinux1_x86_64 --only-binary=:all: --no-binary=:none: pandas
try using the code as
python3 -m pip download [package name]
Edit, if this not work:
then download the package from pypi org and then run terminal where the file is located and then type python3 -m pip install copy the name of that package including .whl and then paste that name just after 'python3 -m pip install' hope it will work

How do I install Python libraries in wheel format?

I was looking for a tutorial on how to install Python libraries in the wheel format.
It does not seem straightforward so I'd appreciate a simple step by step tutorial how to install the module named "requests" for CPython.
I downloaded it from: https://pypi.python.org/pypi/requests and now I have a .whl file. I've got Python 2.7 and 3.3 on Windows, so how do I install it so all the other Python scripts I run can use it?
You want to install a downloaded wheel (.whl) file on Python under Windows?
Install pip on your Python(s) on Windows (on Python 3.4+ it is already included)
Upgrade pip if necessary (on the command line)
pip install -U pip
Install a local wheel file using pip (on the command line)
pip install --no-index --find-links=LocalPathToWheelFile PackageName
Option --no-index tells pip to not look on pypi.python.org (which would fail for many packages if you have no compiler installed), --find-links then tells pip where to look for instead. PackageName is the name of the package (numpy, scipy, .. first part or whole of wheel file name). For more informations see the install options of pip.
You can execute these commands in the command prompt when switching to your Scripts folder of your Python installation.
Example:
cd C:\Python27\Scripts
pip install -U pip
pip install --no-index --find-links=LocalPathToWheelFile PackageName
Note: It can still be that the package does not install on Windows because it may contain C/C++ source files which need to be compiled. You would need then to make sure a compiler is installed. Often searching for alternative pre-compiled distributions is the fastest way out.
For example numpy-1.9.2+mkl-cp27-none-win_amd64.whl has PackageName numpy.
If you want to be relax for installing libraries for python.
You should using pip, that is python installer package.
To install pip:
Download ez_setup.py and then run:
python ez_setup.py
Then download get-pip.py and run:
python get-pip.py
upgrade installed setuptools by pip:
pip install setuptools --upgrade
If you got this error:
Wheel installs require setuptools >= 0.8 for dist-info support.
pip's wheel support requires setuptools >= 0.8 for dist-info support.
Add --no-use-wheel to above cmd:
pip install setuptools --no-use-wheel --upgrade
Now, you can install libraries for python, just by:
pip install library_name
For example:
pip install requests
Note that to install some library may they need to compile, so you need to have compiler.
On windows there is a site for Unofficial Windows Binaries for Python Extension Packages that have huge python packages and complied python packages for windows.
For example to install pip using this site, just download and install setuptools and pip installer from that.
To install wheel packages in python 2.7x:
Install python 2.7x (i would recommend python 2.78) - download the appropriate python binary for your version of windows . You can download python 2.78 at this site https://www.python.org/download/releases/2.7.8/
-I would recommend installing the graphical Tk module, and including python 2.78 in the windows path (environment variables) during installation.
Install get-pip.py and setuptools
Download the installer at
https://bootstrap.pypa.io/get-pip.py
Double click the above file to run it. It will install pip and setuptools [or update them, if you have an earlier version of either]
-Double click the above file and wait - it will open a black window and print will scroll across the screen as it downloads and installs [or updates] pip and setuptools --->when it finishes the window will close.
Open an elevated command prompt - click on windows start icon, enter cmd in the search field (but do not press enter), then press ctrl+shift+. Click 'yes' when the uac box appears.
A-type
cd c:\python27\scripts
[or cd \scripts ]
B-type
pip install -u
Eg to install pyside, type pip install -u pyside
Wait - it will state 'downloading PySide or -->it will download and install the appropriate version of the python package [the one that corresponds to your version of python and windows.]
Note - if you have downloaded the .whl file and saved it locally on your hard drive, type in
pip install --no-index --find-links=localpathtowheelfile packagename
**to install a previously downloaded wheel package you need to type in the following command
pip install --no-index --find-links=localpathtowheelfile packagename
Have you checked this http://docs.python.org/2/install/ ?
First you have to install the module
$ pip install requests
Then, before using it you must import it from your program.
from requests import requests
Note that your modules must be in the same directory.
Then you can use it.
For this part you have to check for the documentation.
Install distribute by downloading and running distribute_setup.py. This will make easy_install available, and from there you can install pip with easy_install pip. Then you can run pip install CAGE. Using pip to install things is a lot easier than messing with manually running setup.py, because pip can do things like:
automatically resolve dependencies
show you a list of all installed packages and their versions
install a set of specified packages from a requirements.txt
upgrade and uninstall packages
work with virtualenv
If you're on Windows, the one downside of pip occurs when there are C library dependencies, as pip will want a C toolchain installed so it can compile things. If that is the case, then there are two options. If there are precompiled binaries on PyPI, then just run easy_install package instead; easy_install knows how to use binary packages. You can also check Christoph Gohlke's site for executable installers of many binary packages. These can also be installed by easy_install if you want to use them with a virtualenv (just point it to the path of the .exe) or you can click and run if you don't care about virtualenv.
The main point is that no matter what route you choose to install packages, at no point are you ever moving around files by hand. You need to get out of the mindset of "I extracted this archive, where do I put these .py files?" That's not how it works. You're either running pip, running easy_install, running setup.py, clicking on an installer package, or using your distribution's installer. At no point are you ever doing anything by hand with the files directly.
Once you have a library downloaded you can execute this from the MS-DOS command box:
python setup.py install
The setup.py is located inside every library main folder.
For windows, there are automatic installer packages available at this site
It includes most of the python packages.
But the best way for it is of course using pip.
You don't need to download exclusively from the website. Just make sure you have pip (which you probably will if you have python installed). Just open your Command Prompt (CMD) and run the command:
pip install pygame
It will automatically download the correct whl version of pygame compatible with your configuration of PC. Make sure you remember the version which appears while "downloading" as this is the compatible version of .whl packages you shall be looking for in the future.
Simple steps to install python in Ubuntu:
Download Python
$ cd /usr/src
$ wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
Extract the downloaded package
$ sudo tar xzf Python-3.6.0.tgz
Compile Python source
$ cd Python-3.6.0
$ sudo ./configure
$ sudo make altinstall
Note make altinstall is used to prevent replacing the default python binary file /usr/bin/python.
check the python version
# python3.6 -V
i have write the answer here
How to add/use libraries in Python (3.5.1)
but no problem will rewrite it again
if u have or you can create a file requirements.txt which contains the libraries that you want to install for ex:
numpy==1.14.2
Pillow==5.1.0
You gonna situate in your folder which contains that requirements.txt in my case the path to my project is
C:\Users\LE\Desktop\Projet2_Sig_Exo3\exo 3\k-means
now just type
python -m pip install -r ./requirements.txt
and all the libararies that you want gonna install
C:\Users\LE\Desktop\Projet2_Sig_Exo3\exo 3\k-means>python -m pip install -r ./requirements.txt

Categories