ispec 備忘録

Installing ispec on Ubuntu 18.04. 

Main reference: (データサイエンティストを目指す人のpython環境構築 2016) https://qiita.com/y__sama/items/5b62d31cb7e6ed50f02c



```bash
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ source ~/.bashrc
```


```bash
$ which curl
/snap/bin/curl
$ sudo snap remove curl
curl removed
$ sudo apt install curl
```
Ref: https://askubuntu.com/questions/1387141/curl-23-failure-writing-output-to-destination 
Basically snap curl is useless. Uninstall it properly. Get the proper apt curl, and everything works like a charm.


```bash 
$ sudo snap remove curl
$ sudo apt install curl
```


```bash 
$ pyenv install -l | grep ana

  anaconda3-2020.07

```

```bash 
$ pyenv install anaconda3-2020.07
Downloading Anaconda3-2020.07-Linux-x86_64.sh...
-> https://repo.continuum.io/archive/Anaconda3-2020.07-Linux-x86_64.sh
Installing Anaconda3-2020.07-Linux-x86_64...
Installed Anaconda3-2020.07-Linux-x86_64 to /home/ispec_kohei/.pyenv/versions/anaconda3-2020.07
```



```bash 

$ pyenv rehash
$ pyenv global anaconda3-2020.07

$ echo 'alias activate="source $PYENV_ROOT/versions/anaconda3-2020.07/bin/activate"' >> ~/.bashrc
$ source ~/.bashrc

$ conda update conda

``` 


```bash 
$ conda info --envs
# conda environments:
#
base                  *  /home/ispec_kohei/.pyenv/versions/anaconda3-2020.07
```

```bash 
$ activate base 
(base) $ conda deactivate
$ conda create --name py38_ispec_ver1 --clone base  ## This is create a copy.

```

To activate the environment, you need to do:

```bash 
$ activate py38_ispec_ver1
(py38_ispec_ver1) $ 
```

```bash 
$ conda update --all
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.8.3
  latest version: 24.4.0

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /home/ispec_kohei/.pyenv/versions/anaconda3-2020.07/envs/py38_ispec_ver1


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _ipyw_jlab_nb_ext_conf-0.1.0|   py38h06a4308_1           5 KB
    ------------------------------------------------------------
                                           Total:           5 KB

The following packages will be UPDATED:

  _ipyw_jlab_nb_ext~                           0.1.0-py38_0 --> 0.1.0-py38h06a4308_1


Proceed ([y]/n)? y


Downloading and Extracting Packages
_ipyw_jlab_nb_ext_co | 5 KB      | ###################################################################################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(py38_ispec_ver1) ispec_kohei@Ubuntu1804-emt06:~$ conda install lockfile dill
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.8.3
  latest version: 24.4.0

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /home/ispec_kohei/.pyenv/versions/anaconda3-2020.07/envs/py38_ispec_ver1

  added / updated specs:
    - dill
    - lockfile


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    dill-0.3.7                 |   py38h06a4308_0         171 KB
    lockfile-0.12.2            |   py38h06a4308_0         246 KB
    ------------------------------------------------------------
                                           Total:         417 KB

The following NEW packages will be INSTALLED:

  dill               pkgs/main/linux-64::dill-0.3.7-py38h06a4308_0
  lockfile           pkgs/main/linux-64::lockfile-0.12.2-py38h06a4308_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
dill-0.3.7           | 171 KB    | ###################################################################################################################################################################################### | 100% 
lockfile-0.12.2      | 246 KB    | ###################################################################################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

```

