Build a Python extension for E-Cell 4 on Windows 7 (64bit)

** The following information is outdated. Please refer to here for the latest information. ** **

Preparation

E-Cell4 is used by checking out the win32 branch. If necessary, install and use Git yourself: https://github.com/ecell/ecell4

The following is what I used for the build:

When using Python3

How to build

  1. Install Python and Visual C ++ normally.

  2. Unzip GSL, stdint, Boost to a suitable location.

  3. Extract hdf5-1.8.14-win32-vs2012-shared.zip and run HDF5-1.8.14-win32.exe to install it. It is optional whether to pass the installation location or path.

  4. C: \ path \ to \ ecell4 \ ecell4 \ core \ config.h.win32 is called C: \ path \ to \ ecell4 \ ecell4 \ core \ config.h Save as. Or create config.h under C: \ path \ to \ ecell4 \ ecell4 \ core with the following content:

#ifndef __ECELL4_CONFIG_H #define __ECELL4_CONFIG_H #define HAVE_BOOST_UNORDERED_MAP_HPP 1 #define HAVE_BOOST_FUNCTIONAL_HASH_HPP 1 #endif /* __ECELL4_CONFIG_H */


 5. C: \\ path \\ to \\ ecell4 \\ ecell4 \\ egfrd \\ config.h.win32 is called C: \\ path \\ to \\ ecell4 \\ ecell4 \\ egfrd \\ config.h Save as.

 6. Extract virtualenv-1.11.6.tar.gz so that Python can be executed:

    ```
C:\path\to\virtualenv-1.11.6> python virtualenv.py C:\path\to\myenv

C: \ path \ to \ myenv can be anywhere, but note that it won't work if the path contains spaces (such as username).

  1. Go to C: \ path \ to \ myenv and install Cython and Numeric Python as follows:

C:\path\to\myenv> Scripts\activate.bat (myenv) C:\path\to\myenv> pip install cython (myenv) C:\path\to\myenv> pip install numpy


 8. Under virtualenv environment:

 Instead of calling make_sjy_table.py and make_cjy_table.py that use scipy, you can get the separately created SphericalBesselTable.hpp and CylindricalBesselTable.hpp and place them under the C: \ path \ to \ ecell4 \ ecell4 \ egfrd directory.

    ```
(myenv) C:\path\to\myenv> cd C:\path\to\ecell4\python
(myenv) C:\path\to\ecell4\python> python setup.py build_ext -IC:\path\to\boost_1_55_0;C:\path\to\gsl\include;C:\path\to\HDF5_Group\HDF\1.8.14\include;C:\path\to\stdint-20070624 -LC:\path\to\gsl\lib;C:\path\to\HDF5_Group\HDF\1.8.14\lib install
(myenv) C:\path\to\ecell4\python> python samples\simple.py

Wheel package

  1. Package creation continues above:

(myenv) C:\path\to\ecell4\python> pip install wheel (myenv) C:\path\to\ecell4\python> python setup.py bdist_wheel


 You should now have WHL under C: \\ path \\ to \\ ecell4 \\ python \\ dist.

 2. Download and unzip the following

    https://www.dropbox.com/s/79jrmw1vtv61e6t/ecell4-0.0.0-cp27-none-win32-whl.zip

 3. Under the expanded ecell4-0.0.0-cp27-none-win32-whl directory:

    ```
(myenv) C:\path\to\ecell4-0.0.0-cp27-none-win32-whl> pip install ecell4-0.0.0-cp27-none-win32.whl
  1. Since the dll is required at runtime, install the HDF5 binary as described above and pass it through the path if necessary.

(myenv) C:\path\to\ecell4-0.0.0-cp27-none-win32-whl> set PATH=%PATH%;C:\path\to\HDF5_Group\HDF\1.8.13\bin

5.Try to do it below.Hopefully test.h5 should be created:

```

(myenv) C:\path\to\ecell4-0.0.0-cp27-none-win32-whl> python simple.py


