カテゴリーアーカイブ: Uncategorized

hypervisor を off にする必要がある場合がある。

管理者権限で

bcdedit /set hypervisorlaunchtype off

 

PATH に以下を加えておく
C:\Users\[User-Name]\Anaconda3;
C:\Users\[User-Name]\Anaconda3\Scripts;
C:\Users\[User-Name]\Anaconda3\bin;

setting.json

{
“terminal.integrated.shell.windows”: “C:\\Windows\\system32\\cmd.exe”
}

CuPy のインストール

conda install cupy
conda install cudnn=9

確認

cupy.__version__
cupy.cuda.Device(0).compute_capability
cupy.cuda.cudnn.get_build_version()

cudnn=10 ではうまくいかず

https://qiita.com/kimisyo/items/5a651eb84c5111ab5bdc を参考 に RDKit 2019_03_3 に合わせて修正。

一般化したバッチファイル: https://github.com/kazuyaujihara/build-rdkit

Install Visual Studio 2017

Install CMAKE

  • If you did not install CMAKE, install it. CMAKE installed with Visual Studio 2017 can be used.
  • Download and install CMAKE. Version 3.15.1 is used in this case.
  • Add CMAKE binary path typically ‘C:\Program Files (x86)\CMake\bin’ to environment variable ‘Path’.

Install Python

  • Install Python by installer with enabling pip. Python 3.6.8 are installed in ‘C:\Python36’ in this case.
  • Add ‘C:\Python36’ to environment variable ‘Path’.
  • Install numpy as below.
cd c:\Pytyon36
.\Scripts\pip.exe install numpy

Prepare zlib

  • Download zlib 1.2.11 from <https://www.zlib.net/zlib1211.zip&gt;.
  • Unzip and extract to C:\zlib.
  • Execute below in  ’Developer Command Prompt for Visual Studio 2017’ command prompt.
cd C:\zlib
mkdir build
cd build
cmake -G"Visual Studio 15 2017 Win64" ..
MSBuild zlib.sln /p:Configuration=Release,Platform=x64 -maxcpucount:%NUMBER_OF_PROCESSORS%
copy /Y zconf.h ..

Prepare Boost

cd C:\boost
bootstrap.bat
b2 -sZLIB_SOURCE="C:\zlib" -sZLIB_INCLUDE="C:\zlib" -sZLIB_LIBPATH="C:\zlib\build\Release" -sZLIB_BINARY="C:\zlib\build\Release\zlib.lib" architecture=x86 address-model=64 threading=multi runtime-link=shared --build-type=minimal link=shared --stagedir=stage/x64 stage -j %NUMBER_OF_PROCESSORS%(sZLIB_SOURCE, -sZLIB_INCLUDE and  -sZLIB_LIBPATH are required)
  • Compiled and linked libraries are created in the ‘C:\Boost\lib’ directory.  Check the followings are created or not.
    • boost_python36-vc141-mt-x64-1_70.lib
    • boost_numpy36-vc141-mt-x64-1_70.lib
    • boost_random-vc141-mt-x64-1_70.lib
    • boost_serialization-vc141-mt-x64-1_70.lib
    • boost_zlib-vc141-mt-x64-1_70.lib

Prepare Eigen3

Build RDKit

cd C:\rdkit
mkdir build
cd build
cmake -DRDK_BUILD_PYTHON_WRAPPERS=ON -DBOOST_ROOT="C:/Boost/stage/x64" -DZLIB_LIBRARY="C:/zlib/build/Release/zlib.lib" -DZLIB_INCLUDE_DIR="C:/zlib" -DEIGEN3_INCLUDE_DIR="C:/eigen3" -DRDK_BUILD_INCHI_SUPPORT=ON -DRDK_BUILD_AVALON_SUPPORT=ON -G"Visual Studio 15 2017 Win64" ..
REM Backslashes are needed to be replaced to slash.
MSBuild RDKit.sln /p:Configuration=Release,Platform=x64 -maxcpucount:%NUMBER_OF_PROCESSORS%
MSBuild INSTALL.vcxproj /p:Configuration=Release,Platform=x64 -maxcpucount:%NUMBER_OF_PROCESSORS%
  • Built modules are stored in ‘C:\rdkit\rdkit’ directory.

Prepare envirnment

  • Add ‘C:\rdkit’ to environment variable ‘PYTHONPATH’.
  • Add ‘C:\boost\lib’ to environment variable ‘Path’.

Test

So the tests use pandas and pillow, install them if required.

cd c:\Pytyon36
.\Scripts\pip.exe install pandas
.\Scripts\pip.exe install pillow

And then, run tests.

MSBuild RUN_TESTS.vcxproj /p:Configuration=Release,Platform=x64

All tests should be passed.

Use

c:\Python36>python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from rdkit import rdBase, Chem
>>> from rdkit.Chem import AllChem, Draw
>>> print('rdkit version: {}'.format(rdBase.rdkitVersion))
rdkit version: 2019.03.3
>>> Chem.MolToSmiles(Chem.MolFromSmiles('C1=CC=CN=C1'))
'c1ccncc1'
>>>

 

ValueError: Object arrays cannot be loaded when allow_pickle=False

エラーは、numpy を 1.16.2 に下げる。

 

現在のディレクトリ

%pwd

ディレクトリの内容 Windows でも ls でよい

%ls

ディレクトリの移動

%cd some_directory

ディレクトリの作成

%mkdir new_directory

ディレクトリの削除

%rmdir old_directory

%pwd は、変数なのでコード中で使える

https://github.com/yhat/ggpy/issues/618#issuecomment-391986269

をヒントに、pkgs/ggplot-#.#.#-py_3/site-packages/ggplot/statssmoothers.py の

from pandas.libs import Timestamp

from pandas._libs import Timestamp

に書き直す。

 

古い Keras が欲しかったが、Anaconda になかった。次で解決。

pip install keras==1.0.6

 

  • C:\ProgramData\Anaconda3
  • C:\ProgramData\Anaconda3\Scripts
  • C:\ProgramData\Anaconda3\Library\bin

Cultureによって結果が異なるので、必要に応じて、NumberFormatInfo.InvariantInfo をつけることを、デフォルトにする。