```bash
$ sudo apt install build-essential gfortran libgfortran3

[sudo] password for ispec_kohei: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
gfortran is already the newest version (4:7.4.0-1ubuntu2.3).
The following packages were automatically installed and are no longer required:
  gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gudev-1.0 gir1.2-udisks-2.0 grilo-plugins-0.3-base gstreamer1.0-gtk3 libcdr-0.1-1 libcolamd2 libdazzle-1.0-0 libedataserverui-1.2-2 libevent-2.1-6 libexiv2-14
  libfreerdp-client2-2 libfreerdp2-2 libgee-0.8-2 libgexiv2-2 libgom-1.0-0 libgpod-common libgpod4 liblirc-client0 liblua5.3-0 libmediaart-2.0-0 libmspub-0.1-1 libqqwing2v5 libsgutils2-2 libssh-4 libsuitesparseconfig5
  libvncclient1 libwinpr2-2 libxapian30 linux-hwe-5.4-headers-5.4.0-100 linux-hwe-5.4-headers-5.4.0-104 linux-hwe-5.4-headers-5.4.0-105 linux-hwe-5.4-headers-5.4.0-107 linux-hwe-5.4-headers-5.4.0-109
  linux-hwe-5.4-headers-5.4.0-110 linux-hwe-5.4-headers-5.4.0-113 linux-hwe-5.4-headers-5.4.0-117 linux-hwe-5.4-headers-5.4.0-120 linux-hwe-5.4-headers-5.4.0-121 linux-hwe-5.4-headers-5.4.0-122
  linux-hwe-5.4-headers-5.4.0-124 linux-hwe-5.4-headers-5.4.0-125 linux-hwe-5.4-headers-5.4.0-126 linux-hwe-5.4-headers-5.4.0-128 linux-hwe-5.4-headers-5.4.0-131 linux-hwe-5.4-headers-5.4.0-132
  linux-hwe-5.4-headers-5.4.0-135 linux-hwe-5.4-headers-5.4.0-136 linux-hwe-5.4-headers-5.4.0-42 linux-hwe-5.4-headers-5.4.0-90 linux-hwe-5.4-headers-5.4.0-91 linux-hwe-5.4-headers-5.4.0-92 linux-hwe-5.4-headers-5.4.0-94
  linux-hwe-5.4-headers-5.4.0-96 linux-hwe-5.4-headers-5.4.0-97 linux-hwe-5.4-headers-5.4.0-99 lp-solve media-player-info python3-mako python3-markupsafe syslinux syslinux-common syslinux-legacy usb-creator-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  gcc-6-base
The following NEW packages will be installed:
  gcc-6-base libgfortran3
0 upgraded, 2 newly installed, 0 to remove and 25 not upgraded.
Need to get 286 kB of archives.
After this operation, 1,394 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://jp.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 gcc-6-base amd64 6.5.0-2ubuntu1~18.04 [16.7 kB]
Get:2 http://jp.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libgfortran3 amd64 6.5.0-2ubuntu1~18.04 [270 kB]
Fetched 286 kB in 3s (90.8 kB/s)       
Selecting previously unselected package gcc-6-base:amd64.
(Reading database ... 648879 files and directories currently installed.)
Preparing to unpack .../gcc-6-base_6.5.0-2ubuntu1~18.04_amd64.deb ...
Unpacking gcc-6-base:amd64 (6.5.0-2ubuntu1~18.04) ...
Selecting previously unselected package libgfortran3:amd64.
Preparing to unpack .../libgfortran3_6.5.0-2ubuntu1~18.04_amd64.deb ...
Unpacking libgfortran3:amd64 (6.5.0-2ubuntu1~18.04) ...
Setting up gcc-6-base:amd64 (6.5.0-2ubuntu1~18.04) ...
Setting up libgfortran3:amd64 (6.5.0-2ubuntu1~18.04) ...
Processing triggers for libc-bin (2.27-3ubuntu1.6) ...
```

