Install Python on Windows and Deal with Corporate Network Constraints

Featured image

Using Python in a Microsoft corporate environment can rise various issues. This article introduce 3 different options hoping that one of them will fit to your situation.

  • Install Python with Anaconda on Windows
  • Deal with corporate network constraints
    • Solve proxy problems
    • Install a Python package with pip without internet access neither administrator permissions
    • Install a Python package manually

Install Python with Anaconda on Windows

Reference: Conda documentation

Read the Anaconda documentation to see what the difference between Anaconda and Miniconda

Choose, download and install the one that fits best for your needs:

Deal with corporate network constraints

Let’s say that we would like to install the pandas_profiling package.

Solve proxy problems for the Anaconda package manager

Trying to install a Python package with the conda command line tool, you could end up with a corporate proxy problem and being stuck with something like:

conda install -c conda-forge pandas_profiling
Fetching package metadata:

To tackle that problem contact your network administrator and ask for details on the proxy.

With it edit your .condarc config file.

[conda.io] The conda configuration file, .condarc, is an optional runtime configuration file that allows advanced users to configure various aspects of conda, such as which channels it searches for packages, proxy settings and environment directories.

The .condarc file is not included by default, but it is automatically created in your home directory (C:\Users\Username) the first time you run the command: conda config
  • with credentials:
proxy_servers:
  http: http://user:pass@corp.com:8080
  https: https://user:pass@corp.com:8080

ssl_verify: False
  • without credentials:
proxy_servers:
  http: http://corp.com:8080
  https: https://corp.com:8080

ssl_verify: False

Once the proxy information has been updated, you will be able to update conda and install new packages.

Install a Python package with pip without internet access neither administrator permissions

On a machine where you have internet access, download from https://pypi.org or any other relevant source the .whl file of the package you want to install.

The .whl for pandas_profiling is downloadable from https://pypi.org/project/pandas-profiling/#files

Move this .whl file on the destination machine, the one that does not have or restricted internet access, and run the following command (replacing the .whl filename by one you just get):

pip install pandas_profiling-1.4.1-py2.py3-none-any.whl

You could probably face a red warning as:

xxxxxx xx.x.x requires xxxxxx>=xx.x.x, which is not installed.

This message indicates that you have to follow this process first for each missing Python package before being able to install the initial desired package.

Install a Python package manually

  • Download the package source files
  • Unzip it if it is
  • cd into the directory containing setup.py
  • If there is any installation instruction contained in the documentation, read it and follow the instructions OTHERWISE
  • Type in
    python setup.py install
    

You may need administrator privileges for the last step.

Upgrade all Python packages at once

pip install -U $(pip list --outdated | awk 'NR>2 {print $1}')

Export a Jupyter Notebook in PDF via LaTeX on Windows

Download and install MiKTeX

If needed, set proxy settings for MikTeX thorugh the MiKTeX Console: Settings > General

  • Check Always install missing packages on-the-fly
  • Change…
  • Check Remote package repository
  • Connexion Settings…
  • Enter your proxy infos
  • OK
  • Next
  • Select a Host from your Country
  • Finish

Still in the MiKTeXConsole, update MiKTeX packages from the Updates tab with the Check for updates and Update now buttons.

Install nbconvert

conda install -c conda-forge nbconvert

See also

Monitor SSIS job and package executions

date_range 02/09/2020

Featured image

How to monitor SSIS job and package executions.

Enable network connectivity between Docker containers on CentOS 8

date_range 15/08/2020

Featured image

Enable a network connectivity between Docker containers on CentOS 8.

Setup a GitHub repository to serve your Sphinx documentation

date_range 07/04/2020

Featured image

Sphinx and GitHub provide an efficient and free way to publish your documentation online. Here we describe how to do so.