Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
08b6405c
提交
08b6405c
authored
11月 30, 2016
作者:
Frédéric Bastien
提交者:
GitHub
11月 30, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5290 from mingwandroid/conda-fixes
Conda fixes
上级
dc464643
f2573508
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
99 行增加
和
61 行删除
+99
-61
install_windows.txt
doc/install_windows.txt
+23
-18
__init__.py
theano/__init__.py
+0
-4
__init__.py
theano/compat/__init__.py
+27
-0
configdefaults.py
theano/configdefaults.py
+49
-39
没有找到文件。
doc/install_windows.txt
浏览文件 @
08b6405c
...
@@ -32,6 +32,8 @@ C/C++ (for Python 2.7 family this has to be Microsoft Visual Studio
...
@@ -32,6 +32,8 @@ C/C++ (for Python 2.7 family this has to be Microsoft Visual Studio
version supporting Visual Studio 2008), and GCC (for non-CUDA C code
version supporting Visual Studio 2008), and GCC (for non-CUDA C code
generated by Theano).
generated by Theano).
.. _gpu_windows:
.. _gpu_windows:
Visual Studio and CUDA
Visual Studio and CUDA
...
@@ -108,6 +110,26 @@ during installation:
...
@@ -108,6 +110,26 @@ during installation:
Scientific Python distribution
Scientific Python distribution
##############################
##############################
Recommended: Anaconda
+++++++++++++++++++++
ContinuumIO_ provides a free Python distribution for all 3 main desktop
operating systems, including Windows 32-bit and 64-bit, and includes
Theano and all of its dependencies. This is one of the the easiest ways
to get Theano on Windows. Simply download and execute the installer from the
`Anaconda download page <https://www.continuum.io/downloads>`__,
and execute the following from the ``Anaconda Prompt``:
.. _ContinuumIO: http://continuum.io
.. code-block:: bash
$ conda install theano
Alternative: WinPython
++++++++++++++++++++++
We highly recommend the Pierre Raybaut's `WinPython
We highly recommend the Pierre Raybaut's `WinPython
<http://winpython.sourceforge.net/>`_ distribution - it is compiled
<http://winpython.sourceforge.net/>`_ distribution - it is compiled
for both 32- and 64-bit systems, links against the fast `MKL
for both 32- and 64-bit systems, links against the fast `MKL
...
@@ -178,23 +200,6 @@ can download the installation for free.
...
@@ -178,23 +200,6 @@ can download the installation for free.
Alternative: Anaconda
+++++++++++++++++++++++
ContinuumIO_ is providing a free Python distribution for Windows (32-bit
and 64-bit), including all dependencies of Theano. If you are not
eligible for a download of EPD or Canopy (via a commercial, or free academic
licence), this is the easiest way to install
Theano's dependencies. Simply download and execute the installer from
`Anaconda download page <https://store.continuum.io/cshop/anaconda/>`__,
and execute the following in Windows command line:
.. _ContinuumIO: http://continuum.io
.. code-block:: bash
$ conda install mingw libpython
Alternative: Python(x,y)
Alternative: Python(x,y)
++++++++++++++++++++++++
++++++++++++++++++++++++
...
@@ -358,10 +363,10 @@ most useful, because you can update it with a single ``git pull``
...
@@ -358,10 +363,10 @@ most useful, because you can update it with a single ``git pull``
command. Therefore we recommend it. However, a manual install without
command. Therefore we recommend it. However, a manual install without
Git is also possible.
Git is also possible.
Git Install
Git Install
###########
###########
Theano is hosted on GitHub, you need Git to download it. For Windows,
Theano is hosted on GitHub, you need Git to download it. For Windows,
download and install the `MSYSGIT <http://msysgit.github.io/>`_ build.
download and install the `MSYSGIT <http://msysgit.github.io/>`_ build.
Open up the `Git Shell` in the directory in which you want to install
Open up the `Git Shell` in the directory in which you want to install
...
...
theano/__init__.py
浏览文件 @
08b6405c
...
@@ -31,10 +31,6 @@ import logging
...
@@ -31,10 +31,6 @@ import logging
import
sys
import
sys
if
sys
.
platform
==
'win32'
and
sys
.
version_info
[
0
:
2
]
==
(
3
,
5
):
raise
RuntimeError
(
"Theano do not support Python 3.5 on Windows. Use Python 2.7 or 3.4."
)
theano_logger
=
logging
.
getLogger
(
"theano"
)
theano_logger
=
logging
.
getLogger
(
"theano"
)
logging_default_handler
=
logging
.
StreamHandler
()
logging_default_handler
=
logging
.
StreamHandler
()
logging_default_formatter
=
logging
.
Formatter
(
logging_default_formatter
=
logging
.
Formatter
(
...
...
theano/compat/__init__.py
浏览文件 @
08b6405c
...
@@ -107,3 +107,30 @@ class DefaultOrderedDict(OrderedDict):
...
@@ -107,3 +107,30 @@ class DefaultOrderedDict(OrderedDict):
return
type
(
self
)(
self
.
default_factory
,
self
)
return
type
(
self
)(
self
.
default_factory
,
self
)
__all__
+=
[
'DefaultOrderedDict'
]
__all__
+=
[
'DefaultOrderedDict'
]
def
maybe_add_to_os_environ_pathlist
(
var
,
newpath
):
'''Unfortunately, Conda offers to make itself the default Python
and those who use it that way will probably not activate envs
correctly meaning e.g. mingw-w64 g++ may not be on their PATH.
This function ensures that, if `newpath` is an absolute path,
and it is not already in os.environ[var] it gets added to the
front.
The reason we check first is because Windows environment vars
are limited to 8191 characters and it is easy to hit that.
`var` will typically be 'PATH'. '''
import
os
if
os
.
path
.
isabs
(
newpath
):
try
:
oldpaths
=
os
.
environ
[
var
]
.
split
(
os
.
pathsep
)
if
newpath
not
in
oldpaths
:
newpaths
=
os
.
pathsep
.
join
([
newpath
]
+
oldpaths
)
os
.
environ
[
var
]
=
newpaths
except
:
pass
__all__
+=
[
'maybe_add_to_os_environ_pathlist'
]
theano/configdefaults.py
浏览文件 @
08b6405c
...
@@ -19,6 +19,7 @@ from theano.configparser import (AddConfigVar, BoolParam, ConfigParam, EnumStr,
...
@@ -19,6 +19,7 @@ from theano.configparser import (AddConfigVar, BoolParam, ConfigParam, EnumStr,
TheanoConfigParser
,
THEANO_FLAGS_DICT
)
TheanoConfigParser
,
THEANO_FLAGS_DICT
)
from
theano.misc.cpucount
import
cpuCount
from
theano.misc.cpucount
import
cpuCount
from
theano.misc.windows
import
call_subprocess_Popen
,
output_subprocess_Popen
from
theano.misc.windows
import
call_subprocess_Popen
,
output_subprocess_Popen
from
theano.compat
import
maybe_add_to_os_environ_pathlist
_logger
=
logging
.
getLogger
(
'theano.configdefaults'
)
_logger
=
logging
.
getLogger
(
'theano.configdefaults'
)
...
@@ -418,6 +419,19 @@ try:
...
@@ -418,6 +419,19 @@ try:
except
OSError
:
except
OSError
:
rc
=
1
rc
=
1
# Anaconda on Windows has mingw-w64 packages including GCC, but it may not be on PATH.
if
rc
!=
0
:
if
sys
.
platform
==
"win32"
:
mingw_w64_gcc
=
os
.
path
.
join
(
os
.
path
.
dirname
(
sys
.
executable
),
"Library"
,
"mingw-w64"
,
"bin"
,
"g++"
)
try
:
rc
=
call_subprocess_Popen
([
mingw_w64_gcc
,
'-v'
])
if
rc
==
0
:
maybe_add_to_os_environ_pathlist
(
'PATH'
,
os
.
path
.
dirname
(
mingw_w64_gcc
))
except
OSError
:
rc
=
1
if
rc
!=
0
:
_logger
.
warning
(
"g++ not available, if using conda: `conda install m2w64-toolchain`"
)
if
rc
!=
0
:
if
rc
!=
0
:
param
=
""
param
=
""
...
@@ -1237,39 +1251,38 @@ def default_blas_ldflags():
...
@@ -1237,39 +1251,38 @@ def default_blas_ldflags():
[
'-l
%
s'
%
l
for
l
in
[
"mk2_core"
,
"mk2_intel_thread"
,
[
'-l
%
s'
%
l
for
l
in
[
"mk2_core"
,
"mk2_intel_thread"
,
"mk2_rt"
]])
"mk2_rt"
]])
# Anaconda
# MKL
if
"Anaconda"
in
sys
.
version
or
"Continuum"
in
sys
.
version
:
# If mkl can be imported then use it. On conda:
# If the "mkl-service" conda package (available
# "conda install mkl-service" installs the Python wrapper and
# through Python package "mkl") is installed and
# the low-level C libraries as well as optimised version of
# importable, then the libraries (installed by conda
# numpy and scipy.
# package "mkl-rt") are actually available. Using
try
:
# "conda install mkl" will install both, as well as
import
mkl
# noqa
# optimized versions of numpy and scipy.
except
ImportError
as
e
:
try
:
if
any
([
m
for
m
in
(
'conda'
,
'Continuum'
)
if
m
in
sys
.
version
]):
import
mkl
# noqa
_logger
.
warning
(
'install mkl with `conda install mkl-service`:
%
s'
,
e
)
except
ImportError
as
e
:
else
:
_logger
.
info
(
'Conda mkl is not available:
%
s'
,
e
)
# This branch is executed if no exception was raised
if
sys
.
platform
==
"win32"
:
lib_path
=
[
os
.
path
.
join
(
sys
.
prefix
,
'Library'
,
'bin'
)]
flags
=
[
'-L"
%
s"'
%
lib_path
]
else
:
else
:
# This branch is executed if no exception was raised
lib_path
=
blas_info
.
get
(
'library_dirs'
,
[])
if
sys
.
platform
==
"win32"
:
flags
=
[]
lib_path
=
os
.
path
.
join
(
sys
.
prefix
,
'DLLs'
)
if
lib_path
:
flags
=
[
'-L"
%
s"'
%
lib_path
]
flags
=
[
'-L
%
s'
%
lib_path
[
0
]]
else
:
flags
+=
[
'-l
%
s'
%
l
for
l
in
[
"mkl_core"
,
lib_path
=
blas_info
.
get
(
'library_dirs'
,
[])
"mkl_intel_thread"
,
flags
=
[]
"mkl_rt"
]]
if
lib_path
:
res
=
try_blas_flag
(
flags
)
flags
=
[
'-L
%
s'
%
lib_path
[
0
]]
if
res
:
flags
+=
[
'-l
%
s'
%
l
for
l
in
[
"mkl_core"
,
return
res
"mkl_intel_thread"
,
flags
.
extend
([
'-Wl,-rpath,'
+
l
for
l
in
"mkl_rt"
]]
blas_info
.
get
(
'library_dirs'
,
[])])
res
=
try_blas_flag
(
flags
)
res
=
try_blas_flag
(
flags
)
if
res
:
if
res
:
return
res
maybe_add_to_os_environ_pathlist
(
'PATH'
,
lib_path
[
0
])
flags
.
extend
([
'-Wl,-rpath,'
+
l
for
l
in
return
res
blas_info
.
get
(
'library_dirs'
,
[])])
res
=
try_blas_flag
(
flags
)
if
res
:
return
res
# to support path that includes spaces, we need to wrap it with double quotes on Windows
# to support path that includes spaces, we need to wrap it with double quotes on Windows
path_wrapper
=
"
\"
"
if
os
.
name
==
'nt'
else
""
path_wrapper
=
"
\"
"
if
os
.
name
==
'nt'
else
""
...
@@ -1298,13 +1311,10 @@ def default_blas_ldflags():
...
@@ -1298,13 +1311,10 @@ def default_blas_ldflags():
if
res
:
if
res
:
return
res
return
res
# Try to add the anaconda lib directory to runtime loading of lib.
# Add sys.prefix/lib to the runtime search path. On
# This fix some case with Anaconda 2.3 on Linux.
# non-system installations of Python that use the
# Newer Anaconda still have this problem but only have
# system linker, this is generally neccesary.
# Continuum in sys.version.
if
sys
.
platform
in
(
"linux"
,
"darwin"
):
if
((
"Anaconda"
in
sys
.
version
or
"Continuum"
in
sys
.
version
)
and
"linux"
in
sys
.
platform
):
lib_path
=
os
.
path
.
join
(
sys
.
prefix
,
'lib'
)
lib_path
=
os
.
path
.
join
(
sys
.
prefix
,
'lib'
)
ret
.
append
(
'-Wl,-rpath,'
+
lib_path
)
ret
.
append
(
'-Wl,-rpath,'
+
lib_path
)
res
=
try_blas_flag
(
ret
)
res
=
try_blas_flag
(
ret
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论