Need to install pymysql without using pip [duplicate] - python

This question already has answers here:
installing python packages without internet and using source code as .tar.gz and .whl
(7 answers)
Closed 4 years ago.
On my job, I need to install pymysql on several secured servers. They do not allow internet access, so I can not use pip. I did download the pymysql egg, but this requires cryprography. So I downloaded the cryptography wheel, but when running pip install on that it tries to get additional data from the web.
I'm using python3.7. Any way to get the whole pymysql package including all dependencies off line?

install pipmysql without internet
To install pmyssql on a system with no internet connectivity, you first download pymssql to a system.
Follow these steps:
1) Download the Windows installer for the Python version and processor
that is compatible with your system from the following website:
https://pypi.python.org/pypi/pymssql/2.1.1#downloads.
2) Copy the file to the CA Strong Authentication or CA Risk
Authentication server.
3) Run the installer and follow the prompts.

#zappfinger. I would suggest you download your main package and its dependencies to a local directory. Then use pip install -r requirements.txt to perform your task. For more information read link and have a look at pip help install. You should normally get your work done after carefully consulting all these help.

With the wheel's for both pymysql and cryptography in the same folder on your server, try:
pip install --find-links DIR --no-index pymysql
--find-links and --no-index will force pip to resolve the dependency only using the files in the directory DIR.
See:
https://pip.pypa.io/en/stable/user_guide/#installing-from-local-packages
installing python packages without internet and using source code as .tar.gz and .whl
And check out: https://pythonhosted.org/Basket/ for a way to put together a "basket" of packages w/ dependencies for this type of situation.

Related

How to forward the library downloaded with pip? [duplicate]

This question already has answers here:
How to install packages offline?
(12 answers)
installing python packages without internet and using source code as .tar.gz and .whl
(7 answers)
Closed 1 year ago.
I have two linux servers, one can be connected to the Internet, and the other can't. I downloaded some libraries using pip install library on a server that can be connected to the Internet, and I want to transfer it to another server. But how to set install paths? And how do I know which files are installed by pip? Or is there a better way to achieve this?
Thanks
I would utilize wheel in this case, which can make packages that you can bring to your offline machine. For example with numpy
pip wheel numpy
Collecting numpy
Downloading numpy-1.20.2-cp37-cp37m-win_amd64.whl (13.6 MB)
Saved c:\numpy-1.20.2-cp37-cp37m-win_amd64.whl
Then on your other machine copy these wheels and use pip
pip install numpy-1.20.2-cp37-cp37m-win_amd64.whl
You can do a similar thing with requirements.txt to gather a number of wheels at once.
I think the easiest thing to do would be to install the modules in a virtual environment, e.g. python3 -m venv .venv followed by your pip install <module> and then copy the entire .venv directory to the remote machine.
Cory Kramer suggests using wheels which a good alternative option too. Either method should work.

distribution package for pyautogui and openpyxl

I want to install pyautogui, openpyxl with Python in a machine which does not connect to internet. Is there a distribution package of python which can do this?
You can use pip for that. However, you need a computer with internet connection (and python installed) to download the required packages first:
On the computer with internet connection, open a command line and say
pip download pyautogui openpyxl
Copy all downloaded files to the target machine, then install with
pip install ...
Where ... means all downloaded files. It is important to put them all in one line. So, all dependencies can be resolved (otherwise you need to take care to install the dependencies first).
Following steps worked for me successfully -
Dowload Anconda 3 package in a system where internet connection is there.
Download pyautogui.tar.bz2 using "pip download pytuatogui".
Copy both to a system where internet connection is not there.
Install Anacoda 3 manually.
Install the pyuaotgui.tar.bz2 using command
"conda install /path/to/local/file/.tar.bz2
Then things started working properly in a system where internet connection was not possible.

How to install nltk [duplicate]

