Install Python 3.5.1 + numpy + scipy + α in Windows environment

Summary when Python 3.5.1 + numpy + scipy + α is installed in Windows environment (Written by a person for about a week for the first time in Python)

OS Windows 10 Pro (64 bit)

Installed Python version

Python 3.5.1 (32 bit)

Python library installed with pip

wheel (0.29.0) numpy (1.10.4) scipy (0.17.0) pandas (0.17.1) matplotlib (1.5.1) scikit-learn (0.17)

Installation of Python 3.5.1

  1. Go to https://www.python.org/
  2. Select [Downloads / Windows / Python 3.5.1] and download [python-3.5.1.exe]
  3. Run [python-3.5.1.exe]
  4. On the first screen, check [Add Python 3.5 to PATH] and click [Install Now].
  5. Confirm that python can be started from the command prompt

python


C:\Users\ktanaka>python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

C:\Users\ktanaka>

pip upgrade

The package management tool pip is installed by default from Python 3.4. Upgrade pip by running the following command from the command prompt

python


C:\Users\ktanaka>python -m pip install --upgrade pip
Collecting pip
  Downloading pip-8.0.2-py2.py3-none-any.whl (1.2MB)
    100% |################################| 1.2MB 227kB/s
Installing collected packages: pip
  Found existing installation: pip 7.1.2
    Uninstalling pip-7.1.2:
      Successfully uninstalled pip-7.1.2
Successfully installed pip-8.0.2

C:\Users\ktanaka>

In the following explanation,

python


C:\Users\ktanaka>python -m pip install --upgrade pip

Execution from a command prompt like

python


python -m pip install --upgrade pip

And omit the log. If there is a notation starting with python -m, it means execution from the command prompt.

wheel package installation

I think I read somewhere that the mechanism for installing .whl files containing binaries with pip ...

python


python -m pip install wheel

About installation of numpy, scipy

numpy and scipy call the math library internally. Therefore, it is necessary to associate the binary of the numerical calculation library with numpy and scipy. I tried various things this time, but I had a hard time installing scipy. It seems that scipy is related to numpy, so I will explain it with failure cases in my environment including installation of numpy.

Normal installation with pip (failure)

Numpy with pip,Normal installation of scipy


python -m pip install numpy
python -m pip install scipy

Looking at the log, it seems that the installation process of numpy and scipy is as follows.

numpy


Check if the Numerical Library is installed in your environment
Installed
Install numpy in association with the installed Numerical Library
Not installed
Check if a compiler such as Visual Studio is installed
Installed
Generate a binary of the numerical operation library using a compiler and install numpy in association with the generated binary.
Not installed
Installation failure

scipy


Check if the Numerical Library is installed in your environment
Installed
Install scipy in association with the installed Numerical Library
Not installed
Installation failure

As for numpy, my environment is "Numerical calculation library is not installed" "Visual Studio 2015 is installed" After a lot of compilation by Visual Studio 2015, the installation was successful.

It failed for scipy. The installation process "Similar to numpy, the source code is enclosed and processing such as generating binaries in Visual Studio 2015 runs" Or "Associate with binaries created with numpy" I was happy if it was, but it didn't happen and it ended with an error.

How to use superpack (abandoned)

At the stage of 2016/02/17, I gave up because there was no one corresponding to Python 3.5.1. https://sourceforge.net/p/numpy/activity/ https://sourceforge.net/p/scipy/activity/

Pip installation using .whl file with compiled binaries (successful)

I finally installed it this way.

  1. Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/
  2. Download numpy-1.10.4 + mkl-cp35-none-win32.whl and scipy-0.17.0-cp35-none-win32.whl
  1. Install using pip

Compiled binaries are included.pip installation using whl file


python -m pip install C:\Users\ktanaka\Downloads\numpy-1.10.4+mkl-cp35-none-win32.whl
python -m pip install C:\Users\ktanaka\Downloads\scipy-0.17.0-cp35-none-win32.whl

This way, the installation and sample script execution was successful.

Supplement

When I installed with the following combination, the installation succeeded, but an error occurred when executing the script.

Compiled binaries are included.pip installation using whl file


python -m pip install numpy
python -m pip install C:\Users\ktanaka\Downloads\scipy-0.17.0-cp35-none-win32.whl

Python script executed


from scipy import stats

Details of the error


・ ・ ・
  from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.

