Install python packages in windows server 2016 which has no internet connection - python

I need to install python packages in a windows server 2016 sandbox for running a developed python model in production.This doesn't have internet connection.
My laptop is windows 2010 and the model is now running in my machine and need to push this to the server.
My question is how can i install all the required packages in my server which has no internet connection.
Thanks
Mithun

For the windows server machine make sure you have pip installed and added to path.
Then proceed with the following steps:
Since you are using windows try to download the packages from Unofficial Python Binaries in your personal laptop that has an internet connection. Try to download the whl file.
Copy / transfer the downloaded whl file to the windows server machine.
Use pip to install the copied / transferred whl file.
pip install <filname>.whl
If you dont want to install any mathematical packages, you can use the official Python Package Index (PyPI) repository.
Proceed with the following steps to download a Python Library from the Official Library:
Open the Official Python Package Index page.
Search for your required package (e.g., I am searching for a library named beautifulsoup4 link)
You need to select Download Files from the side menu. e.g.,
Download the required version whl file.
Copy / transfer the downloaded whl file to the windows server machine.
Use pip to install the copied / transferred whl file.

A simply way is to install the same python version on another machine having internet access, and use normally pip on that machine. This will download a bunch of files and installs them cleanly under Lib\site_packages of your Python installation.
You can they copy that folder to the server Python installation. If you want to be able to later add packages, you should keep both installations in sync: do not add or remove any package on the laptop without syncing with the server.

Related

How can install additional python packages in Azure Machine Learning Studio?

Hey I am trying to install dash and jupyter-dash in Azure Machine Learning Studio (New- not classic). I opened terminal and installed them using pip install and they successully were installed upon checking with pip freeze. However when I open notebook I still get error:
ModuleNotFoundError.
Is there a way to add those missing libraries that I need in order to run the script in my notebook?
There are limitations when installing the additional Python packages in Azure ML Studio and therefore the only possible way to add custom python modules, you can zip all packages and modules.
For example, to install cvxpy,
Download wheel of cvpxy and the dependencies.
Decompress the files and package it in in cvpxy path as a zip file including script.
You can then upload the zip as data set.
If you are using IPython, you also can try to install the Python Package via the code !pip install cvxpy.
There are some similar SO threads which may be helpful for you, as below.
Azure ML Python with Script Bundle cannot import module
How to install a Python package from within IPython?

How do I properly import pygame in Microsoft Visual Studio Enterprise 2019? [duplicate]

I just installed the new VS2017 Preview and imported a Python project. This project has many import statements but VS2017 does show error in some import packages like cv2, socketio, eventlet, eventlet.wsgi. This Python project runs fine, out of VS2017, in my Anaconda environment. Do I need to install OpenCV 2, socketio, etc in Windows? Or is there a solution like pip, anaconda, apt-get, in the VS2017 environment that can automate the installation of unresolved package?
I also noticed that it is possible to add Anaconda to VS project created. Can this Anaconda inside VS help to install the missing packages?
Regards.
You can, however it is not perfect.
Firstly you need to bring up the Python Environments menu which can be accessed by going:
Tools -> Python -> Python Environments
It should bring up a sidebar (depending on how you have VS setup). There should be a dropdown box about half way down with the text "Overview". Click on that and you can select "Packages". This will bring up a textbox under it that will allow you to use standard pip commands to install packages.
If you are on Windows though there is one added step for some packages though. As pip does not work well on Windows, due to the fact that the standard Windows package site (PyPI) does not yet have Windows wheels for a lot of common packages.
Therefore, you are best off going to Christoph Gohlke's unofficial package site and then downloading the package you need. Once it's downloaded locally just copy and paste the LOCAL address into the textbox under "Packages". It will then install the package and you'll be good to go.
I had same problem and i could get it working with visual studio 2017 python v3.6 using following instructions
Install appropriate .whl file using this link
(cpMN where you have Python M.N). contrib includes OpenCV-extra packages. For example, assuming you have Python 3.6, you might download **opencv_python-3.2.0+contrib-cp36-none-win_amd64.whl**
link to download
Then install it by running this command from installed folder
pip install opencv_python-3*win_amd64.whl

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 add a package to python in Visual Studio 2017

I just installed the new VS2017 Preview and imported a Python project. This project has many import statements but VS2017 does show error in some import packages like cv2, socketio, eventlet, eventlet.wsgi. This Python project runs fine, out of VS2017, in my Anaconda environment. Do I need to install OpenCV 2, socketio, etc in Windows? Or is there a solution like pip, anaconda, apt-get, in the VS2017 environment that can automate the installation of unresolved package?
I also noticed that it is possible to add Anaconda to VS project created. Can this Anaconda inside VS help to install the missing packages?
Regards.
You can, however it is not perfect.
Firstly you need to bring up the Python Environments menu which can be accessed by going:
Tools -> Python -> Python Environments
It should bring up a sidebar (depending on how you have VS setup). There should be a dropdown box about half way down with the text "Overview". Click on that and you can select "Packages". This will bring up a textbox under it that will allow you to use standard pip commands to install packages.
If you are on Windows though there is one added step for some packages though. As pip does not work well on Windows, due to the fact that the standard Windows package site (PyPI) does not yet have Windows wheels for a lot of common packages.
Therefore, you are best off going to Christoph Gohlke's unofficial package site and then downloading the package you need. Once it's downloaded locally just copy and paste the LOCAL address into the textbox under "Packages". It will then install the package and you'll be good to go.
I had same problem and i could get it working with visual studio 2017 python v3.6 using following instructions
Install appropriate .whl file using this link
(cpMN where you have Python M.N). contrib includes OpenCV-extra packages. For example, assuming you have Python 3.6, you might download **opencv_python-3.2.0+contrib-cp36-none-win_amd64.whl**
link to download
Then install it by running this command from installed folder
pip install opencv_python-3*win_amd64.whl

Cannot install pymssql on windows

i am trying to install pymssql as
pip install pymssql
i have windows 7 and python 3.5 (from anaconda) but i get
Failed building wheel for pymssql
i believe its related to freetds and python-dev. how do i install these on windows?
Which packages would i need to install? this pip install worked just fine for python 2.7. If the pip does not work,is there any other way i can download and install pymssql?
I just went through this small bit of hell and finally got things working, here is what I ended up doing:
First locate your Python directory (for me it was c:\Python35), then following the instructions found on the PyMSSQL documentation download the FreeTDS binaries and the precompiled OpenSSL binaries. Open SSL binaries are built in different versions of MSVC, for me I needed the MSVC 2015 32-bit binaries (because my copy of Python is the 32-bit build). FreeTDS is a little more cryptic, here the different vs20xx versions work with different generations of Python, in my case -vs2015 worked because I am using Python 3.5 which should work for you as well.
Next extract the dlls from the '/bin' directory in the OpenSSL release and the /lib directory in the FreeTDS release into a folder (in my case I used c:\Python35\FreeTDS).
Finally add this folder to your system PATH. You can now run import pymssql and not receive any errors. On windows you can also create a config file located at C:\freetds.conf which can provide some global settings to keep your python scripts clear of any connection strings.

Categories