I'm having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don't have an executable for Python 2.6.
For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\site-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!
The accepted answer is outdated. So first, pip is preferred over easy_install, (Why use pip over easy_install?). Then follow these steps to install pip on Windows, it's quite easy.
Install setuptools:
curl https://bootstrap.pypa.io/ez_setup.py | python
Install pip:
curl https://bootstrap.pypa.io/get-pip.py | python
Optionally, you can add the path to your environment so that you can use pip anywhere. It's somewhere like C:\Python33\Scripts.
Newer versions of Python for Windows come with the pip package manager. (source)
pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4
Use that to install packages:
cd C:\Python\Scripts\
pip.exe install <package-name>
So in your case it'd be:
pip.exe install mechanize
This is a good tutorial on how to get easy_install on windows. The short answer: add C:\Python26\Scripts (or whatever python you have installed) to your PATH.
You don't need the executable for setuptools.
You can download the source code, unpack it, traverse to the downloaded directory and run python setup.py install in the command prompt
Starting with Python 2.7, pip is included by default. Simply download your desired package via
python -m pip install [package-name]
As I wrote elsewhere
Packaging in Python is dire. The root cause is that the language ships without a package manager.
Fortunately, there is one package manager for Python, called Pip. Pip is inspired by Ruby's Gem, but lacks some features. Ironically, Pip itself is complicated to install. Installation on the popular 64-bit Windows demands building and installing two packages from source. This is a big ask for anyone new to programming.
So the right thing to do is to install pip. However if you can't be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/~gohlke/pythonlibs/
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
Firstly, you'll need to add python installation to your PATH variable. This should help.
You need to download the package in zip format that you are trying to install and unzip it. If it is some odd zip format use 7Zip and it should be extracted.
Navigate to the directory extracted with setup.py using Windows Powershell (Use link for it if you have problems)
Run the command python setup.py install
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
Upgrade the pip via command prompt ( Python Directory )
D:\Python 3.7.2>python -m pip install --upgrade pip
Now you can install the required Module
D:\Python 3.7.2>python -m pip install <<yourModuleName>>
pip is the package installer for python, update it first, then download what you need
python -m pip install --upgrade pip
Then:
python -m pip install <package_name>
You can also just download and run ez_setup.py, though the SetupTools documentation no longer suggests this. Worked fine for me as recently as 2 weeks ago.
PS D:\simcut> C:\Python27\Scripts\pip.exe install networkx
Collecting networkx
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An HTTPS reques
t has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may caus
e the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer ve
rsion of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissi
ngwarning.
SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SS
LContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL con
nections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.
readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB)
100% |################################| 1.3MB 664kB/s
Collecting decorator>=3.4.0 (from networkx)
Downloading decorator-4.0.11-py2.py3-none-any.whl
Installing collected packages: decorator, networkx
Successfully installed decorator-4.0.11 networkx-1.11
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object i
s not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade
to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplat
formwarning.
InsecurePlatformWarning
Or just put the directory to your pip executable in your system path.
As mentioned by Blauhirn after 2.7 pip is preinstalled. If it is not working for you it might need to be added to path.
However if you run Windows 10 you no longer have to open a terminal to install a module. The same goes for opening Python as well.
You can type directly into the search menu pip install mechanize, select command and it will install:
If anything goes wrong however it may close before you can read the error but still it's a useful shortcut.

How to install Yaml and some other Python modules on OS X sierra? [duplicate]

