Windows + virtualenv + pip + NumPy (problemas al instalar NumPy)

En Windows, normalmente solo uso el instalador binario, pero me gustaría instalar NumPy solo en un virtualenv esta vez, así que creé un env virtual:

virtualenv --no-site-packages --distribute summary_python cd summary_python/Scripts activate.bat 

Entonces intenté instalar NumPy

 pip install numpy 

Y me sale un error. Mi pip.log se pega a continuación:

 Downloading/unpacking numpy Running setup.py egg_info for package numpy non-existing path in 'numpy\\distutils': 'site.cfg' F2PY Version 2 blas_opt_info: blas_mkl_info: libraries mkl,vml,guide not found in c:\Users\fname.lname\Documents\summary_python\lib libraries mkl,vml,guide not found in C:\ NOT AVAILABLE atlas_blas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries ptf77blas,ptcblas,atlas not found in C:\ NOT AVAILABLE atlas_blas_info: libraries f77blas,cblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries f77blas,cblas,atlas not found in C:\ NOT AVAILABLE blas_info: libraries blas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries blas not found in C:\ NOT AVAILABLE blas_src_info: NOT AVAILABLE NOT AVAILABLE lapack_opt_info: lapack_mkl_info: mkl_info: libraries mkl,vml,guide not found in c:\Users\fname.lname\Documents\summary_python\lib libraries mkl,vml,guide not found in C:\ NOT AVAILABLE NOT AVAILABLE atlas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries lapack_atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries ptf77blas,ptcblas,atlas not found in C:\ libraries lapack_atlas not found in C:\ numpy.distutils.system_info.atlas_threads_info NOT AVAILABLE atlas_info: libraries f77blas,cblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries lapack_atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries f77blas,cblas,atlas not found in C:\ libraries lapack_atlas not found in C:\ numpy.distutils.system_info.atlas_info NOT AVAILABLE lapack_info: libraries lapack not found in c:\Users\fname.lname\Documents\summary_python\lib libraries lapack not found in C:\ NOT AVAILABLE lapack_src_info: NOT AVAILABLE NOT AVAILABLE running egg_info running build_src build_src building py_modules sources building library "npymath" sources No module named msvccompiler in numpy.distutils; trying from distutils Running from numpy source directory.c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:531: UserWarning: Specified path is invalid. warnings.warn('Specified path %s is invalid.' % d) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1417: UserWarning: 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__) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1426: UserWarning: Blas (http://www.netlib.org/blas/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [blas]) or by setting the BLAS environment variable. warnings.warn(BlasNotFoundError.__doc__) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1429: UserWarning: Blas (http://www.netlib.org/blas/) sources not found. Directories to search for the sources can be specified in the numpy/distutils/site.cfg file (section [blas_src]) or by setting the BLAS_SRC environment variable. warnings.warn(BlasSrcNotFoundError.__doc__) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1333: UserWarning: 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__) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1344: UserWarning: 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__) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1347: UserWarning: 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__) error: Unable to find vcvarsall.bat Complete output from command python setup.py egg_info: non-existing path in 'numpy\\distutils': 'site.cfg' F2PY Version 2 blas_opt_info: blas_mkl_info: libraries mkl,vml,guide not found in c:\Users\fname.lname\Documents\summary_python\lib libraries mkl,vml,guide not found in C:\ NOT AVAILABLE atlas_blas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries ptf77blas,ptcblas,atlas not found in C:\ NOT AVAILABLE atlas_blas_info: libraries f77blas,cblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries f77blas,cblas,atlas not found in C:\ NOT AVAILABLE blas_info: libraries blas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries blas not found in C:\ NOT AVAILABLE blas_src_info: NOT AVAILABLE NOT AVAILABLE lapack_opt_info: lapack_mkl_info: mkl_info: libraries mkl,vml,guide not found in c:\Users\fname.lname\Documents\summary_python\lib libraries mkl,vml,guide not found in C:\ NOT AVAILABLE NOT AVAILABLE atlas_threads_info: Setting PTATLAS=ATLAS libraries ptf77blas,ptcblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries lapack_atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries ptf77blas,ptcblas,atlas not found in C:\ libraries lapack_atlas not found in C:\ numpy.distutils.system_info.atlas_threads_info NOT AVAILABLE atlas_info: libraries f77blas,cblas,atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries lapack_atlas not found in c:\Users\fname.lname\Documents\summary_python\lib libraries f77blas,cblas,atlas not found in C:\ libraries lapack_atlas not found in C:\ numpy.distutils.system_info.atlas_info NOT AVAILABLE lapack_info: libraries lapack not found in c:\Users\fname.lname\Documents\summary_python\lib libraries lapack not found in C:\ NOT AVAILABLE lapack_src_info: NOT AVAILABLE NOT AVAILABLE running egg_info running build_src build_src building py_modules sources building library "npymath" sources No module named msvccompiler in numpy.distutils; trying from distutils Running from numpy source directory.c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:531: UserWarning: Specified path is invalid. warnings.warn('Specified path %s is invalid.' % d) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1417: UserWarning: 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__) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1426: UserWarning: Blas (http://www.netlib.org/blas/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [blas]) or by setting the BLAS environment variable. warnings.warn(BlasNotFoundError.__doc__) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1429: UserWarning: Blas (http://www.netlib.org/blas/) sources not found. Directories to search for the sources can be specified in the numpy/distutils/site.cfg file (section [blas_src]) or by setting the BLAS_SRC environment variable. warnings.warn(BlasSrcNotFoundError.__doc__) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1333: UserWarning: 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__) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1344: UserWarning: 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__) c:\Users\fname.lname\Documents\summary_python\build\numpy\numpy\distutils\system_info.py:1347: UserWarning: 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__) error: Unable to find vcvarsall.bat ---------------------------------------- Command python setup.py egg_info failed with error code 1 Exception information: Traceback (most recent call last): File "c:\Users\fname.lname\Documents\summary_python\lib\site-packages\pip-1.0.1-py2.7.egg\pip\basecommand.py", line 126, in main self.run(options, args) File "c:\Users\fname.lname\Documents\summary_python\lib\site-packages\pip-1.0.1-py2.7.egg\pip\commands\install.py", line 223, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "c:\Users\fname.lname\Documents\summary_python\lib\site-packages\pip-1.0.1-py2.7.egg\pip\req.py", line 986, in prepare_files req_to_install.run_egg_info() File "c:\Users\fname.lname\Documents\summary_python\lib\site-packages\pip-1.0.1-py2.7.egg\pip\req.py", line 222, in run_egg_info command_desc='python setup.py egg_info') File "c:\Users\fname.lname\Documents\summary_python\lib\site-packages\pip-1.0.1-py2.7.egg\pip\__init__.py", line 255, in call_subprocess % (command_desc, proc.returncode)) InstallationError: Command python setup.py egg_info failed with error code 1 

He tenido éxito en la instalación de binarios NumPy en un virtualenv con una buena instalación easy_install y un poco de magia para easy_install .

La numpy-1.xx-win32-superpack-python2.x.exe que descarga desde SourceForge es en realidad solo una envoltura delgada alrededor de tres distribuciones binarias separadas (con SSE3 , SSE2 o sin SSE habilitado, dependiendo de las capacidades de su CPU ). Si abre el archivo EXE superpack en 7-Zip (u otra utilidad de archivo), puede extraer esos archivos de configuración individuales en algún lugar para usarlos por separado.

Luego, active su entorno virtual, y ejecute

 easy_install c:\path\to\extracted\numpy-1.xx-sse3.exe 

para instalar los binarios optimizados para SSE3, por ejemplo. easy_install es lo suficientemente inteligente como para encontrar todo lo que necesita dentro de ese paquete wininst y extraerá el huevo comstackdo en la carpeta de paquetes de sitio de su virtualenv. También puedo confirmar que pip aún puede reconocer y / o desinstalar NumPy cuando haces esto, y que usar pip para instalar otros paquetes que dependen de NumPy funciona bien.

El único problema es saber qué nivel de optimización usar (SSE3, SSE2 o no-SSE). Si tiene un procesador razonablemente moderno (más nuevo que, por ejemplo, un Pentium 4 o Athlon 64 ), es probable que sea seguro utilizar el SSE3 completo. Probablemente también puede ejecutar el conjunto de pruebas para confirmar que todo funciona como se espera.


He encontrado que el “truco” de easy_install instalación es realmente útil para instalar todo tipo de paquetes binarios en un virtualenv. A pesar de que tengo todos los comstackdores necesarios configurados en mi máquina, generalmente es más fácil / más rápido / más seguro seguir con la versión oficial cuando se proporciona uno.

Dado que pip solo se puede instalar desde la fuente, necesita tener la configuración para comstackr y comstackr NumPy para poder usar pip. Nunca he intentado esto.

Lo que hice recientemente para obtener NumPy, SciPy y Matplotlib en un entorno virtual en Windows 7 es copiar los directorios y los archivos de huevo de mi instalación regular de Python directamente en el entorno virtual. Para Matplotlib también logré descomprimir el instalador binario directamente en virtualenv (solo probé esto para el instalador de Gohlke para Python 3.2).

En el pasado conseguí la instalación fácil de NumPy en un virtualenv desde una distribución binaria, pero esta vez no administré (NumPy 1.5.1).

Alguien recomendó http://pypi.python.org/pypi/pyg que debería permitir la instalación desde paquetes binarios a un virtualenv, pero todavía no lo he probado.

No tuve que hacer el truco de descomprimir el archivo .exe. Acabo de activar mi entorno virtual, y luego:

 easy_install numpy