```bash
(py38_ispec_ver1) ~/Downloads $ tar -xvzf iSpec_v20230804.tar.gz 

(...)

(py38_ispec_ver1) ~/Downloads $ ls -l 
total 2122184
-rw-rw-r-- 1 ispec_kohei ispec_kohei  576830621 Apr 30 11:54 Anaconda3-2020.07-Linux-x86_64.sh
drwxr-xr-x 8 ispec_kohei ispec_kohei       4096 Aug  6  2023 iSpec_v20230804
-rw-rw-r-- 1 ispec_kohei ispec_kohei 1596272405 Apr 30 12:18 iSpec_v20230804.tar.gz

(py38_ispec_ver1) ~/Downloads $ mv iSpec_v20230804 ../


(py38_ispec_ver1) $ cd ~/iSpec_v20230804/

$ make clean
rm -f ispec.log
rm -f synthesizer/moog/fake_sm-2.4.35/lib/libfakesm.a
rm -f synthesizer/moog/fake_sm-2.4.35/src/fakesm.o
rm -f synthesizer/moog/*.o
rm -f synthesizer/moog/MOOG
rm -f synthesizer/moog/MOOGSILENT
rm -f synthesizer/turbospectrum/exec-gf/*.o
rm -f synthesizer/turbospectrum/exec-gf/*.mod
rm -f synthesizer/turbospectrum/bin/babsma_lu 
rm -f synthesizer/turbospectrum/bin/bsyn_lu 
rm -f synthesizer/turbospectrum/bin/eqwidt_lu
rm -f synthesizer/synthesizer.c
rm -rf synthesizer/build/
rm -f synthesizer/synthesizer*.so
rm -f synthesizer/spectrum/*.o
rm -f synthesizer/spectrum/spectrum
rm -f ispec/synthesizer.so
rm -f isochrones/YYmix2
rm -f synthesizer/ARES/bin/ARES


```

```bash
$ $ sudo make spectrum
rm -f synthesizer/synthesizer.c
rm -rf synthesizer/build/
cd synthesizer/ ; python setup.py build_ext --inplace
/bin/sh: 1: python: not found
Makefile:19: recipe for target 'ispec/synthesizer.so' failed
make: *** [ispec/synthesizer.so] Error 127
```

