Lin Ma Lin Ma - 3 months ago 110
Python Question

SciPy on Windows with Python 2.7 install issues

Wondering if anyone met with similar issues and have solutions already? Using Windows 7.

C:\Python27\Scripts>pip install SciPy
Collecting SciPy
Using cached scipy-0.18.0.tar.gz
Installing collected packages: SciPy
Running setup.py install for SciPy ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools
, tokenize;__file__='c:\\users\\foo\\appdata\\local\\temp\\pip-build-r3jpxr\\
SciPy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().r
eplace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\foo\appda
ta\local\temp\pip-efo9to-record\install-record.txt --single-version-externally-m
anaged --compile:

Note: if you need reliable uninstall behavior, then install
with pip instead of using `setup.py install`:

- `pip install .` (from a git repo or downloaded source
release)
- `pip install scipy` (last SciPy release on PyPI)


lapack_opt_info:
openblas_lapack_info:
libraries openblas not found in ['c:\\python27\\lib', 'C:\\', 'c:\\python2
7\\libs']
NOT AVAILABLE

lapack_mkl_info:
mkl_info:
libraries mkl,vml,guide not found in ['c:\\python27\\lib', 'C:\\', 'c:\\py
thon27\\libs']
NOT AVAILABLE

NOT AVAILABLE

atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
c:\python27\lib\site-packages\numpy\distutils\system_info.py:639: UserWarnin
g: Specified path C:\projects\windows-wheel-builder\atlas-builds\atlas-3.11.38-s
se2-64\lib is invalid.
warnings.warn('Specified path %s is invalid.' % d)
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE

atlas_3_10_info:
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE

atlas_info:
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE

c:\python27\lib\site-packages\numpy\distutils\system_info.py:1548: UserWarni
ng:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
warnings.warn(AtlasNotFoundError.__doc__)
lapack_info:
libraries lapack not found in ['c:\\python27\\lib', 'C:\\', 'c:\\python27\
\libs']
NOT AVAILABLE

c:\python27\lib\site-packages\numpy\distutils\system_info.py:1559: UserWarni
ng:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
warnings.warn(LapackNotFoundError.__doc__)
lapack_src_info:
NOT AVAILABLE

c:\python27\lib\site-packages\numpy\distutils\system_info.py:1562: UserWarni
ng:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
warnings.warn(LapackSrcNotFoundError.__doc__)
NOT AVAILABLE

Running from scipy source directory.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\foo\appdata\local\temp\pip-build-r3jpxr\SciPy\setup.py",
line 415, in <module>
setup_package()
File "c:\users\foo\appdata\local\temp\pip-build-r3jpxr\SciPy\setup.py",
line 411, in setup_package
setup(**metadata)
File "c:\python27\lib\site-packages\numpy\distutils\core.py", line 135, in
setup
config = configuration()
File "c:\users\foo\appdata\local\temp\pip-build-r3jpxr\SciPy\setup.py",
line 335, in configuration
config.add_subpackage('scipy')
File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 10
03, in add_subpackage
caller_level = 2)
File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 97
2, in get_subpackage
caller_level = caller_level + 1)
File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 90
9, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scipy\setup.py", line 15, in configuration
config.add_subpackage('linalg')
File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 10
03, in add_subpackage
caller_level = 2)
File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 97
2, in get_subpackage
caller_level = caller_level + 1)
File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 90
9, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scipy\linalg\setup.py", line 20, in configuration
raise NotFoundError('no lapack/blas resources found')
numpy.distutils.system_info.NotFoundError: no lapack/blas resources found

----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\foo\\appdata\\local\\temp\\pip-build-r3jpxr\\SciPy\\setup.py';exec(co
mpile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __
file__, 'exec'))" install --record c:\users\foo\appdata\local\temp\pip-efo9to
-record\install-record.txt --single-version-externally-managed --compile" failed
with error code 1 in c:\users\foo\appdata\local\temp\pip-build-r3jpxr\SciPy\


Edit 1, tried
pip install scipy-0.18.0-cp27-cp27m-win_amd64.whl
, but met with strange issues,

C:\Python27\Scripts>pip install scipy-0.18.0-cp27-cp27m-win_amd64.whl
Requirement 'scipy-0.18.0-cp27-cp27m-win_amd64.whl' looks like a filename, but t
he file does not exist
Processing c:\python27\scripts\scipy-0.18.0-cp27-cp27m-win_amd64.whl
Exception:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\python27\lib\site-packages\pip\commands\install.py", line 299, in run

requirement_set.prepare_files(finder)
File "c:\python27\lib\site-packages\pip\req\req_set.py", line 370, in prepare_
files
ignore_dependencies=self.ignore_dependencies))
File "c:\python27\lib\site-packages\pip\req\req_set.py", line 587, in _prepare
_file
session=self.session, hashes=hashes)
File "c:\python27\lib\site-packages\pip\download.py", line 798, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "c:\python27\lib\site-packages\pip\download.py", line 705, in unpack_file
_url
unpack_file(from_path, location, content_type, link)
File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 599, in unpac
k_file
flatten=not filename.endswith('.whl')
File "c:\python27\lib\site-packages\pip\utils\__init__.py", line 482, in unzip
_file
zipfp = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: 'C:\\Python27\\Scripts\\scipy-0.18
.0-cp27-cp27m-win_amd64.whl'

Answer

Some packages, such as Scipy, require a compiler to be built using pip. Windows does not come with a compiler included, so you need to download a scipy binary file that windows can work with.

A wonderful man named Christopher Gohlke from UC Irvine has developed these binaries for windows. You can find them here.

Note: If you do not have Numpy installed, you cannot install SciPy. you will also need to download the Numpy Binary (also found here). Just follow the subsequent steps to download the numpy module the same way you would download the scipy module.

Which link you install depends on whether you have a 64 bit or a 32 bit version of python, which you can check by just using the python command on your command line if you have it installed onto your PATH. Here is it visualized:

C:\Users\Bobby>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32

You can find your version in the brackets. As you can see, I am running a 64 bit version of python. So I would downloaded the "scipy-0.18.0-cp27-cp27m-win_amd64.whl" file, which assumes that I am running python 2.7 (indicated byy cp27) on a 64 bit version of python (indicated by amd64).

Note: Also make sure that pip is updated. You can update it by using the following command:

C:\Users\Bobby\Downloads>pip install --upgrade pip

Once the SciPy binary downloaded, change your working directory to your downloads folder and run pip, but use the .whl file in your downloads. Here is it visualized:

C:\Users\Bobby>cd Downloads
C:\Users\Bobby\Downloads>pip install scipy-0.18.0-cp27-cp27m-win_amd64.whl
Processing c:\users\bobby\downloads\scipy-0.18.0-cp27-cp27m-win_amd64.whl
Installing collected packages: scipy
Successfully installed scipy-0.18.0