It seems that it is necessary to install so that the same math library is referenced by numpy and scipy, and the description of the distribution site also says "The distributed binary (.whl) is in numpy + mkl (Intel Math Kernel Library) It depends on it, "so I succeeded in installing it using .whl of numpy distributed on the same site.

Many binaries depend on NumPy-1.10+MKL and the Microsoft Visual C++ 2008 (x64, x86, and SP1 for CPython 2.6 and 2.7), Visual C++ 2010 (x64, x86, for CPython 3.3 and 3.4), or the Visual C++ 2015 (x64 and x86 for CPython 3.5) redistributable packages.

Installation of other packages

I installed the following packages. pandas (0.17.1) matplotlib (1.5.1) scikit-learn (0.17)

python


python -m pip install pandas
python -m pip install matplotlib
python -m pip install scikit-learn

pip convenient

At the end

In building a Python development environment on Windows

――Anaconda, which has various packages from the beginning, is convenient --Python installation on Windows is difficult

I was listening to the prior information

--I want to install with the minimum configuration --I want to understand things around Python package management --When I joined http://qiita-kobito-team-meetup14.peatix.com/, I heard that the Atom editor is amazing, so I want to use it: D --It seems that pip etc. are implemented as standard and the installation work is much easier.

I tried to install it for such a reason. Considering the update of numpy and scipy, I think it would be better to install the numerical calculation library separately and install it with normal pip. (I'm not sure if that method works) I'll try it when I have time.

Now I'm adding the script package to the Atom editor and running it with Ctrl + Shift + B. However, Anaconda is convenient because you can execute only the selected line. If anyone knows a package that can execute selected lines with the Atom editor package, please let me know _ (._.) _

Referenced site

Under arrangement

Recommended Posts

Install Python 3.5.1 + numpy + scipy + α in Windows environment
Install and run Python3.5 + NumPy + SciPy on Windows 10
Python install in 2 lines @Windows
Install python2.7 on windows 32bit environment
Install scrapy in python anaconda environment
Windows10: Install MeCab library in python
install tensorflow in anaconda + python3.5 environment
Install Python development environment on Windows 10
python windows environment
Using venv in Windows + Docker environment [Python]
Python garbled in Windows + Git Bash environment
Install Python3, numpy, pandas, matplotlib, etc. on Windows
python windows environment construction
Install python package in personal environment on Ubuntu
Install the python package in an offline environment
virtualenvwrapper in windows environment
Install python on windows
virtual environment in python
Development environment in Python
Install Python (for Windows)
[Python] Reason for dtype "int32" in Numpy (Windows environment) (as of September 2020)
Until you install TensorFlow-GPU with pip in Windows environment
Install Numpy on virtualenv on Windows
Install numpy in Visual Studio 2019
How to install Python [Windows]
Install Python and Flask (Windows 10)
Install Python environment with Anaconda
Windows10: Install python dlib library
Python environment construction (Windows10 + Emacs)
Handle environment variables in Python
Pip install in proxy environment
Build Python environment on Windows
Matrix multiplication in python numpy
Build python environment on windows
Python environment construction under Windows7 environment
[Python] [Chainer] [Windows] Install Chainer on Windows
Install dlib for Python (Windows)
Install OpenCV 3 (core + contrib) in Windows & Python 3 environment & Difference between OpenCV 2 and OpenCV 3 & Easy operation check
Install Jupiter Notebook on Windows with pip in proxy environment
Install CaboCha in Ubuntu environment and call it with Python.
[Python] Show multiple windows in Tkinter
Python environment construction memo on Windows 10
Pip install (Windows) under Proxy environment
Hit a command in Python (Windows)
Anaconda python environment construction on Windows 10
Put MeCab in "Windows 10; Python3.5 (64bit)"
(Windows10) Install Linux environment and gnuplot.
Install xgboost (python version) on Windows
Install Python on Windows + pip + virtualenv
Put python, numpy, opencv3 in ubuntu14
Install Pytorch on Blender 2.90 python on Windows
Self-organizing map in Python NumPy version
Various Anaconda settings in Windows 10 environment
[Python3] Development environment construction << Windows edition >>
Installation of Python, SciPy, matplotlib (Windows)
I can't install scikit-learn in Python
UnicodeDecodeError occurs in pip (Windows environment)
[docker] python3.5 + numpy + matplotlib environment construction
[Python Windows] pip install with Python version
Create a Python environment for professionals in VS Code on Windows
Install Networkx in Python 3.7 environment for use in malware data science books