```bash
$ make turbospectrum
rm -f synthesizer/turbospectrum/exec-gf/*.o
rm -f synthesizer/turbospectrum/exec-gf/*.mod
rm -f synthesizer/turbospectrum/exec-gf/babsma_lu
rm -f synthesizer/turbospectrum/exec-gf/bsyn_lu
rm -f synthesizer/turbospectrum/exec-gf/eqwidt_lu
make -C synthesizer/turbospectrum/exec-gf/
make[1]: Entering directory '/home/ispec_kohei/iSpec_v20230804/synthesizer/turbospectrum/exec-gf'
gfortran  -c ../src/cubint_module.f90
gfortran  -c ../src/cubint_module.f90
gfortran -L/usr/lib -fconvert=big-endian -O3 -fno-automatic -mcmodel=small -std=legacy -o babsma_lu ../src/absko.f ../src/babsma.f ../src/detabs.f ../src/getinfospecies.f ../src/inabs.f ../src/injon.f ../src/input.f ../src/jon.f ../src/lenstr.f ../src/qas.f ../src/qtrav.f ../src/rossop.f ../src/tabs.f ../src/tryck.f ../src/zerof.f ../src/heopac.f ../src/h2opac.f ../src/CIAh2h2.f ../src/CIAh2h.f ../src/CIAhhe.f ../src/CIAh2he.f ../src/heborysowopac.f ../src/h2borysowopac.f ../src/hbop.f ../src/hlinprof.f ../src/eqmol_pe_lu.f ../src/die_pe_lu.f ../src/funcv.f ../src/moleq.f ../src/takemolec.f ../src/makeabund.f ../src/getisotopmass.f ../src/molmat.f ../src/partf.f ../src/pemake.f ../src/pemakero.f ../src/rinteg.f ../src/molecpartf.f ../src/ludcmp.f ../src/lubksb.f ../src/molfys.f 
../src/hlinprof.f:136:21:

             CALL VCS(HLIND,XNED,TD,DEL,1,NLOW,NUP,HVCSFILE)
                     1
Warning: Rank mismatch in argument ‘pr’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
../src/hlinprof.f:141:19:

           CALL VCS(HLIND,XNED,TD,DEL,1,NLOW,NUP,HVCSFILE)
                   1
Warning: Rank mismatch in argument ‘pr’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
../src/hlinprof.f:234:21:

             CALL VCS(STARKD,XNED,TD,DEL1,1,NLOW,NUP,HVCSFILE)
                     1
Warning: Rank mismatch in argument ‘pr’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
gfortran -L/usr/lib -fconvert=big-endian -O3 -fno-automatic -mcmodel=small -std=legacy -o bsyn_lu  ../src/anstee.f ../src/bpl.f ../src/bsyn.f ../src/bsynb.f ../src/bsynbplatt.f ../src/clock-gf.f ../src/cubint_module.f90 ../src/depth.f ../src/gausi.f ../src/getinfospecies.f ../src/getlele.f ../src/hydropac.f ../src/hbop.f ../src/hlinprof.f ../src/inp3.f ../src/input.f ../src/Iplus_calc.f ../src/lenstr.f ../src/eqmol_pe_lu.f ../src/die_pe_lu.f ../src/funcv.f ../src/ludcmp.f ../src/lubksb.f ../src/makeabund.f ../src/getisotopmass.f ../src/molfys.f ../src/takemolec.f ../src/readmo.f ../src/readfilt.f ../src/tint.f ../src/lint.f ../src/traneq.f ../src/traneqplatt.f ../src/tranw.f ../src/newvoigt.f ../src/molmat.f ../src/tranfr.f ../src/tranfrplatt.f ../src/trrays.f ../src/trqua2.f ../src/transc.f ../src/transcplatt.f ../src/partf.f ../src/molecpartf.f ../src/partffordepth.f ../src/h2opartf.f ../src/h2opartf2001.f ../src/partfamesh2o.f ../src/partfBarberH2O.f ../src/weightlimb.f 
../src/hlinprof.f:136:21:

             CALL VCS(HLIND,XNED,TD,DEL,1,NLOW,NUP,HVCSFILE)
                     1
Warning: Rank mismatch in argument ‘pr’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
../src/hlinprof.f:141:19:

           CALL VCS(HLIND,XNED,TD,DEL,1,NLOW,NUP,HVCSFILE)
                   1
Warning: Rank mismatch in argument ‘pr’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
../src/hlinprof.f:234:21:

             CALL VCS(STARKD,XNED,TD,DEL1,1,NLOW,NUP,HVCSFILE)
                     1
Warning: Rank mismatch in argument ‘pr’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
gfortran -L/usr/lib -fconvert=big-endian -O3 -fno-automatic -mcmodel=small -std=legacy -o eqwidt_lu  ../src/anstee.f ../src/bpl.f ../src/eqwidtb.f ../src/eqwidtbplatt.f ../src/eqwidt.f ../src/clock-gf.f ../src/depth.f ../src/gausi.f ../src/getinfospecies.f ../src/getlele.f ../src/hydropac.f ../src/hbop.f ../src/hlinprof.f ../src/inp3.f ../src/input.f ../src/lenstr.f ../src/eqmol_pe_lu.f ../src/die_pe_lu.f ../src/funcv.f ../src/ludcmp.f ../src/lubksb.f ../src/makeabund.f ../src/getisotopmass.f ../src/molfys.f ../src/takemolec.f ../src/readmo.f ../src/readfilt.f ../src/tint.f ../src/lint.f ../src/traneq.f ../src/traneqplatt.f ../src/tranw.f ../src/newvoigt.f ../src/molmat.f ../src/tranfr.f ../src/tranfrplatt.f ../src/trrays.f ../src/trqua2.f ../src/transc.f ../src/transcplatt.f ../src/partf.f ../src/molecpartf.f ../src/partffordepth.f ../src/h2opartf.f ../src/h2opartf2001.f ../src/partfamesh2o.f ../src/partfBarberH2O.f ../src/weightlimb.f 
../src/hlinprof.f:136:21:

             CALL VCS(HLIND,XNED,TD,DEL,1,NLOW,NUP,HVCSFILE)
                     1
Warning: Rank mismatch in argument ‘pr’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
../src/hlinprof.f:141:19:

           CALL VCS(HLIND,XNED,TD,DEL,1,NLOW,NUP,HVCSFILE)
                   1
Warning: Rank mismatch in argument ‘pr’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
../src/hlinprof.f:234:21:

             CALL VCS(STARKD,XNED,TD,DEL1,1,NLOW,NUP,HVCSFILE)
                     1
Warning: Rank mismatch in argument ‘pr’ at (1) (rank-1 and scalar) [-Wargument-mismatch]
make[1]: Leaving directory '/home/ispec_kohei/iSpec_v20230804/synthesizer/turbospectrum/exec-gf'
mkdir -p synthesizer/turbospectrum/bin/
mv synthesizer/turbospectrum/exec-gf/babsma_lu synthesizer/turbospectrum/bin/
mv synthesizer/turbospectrum/exec-gf/bsyn_lu synthesizer/turbospectrum/bin/
mv synthesizer/turbospectrum/exec-gf/eqwidt_lu synthesizer/turbospectrum/bin/
```

