forked from THzbiophotonics/Fit-TDS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindows installation guide.txt
121 lines (77 loc) · 6.59 KB
/
windows installation guide.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
fit@TDS Installation guide for windows
To use the fit@TDS code on Windows one will need Python version 2.7 or higher (<=3.7) with a number of properly installed packages:
NumPy - http://www.numpy.org/
pyOpt - https://github.com/madebr/pyOpt and http://pyopt.org/ (we hope that this website will be available again soon)
pyswarm - https://pythonhosted.org/pyswarm/
You will also need to have installed:
- Microsoft MPI: https://www.microsoft.com/en-us/download/details.aspx?id=57467
- Visual C++ Build Tools 2015: https://go.microsoft.com/fwlink/?LinkId=691126
We recommend you to install Anaconda3 with python 3.7 to have a less complicated installation process.
I) Easy installation
This way only works if you are using your root environement in anaconda, if you created a new environement go to "II) Manual installation".
For unexperienced Python users (or for the lazy ones) we propose the fallowing procedure to prepare your PC to run the code on it:
- If you have Anaconda3 with python3 (<=3.7):
1) Donwload the following package: https://github.com/madebr/pyOpt
2) Extract it in the fit@TDS folder.
3) Run "PackagesInstallerAnaconda3" with admin privileges.
5) Follow the instructions.
4) If you did not encounter problems your PC is ready to use fit@TDS. If you encounter some problems go to the next section to see how to do a manual installation.
- If you have Anaconda2 with python2:
1) Run "PackagesInstallerAnaconda2" with admin privileges.
2) Follow the instructions.
3) If you did not encounter problems your PC is ready to use fit@TDS. If you encounter some problems go to the next section to see how to do a manual installation.
- If none of this files work it may be because you have Anaconda3 instead of Anaconda2, in that case try changing "Anaconda2" for "Anaconda3" in the files with a text editor.
II) Manual installation
1) Check that Python and/or Anaconda are not installed on your PC, otherwise we advise to uninstall the existing version so on not to get any misleading dependencies after the following steps. Reboot the PC.
2) We advise to use Anaconda - a free and open source distribution of the Python programming language, which includes a number of useful programs and allows an easy package management.
Download the Anaconda installer with a Python version inferior or equal to 3.7 for Windows respecting the bit architecture of your processor: https://www.anaconda.com/download/
3) Run the installer. We advise to do it under administrator rights. We suggest to install anaconda for all users on the PC and to accept the destination folder (normally C:\ProgramData\Anaconda2) proposed by the installer.
We also suggest not to accept any of the advanced options or add-ons during the installation process. Reboot the PC after the installation is over.
4) Run Anaconda. Open the Environments menu. Check that the NumPy package is already installed.
5) Through the Environments menu find and install the following packages:
* mpi4py (for parallel computing)
* Swig compiler (version 1.3 and higher)
* MinGW compiler (other c/FORTRAN compiler may also be used)
* Tkinter (for GUI)
[If this step does not work properly, one can add the package using the anaconda prompt and these command lines :
conda install -c anaconda Swig
conda install -c anaconda MinGW
pip install mpi4py
conda install -c anaconda tk
If you have problem with installation of mpi4py, fit@tds will work perfectly without, this is just an option, please just commant the line with comment # this can be commented if mpi4py was not installed successfully]
6) Anaconda distribution includes the Anaconda Prompt which we suggest to use for the installation of the pyOpt and pyswarm packages:
pyOpt is an object-oriented framework for formulating and solving nonlinear constrained optimization problems. It can be installed as follows:
- If you have python 2 you can run the following command in the terminal: conda install -c mutirri pyopt
- If you have python 3 you need to do as follow:
1) Donwload the following package: https://github.com/madebr/pyOpt
2) Extract the folder "pyOpt-master" in a known location.
3) Open the terminal (anaconda prompt) and run the following command: cd "Path to pyOpt-master"
4) Run the following command: python setup.py install
The pyswarm package is a gradient-free, evolutionary optimization package for python that supports constraints.
Your Anaconda distribution normally includes the pip package, so install the pyswarm package by the following command:
pip install --upgrade pyswarm
7) Reboot the computer.
8)unzip the fit@tds files ([email protected], epsillon3.py and finalplot.py)
Congratulations, now you should be able to run the fit@tds code! (If you have issues see in the section below)
III) Using fit@TDS
1) From file (easy way)
This way only works if you are using your root environement in Anaconda, if you created a new environement go to the next section "2) From the terminal (AnacondaPrompt)"
You can use the "FitTDSeasyAnaconda2" or "FitTDSeasyAnaconda3" depending on your Anaconda version and follow the instructions to use fit@TDS.
These files are created if you use "PackagesInstallerAnaconda2" or "PackagesInstallerAnaconda3" depending on your version of Anaconda.
2) From the terminal (AnacondaPrompt)
To do so one can use the Spyder environment (also included to the Anaconda distribution) or just to run the the [email protected] by the following two commands in the Anaconda Prompt:
Write the path to the folder containing the [email protected] file, for example by
cd C:\Users\Admin\Documents\fit@tds
Run the file:
python [email protected]
If you want to use parallelization instead of the last command run:
mpiexec -n (number of processors) python [email protected]
IV) ISSUES
1) Error: IPOPT shared library failed to import
This is normal and fit@TDS will work properly.
2) h_start = Bcast(h_start, root=0)
UnboundLocalError: local variable 'Bcast' referenced before assignment
This is a common error because the pyOpt library installed has a little bug with the pyAlpso script.
To correct this you need to go to the folder where you installed anaconda (usually C:\ProgramData\Anaconda2 or C:\Users\"your user"\.conda\envs\"your environement" if you have different environements)
Then go to "path anaconda"\Lib\site-packages\pyopt\pyALPSO and open the alpso_spm.py script (you may need admin privileges to modify the file).
Finally change the line 108 from "elif (mpi4py.__version__[0] == '1'):" to "else".