I'm having a hard time setting up python packages. EasyInstall from SetupTools is supposed to help that, but they don't have an executable for Python 2.6.
For instance to install Mechanize, I'm just supposed to put the Mechanize folder in C:\Python24\Lib\site-packages according to INSTALL.txt, but runnning the tests does not work. Can someone help shed some light on this? Thanks!
The accepted answer is outdated. So first, pip is preferred over easy_install, (Why use pip over easy_install?). Then follow these steps to install pip on Windows, it's quite easy.
Install setuptools:
curl https://bootstrap.pypa.io/ez_setup.py | python
Install pip:
curl https://bootstrap.pypa.io/get-pip.py | python
Optionally, you can add the path to your environment so that you can use pip anywhere. It's somewhere like C:\Python33\Scripts.
Newer versions of Python for Windows come with the pip package manager. (source)
pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4
Use that to install packages:
cd C:\Python\Scripts\
pip.exe install <package-name>
So in your case it'd be:
pip.exe install mechanize
This is a good tutorial on how to get easy_install on windows. The short answer: add C:\Python26\Scripts (or whatever python you have installed) to your PATH.
You don't need the executable for setuptools.
You can download the source code, unpack it, traverse to the downloaded directory and run python setup.py install in the command prompt
Starting with Python 2.7, pip is included by default. Simply download your desired package via
python -m pip install [package-name]
As I wrote elsewhere
Packaging in Python is dire. The root cause is that the language ships without a package manager.
Fortunately, there is one package manager for Python, called Pip. Pip is inspired by Ruby's Gem, but lacks some features. Ironically, Pip itself is complicated to install. Installation on the popular 64-bit Windows demands building and installing two packages from source. This is a big ask for anyone new to programming.
So the right thing to do is to install pip. However if you can't be bothered, Christoph Gohlke provides binaries for popular Python packages for all Windows platforms http://www.lfd.uci.edu/~gohlke/pythonlibs/
In fact, building some Python packages requires a C compiler (eg. mingw32) and library headers for the dependencies. This can be a nightmare on Windows, so remember the name Christoph Gohlke.
I had problems in installing packages on Windows. Found the solution. It works in Windows7+. Mainly anything with Windows Powershell should be able to make it work. This can help you get started with it.
Firstly, you'll need to add python installation to your PATH variable. This should help.
You need to download the package in zip format that you are trying to install and unzip it. If it is some odd zip format use 7Zip and it should be extracted.
Navigate to the directory extracted with setup.py using Windows Powershell (Use link for it if you have problems)
Run the command python setup.py install
That worked for me when nothing else was making any sense. I use Python 2.7 but the documentation suggests that same would work for Python 3.x also.
Upgrade the pip via command prompt ( Python Directory )
D:\Python 3.7.2>python -m pip install --upgrade pip
Now you can install the required Module
D:\Python 3.7.2>python -m pip install <<yourModuleName>>
pip is the package installer for python, update it first, then download what you need
python -m pip install --upgrade pip
Then:
python -m pip install <package_name>
You can also just download and run ez_setup.py, though the SetupTools documentation no longer suggests this. Worked fine for me as recently as 2 weeks ago.
PS D:\simcut> C:\Python27\Scripts\pip.exe install networkx
Collecting networkx
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An HTTPS reques
t has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may caus
e the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer ve
rsion of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissi
ngwarning.
SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SS
LContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL con
nections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.
readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading networkx-1.11-py2.py3-none-any.whl (1.3MB)
100% |################################| 1.3MB 664kB/s
Collecting decorator>=3.4.0 (from networkx)
Downloading decorator-4.0.11-py2.py3-none-any.whl
Installing collected packages: decorator, networkx
Successfully installed decorator-4.0.11 networkx-1.11
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object i
s not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade
to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplat
formwarning.
InsecurePlatformWarning
Or just put the directory to your pip executable in your system path.
As mentioned by Blauhirn after 2.7 pip is preinstalled. If it is not working for you it might need to be added to path.
However if you run Windows 10 you no longer have to open a terminal to install a module. The same goes for opening Python as well.
You can type directly into the search menu pip install mechanize, select command and it will install:
If anything goes wrong however it may close before you can read the error but still it's a useful shortcut.

installing python packages on production system(windows) without internet access and no internal pypi server

Is there a way to install python packages on systems without internet access and no internal pypi server.
I have tried installing it on local machine and then moving the package from site-packages to target location but it does not works.
Any other options.
Thanks
Yes there is a way my friend, you need to download first the packages and dependency of them to a folder and use pip package manager with a requirements file like this:
pip install --no-index --find-links=[file://] -r requirements.txt
and if you want to download all the packages first in one hit use this:
pip install --download -r requirements.txt
for more read here:
https://pip.pypa.io/en/stable/user_guide/#installing-from-local-packages
#maverick
I had the situation and the answer from Reidel helped me. In my case, I knew I just had one package to install (i.e: pathlib).
To get the package to transfer to the offline machine, you can as well go to pypi.org and download the package ( https://pypi.org/project/pathlib/#files in my case).
To install it on the offline machine, I entered :
pip install --no-index --find-links=DIR PACKAGE_FILE
Hope it will help.

Categories