6.Introduced IPython Notebook,to start:

    ```
(myenv) C:\path\to\myenv> pip install ipython[notebook]
(myenv) C:\path\to\myenv> ipython notebook

#Points of concern

1.Do I need to create a package when building HDF5?? ALL_The dll was created just by building BUILD, but it didn't work..You need to install NSIS to make a package,Looks useless.Well it's good because it's easy to redistribute.

  1. hdf5_hl, hdf5_hl_Do you need cpp? ->unnecessary.

3.Warning that appears in large numbers at build time.It seems to be mainly about implicit typecasting.I want to crush it someday.

  1. <stdint.h>about.Mendoi to install separately.I don't know what to do,this is.

  2. config.h is not good.Boost unordered_map is not very well implemented, Visual C++I want to think of an alternative for. ->Perhaps, std::tr1 can be used.

6.IPython will be available in pip.IPython Notebook also pyzmq, jinja2,You can do it by installing tornade from pip,Some of these may need to be built.I hope it can be done with Wheel, but I have not confirmed.Anaconda's IPython is MinGW32, so it probably won't work.

#About HDF5 own build

Things necessary:

1.HDF5 Visual C ++++Build your own in 2008.First unzip the file,Next, create another directory for building.(hdf5-1.8.13-BUILD).

2.CMake 3 from the start menu etc..0.0>CMake (cmake-gui)To start. "Where is the source code:"To C:\path\to\hdf5-1.8.13, "Where to build the binaries"To C:\path\to\hdf5-1.8.13-Specify BUILD.Press the Configure button below.A dialog opens, "Specify the generator for this project"Because it is asked, "Visual Studio 9 2008"so"Use default native compilers"Select"Finish".

3.Entry is automatically displayed, but from this, BUILD_SHARED_LIBS, HDF5_BUILD_CPP_LIB, HDF5_PACKAGE_Set EXTLIBS to True.Other than that, you can leave it as it is.afterwards,Press the Generate button.

  1. C:\path\to\hdf5-1.8.13-Move to BUILD, HDF5.sln to Visual C ++++Open in 2008.Various warnings are given in the dialog, but ignore them for the time being.The solution configuration in the center of the upper toolbar"Debug"If it has become"Release"Change to.

5.ALL from the explorer on the left_Right click on BUILD,Build.after,Right click on PACKAGE,Buildする. C:\path\to\hdf5-1.8.13-Below BUILD_CPack_Packages\win\NSIS\HDF5-1.8.13-win is done and hdf5 is under bin.OK if dll is created(hdf5_D.If it is dll etc., check the above solution configuration).

#About patches

Less than,Old information.Now see the difference between win32 branch and master.

https://github.com/ecell/ecell4/compare/win32

(Old)About patches.

https://gist.github.com/kaizu/00e480fb3285b1296485

1.why, gsl_pow_2, gsl_pow_3 falls on link. gsl_pow_Can be used with int.Doesn't it make sense.

2.Problem that typeof cannot be used. GetType,I can use typeid, but I'm not sure.If there is no change in gsl, there is no problem, so I hard-coded the type for the time being.

  1. erf,erfc is math.Problems not in h. boost/math/special_functions/erf.Use hpp instead.Should it be unified to gsl??

4.cbrt is math.Problems not in h.Implemented instead with pow.At least inline.

5.rint is math.Problems not in h.It looks like you can implement it yourself, boost/numeric/interval/detail/msvc_rounding_control.It seems that hpp is switching that side well, so I referred to that.

  1. M_PI is math.Problem that cannot be used even if h is included. _USE_MATH_Need to declare DEFINES. types.hpp to math.I try to include h.

7.The gslcblas library name is different. gslcblas->cblas.

  1. __PRETTY_FUNCTION__Problems that cannot be used.It's just an error message__FUNCTION__Just use.

9.Deleted unnecessary typename.It feels good to commit normally.Confirm later.

10.problem that vsnprintf is not std.

  1. sqrt(3)Problem that does not pass. sqrt(3.0)Should be.Merge.

12.Regex for windows.Problem without h.Boost regex requires binaries, so avoid Unix standard regex.I tried to use h,Windows is not Unix in the first place, so regex.no h.On the other hand, Visual C++Regex is implemented as standard in,API seems to be exactly the same as Boost regex(Or rather std::tr1)So I just solved the namespace etc. and passed for the time being.Results need to be tested.

  1. python/setup.Fixed dll names being slightly different in py.Compiler options"/w"With hiding warnings, "/EHsc"Exception handling model settings in.The former is non-essential.

#Reference link

http://homepage2.nifty.com/nonnon/Chinamini/20110001/20110307.html

http://david.geldreich.free.fr/dev.html

http://www.kijineko.co.jp/node/63

http://msdn.microsoft.com/ja-jp/library/1deeycx5%28v=vs.90%29.aspx

http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING

http://qiita.com/toruuetani/items/b0000e9f5c89a350d4f8

Recommended Posts

Build a Python extension for E-Cell 4 on Windows 7 (64bit)
Build a Python extension for E-Cell 4 on Mac OSX (Yosemite)
Python 2.7, 3.4, 3.5 extension module build environment on Windows
Build a 64-bit Python 2.7 environment with TDM-GCC and MinGW-w64 on Windows 7
Simply build a Python 3 execution environment on Windows
Build Python environment on Windows
Build python environment on windows
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Build a GVim-based Python development environment on Windows 10 (1) Installation
Procedure for building a CDK environment on Windows (Python)
Installing Kivy on Windows10 64bit Python3.5
Install python2.7 on windows 32bit environment
Installing Kivy-Designer on Windows10 64bit Python3.5
Build mlpy with python3.3 (64bit) (windows 64bit)
Build a python3 environment on CentOS7
Build a GVim-based Python development environment on Windows 10 (2) Basic settings
Build Python3 for Windows 10 on ARM with Visual Studio 2019 (x86) on Windows 10 on ARM
Build a python environment on CentOS 7.7 for your home server
Create a Python environment for professionals in VS Code on Windows
Notes for using OpenCV on Windows10 Python 3.8.3.
Python on Windows
Build a python environment on MacOS (Catallina)
Creating a python virtual environment on Windows
Build a Python + OpenCV environment on Cloud9
Build a version control environment for Python, Ruby, Perl, Node.js on UNIX
Quickly build a python environment for deep learning and data science (Windows)
A python script for Mac that zips without garbled characters on Windows
Rock-paper-scissors with Python Let's run on a Windows local server for beginners
A tool for creating symbolic links on Windows
Build a python environment with ansible on centos6
Build a Python environment on Mac (Mountain Lion)
Build procedure for TensorFlow 2.4.0 (Windows10, CUDA11.1.1, cuDNN 8.0.5, Python 3.8.6)
Build a Python development environment on your Mac
A memorandum for touching python Flask on heroku
Build a Kubernetes environment for development on Ubuntu
Installing TensorFlow on Windows Easy for Python beginners
Create a Python virtual development environment on Windows
Build a Python development environment on Raspberry Pi
Steps to build PyTorch 1.5 for CUDA 10.2 on Windows
python basic on windows ②
Install python on windows
Build TensorFlow on Windows
Build XGBoost on Windows
build Python on Ubuntu
Install Python (for Windows)
Build a local development environment with WSL + Docker Desktop for Windows + docker-lambda + Python
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
Build a local development environment for Laravel6.X on Mac
[Heroku] Memo for deploying Python apps using Heroku on Windows [Python]
Build a python environment for each directory with pyenv-virtualenv
Until drawing a 3D graph in Python on windows10
Create a comfortable Python 3 (Anaconda) development environment on windows
A memo of installing Chainer 1.5 for GPU on Windows
How to build a Django (python) environment on docker
Build a Python development environment on Mac OS X
PIL with Python on Windows 8 (for Google App Engine)
Build a Python environment on your Mac using pyenv
Build a Python development environment using pyenv on MacOS
Create a decent shell and python environment on Windows
How to build a Python environment on amazon linux 2
Build a machine learning environment natively on Windows 10 (x64)