```bash
$ make moog
 
(...)
 

gfortran -Wall -ff2c -std=legacy  -c -o Vmacro.o Vmacro.f
gfortran -Wall -ff2c -std=legacy  -c -o Voigt.o Voigt.f
gfortran -Wall -ff2c -std=legacy  -c -o Wavecalc.o Wavecalc.f
gfortran -Wall -ff2c -std=legacy  -c -o Weedout.o Weedout.f
gfortran -Wall -ff2c -std=legacy  -c -o Writenumber.o Writenumber.f
gfortran Abfind.o Abpop.o Abunplot.o Batom.o Begin.o Binary.o Binplot.o Binplotprep.o Blankstring.o Blends.o Bmolec.o Boxit.o Calmod.o Cdcalc.o Chabund.o Cog.o Cogplot.o Cogsyn.o Correl.o Crosscorr.o Curve.o Damping.o Defcolor.o Discov.o Doflux.o Drawcurs.o Eqlib.o Ewfind.o Ewweighted.o Fakeline.o Findtic.o Finish.o Fluxplot.o Gammabark.o Getasci.o Getcount.o Getnum.o Getsyns.o Gridplo.o Gridsyn.o Infile.o Inlines.o Inmodel.o Invert.o Jexpint.o Lineinfo.o Lineabund.o Linlimit.o Makeplot.o Molquery.o Moogsilent.o Mydriver.o Nansi.o Nearly.o Number.o Obshead.o Oneline.o Opaccouls.o OpacHelium.o OpacHydrogen.o Opacit.o Opacmetals.o Opacscat.o Params.o Partfn.o Partnew.o Plotit.o Plotremember.o Pltabun.o Pltcog.o Pltflux.o Pltspec.o Pointcurs.o Prinfo.o Putasci.o Readobs.o Rinteg.o Setmols.o Smooth.o Specplot.o Stats.o Sunder.o Synpop.o Synspec.o Synth.o Tablepop.o Taukap.o Total.o Trudamp.o Ucalc.o Vargauss.o Vmacro.o Voigt.o Wavecalc.o Weedout.o Writenumber.o -o MOOGSILENT  \
        -Lfake_sm-2.4.35/lib -lfakesm -L/usr/lib #-lplotsub -ldevices -lutils
-----------------------------------------------------------------

make sure that you have entered the proper parameters
for MOOGSILENT into the FORTRAN source driver
routine Moogsilent.f !!!!!!!!!!!!

-----------------------------------------------------------------
make[1]: Leaving directory '/home/ispec_kohei/iSpec_v20230804/synthesizer/moog'

```


```bash


```