AEADataEditor / replication-template-development

Development repo for the replication template
2 stars 6 forks source link

issue with user provided ado folder #31

Open floswald opened 3 months ago

floswald commented 3 months ago

hi lars

quick question. I was using your stata config.do template - thanks for that. I have a package that looks as follows:

floswald@PTL11077 ~/pinotti (master)> tree -L 2 3-replication-package/           
3-replication-package/
├── Analysis_Code.do
├── Cleaning_Code.do
├── Data
│   ├── Derived
│   └── Raw
├── README.pdf
├── Results
│   └── figure_1.eps
├── ado
│   ├── DCdensity.ado
│   ├── cmogram.ado
│   ├── coefplot.ado
│   ├── ftools.ado
│   ├── geodist.ado
│   ├── geodist_run.ado
│   ├── outreg2.ado
│   ├── outreg2.pref
│   ├── plus
│   ├── rdrobust.ado
│   ├── rdrobust_bw.mo
│   ├── rdrobust_kweight.mo
│   ├── rdrobust_res.mo
│   ├── rdrobust_vce.mo
│   ├── reg2hdfe.ado
│   ├── spmap.ado
│   ├── stddiff.ado
│   └── wyoung.ado
├── codebook.xlsx
├── config.do
├── desktop.ini
├── logs
│   ├── logfile_21_Mar_2024-10_46_14-floswald.log
│   ├── system_21_Mar_2024-10_44_48-floswald.log
│   └── system_21_Mar_2024-10_46_14-floswald.log
├── main.do
└── template-config.do

I am puzzled by the following stata behaviour. The authors say the provide all ado files (so i don't need to ssc install them, but then there is reg2hdfe.ado in /ado instead of reghdfe.ado. So, without adding reghdfe to ssc_packages of config.do, this does not work. After adding it (and hence installing reghdfe) it's in /ado/plus/r but the installation can't find the other, user-provided ados now. it complains that ftools is missing, when it's clearly there (see above). Any hints? thanks!

--------------------------------------------------------------------------------------------------------------------
      name:  ldi
       log:  /Users/floswald/pinotti/3-replication-package/logs/logfile_21_Mar_2024-10_46_14-floswald.log
  log type:  text
 opened on:  21 Mar 2024, 10:46:14

. 
. /* used only for system info */
. log using "`systeminfo'", name(system) replace text
(file /Users/floswald/pinotti/3-replication-package/logs/system_21_Mar_2024-10_46_14-floswald.log not found)
--------------------------------------------------------------------------------------------------------------------
      name:  system
       log:  /Users/floswald/pinotti/3-replication-package/logs/system_21_Mar_2024-10_46_14-floswald.log
  log type:  text
 opened on:  21 Mar 2024, 10:46:14

. 
. /* It will provide some info about how and when the program was run */
. 
. /* install any packages locally */
. di "=== Redirecting where Stata searches for ado files ==="
=== Redirecting where Stata searches for ado files ===

. capture mkdir "$rootdir/ado"

. adopath - PERSONAL
  [1]  (BASE)      "/Applications/Stata/ado/base/"
  [2]  (SITE)      "/Applications/Stata/ado/site/"
  [3]              "."
  [4]  (PLUS)      "/Users/floswald/Library/Application Support/Stata/ado/plus/"
  [5]  (OLDPLACE)  "~/ado/"

. adopath - OLDPLACE
  [1]  (BASE)      "/Applications/Stata/ado/base/"
  [2]  (SITE)      "/Applications/Stata/ado/site/"
  [3]              "."
  [4]  (PLUS)      "/Users/floswald/Library/Application Support/Stata/ado/plus/"

. adopath - SITE
  [1]  (BASE)      "/Applications/Stata/ado/base/"
  [2]              "."
  [3]  (PLUS)      "/Users/floswald/Library/Application Support/Stata/ado/plus/"

. sysdir set PLUS     "$rootdir/ado/plus"

. sysdir set PERSONAL "$rootdir/ado"       // may be needed for some packages

. sysdir
   STATA:  /Applications/Stata/
    BASE:  /Applications/Stata/ado/base/
    SITE:  /Applications/Stata/ado/site/
    PLUS:  /Users/floswald/pinotti/3-replication-package/ado/plus/
PERSONAL:  /Users/floswald/pinotti/3-replication-package/ado/
OLDPLACE:  ~/ado/

. 
. /*==============================================================================================*/
. /* If present, add the authors' replication-package specific ado file path                      */
. /* This is defined above                                                                        */
. /*==============================================================================================*/
. 
. if "`author_adopath'" != "" {             // The author adopath variable is filled out
.     adopath ++ "$rootdir/`author_adopath'"
  [1]              "/Users/floswald/pinotti/3-replication-package/ado"
  [2]  (BASE)      "/Applications/Stata/ado/base/"
  [3]              "."
  [4]  (PLUS)      "/Users/floswald/pinotti/3-replication-package/ado/plus/"
. }

. 
. /* now let's check what's there */
. 
. di "=== Verifying pre-existing ado files - normally, this should be EMPTY upon first run"
=== Verifying pre-existing ado files - normally, this should be EMPTY upon first run

. adopath
  [1]              "/Users/floswald/pinotti/3-replication-package/ado"
  [2]  (BASE)      "/Applications/Stata/ado/base/"
  [3]              "."
  [4]  (PLUS)      "/Users/floswald/pinotti/3-replication-package/ado/plus/"

. ado

[1] package cli-compat from https://raw.githubusercontent.com/aeadataeditor/cli-compat-stata/master
      'cli-compat': Commands that provide compatibility with programs written with GUI Stata in mind.

. di "=========================="
==========================

. 
. 
. /* this is long, so we pause the main log file */
. log off ldi
      name:  ldi
       log:  /Users/floswald/pinotti/3-replication-package/logs/logfile_21_Mar_2024-10_46_14-floswald.log
  log type:  text
 paused on:  21 Mar 2024, 10:46:14
--------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------
      name:  ldi
       log:  /Users/floswald/pinotti/3-replication-package/logs/logfile_21_Mar_2024-10_46_14-floswald.log
  log type:  text
resumed on:  21 Mar 2024, 10:46:14

. 
. 
. /* add packages to the macro */
. 
.     
.     if !missing("`ssc_packages'") {
.         foreach pkg in `ssc_packages' {
  2.             capture which `pkg'
  3.             if _rc == 111 {                 
  4.                dis "Installing `pkg'"
  5.                 ssc install `pkg', replace
  6.             }
  7.             which `pkg'
  8.         }
Installing reghdfe
checking reghdfe consistency and verifying not already installed...
installing into /Users/floswald/pinotti/3-replication-package/ado/plus/...
installation complete.
/Users/floswald/pinotti/3-replication-package/ado/plus/r/reghdfe.ado
*! version 6.12.3 08aug2023
.     }

. 
. /*==============================================================================================*/
. /* If you need to "net install" packages, add lines to this section                             */
.     * Install packages using net
.     * net install grc1leg, from("http://www.stata.com/users/vwiggins/")
.     
. /*==============================================================================================*/
. /* other commands, rarely used, uncomment as needed */
. /* Some packages do not contain a command with the same name as the package, and thus cannot be verified by "which
> " */
. /*==============================================================================================*/
. 
. /* if needing egenmore, uncomment next line. egenmore cannot be verified by "which" . There are some other package
> s like that*/
. 
. // ssc install egenmore
. // ssc install blindschemes
. 
. /*==============================================================================================*/
. /* yet other programs have no install capability, and may need to be copied */
. /*==============================================================================================*/
. 
. // e.g.
. //  copy (URL) (name_of_file.ado)
. // example:
. // copy http://www.sacarny.com/wp-content/uploads/2015/08/ebayes.ado ebayes.ado
. 
. 
. /*==============================================================================================*/
. /* This toolbox allows us to run code that still contains interactive commands (which it should not) */
. /*==============================================================================================*/
. 
. net install cli-compat, all replace from("https://raw.githubusercontent.com/aeadataeditor/cli-compat-stata/master"
> )
checking cli-compat consistency and verifying not already installed...
all files already exist and are up to date.

. 
. /*-------------- Sometimes, you may get the dreaded esttab error about paths -------------------*/
. /* in that case, uncomment the following line, and overwrite the estout package with the newer one */
. 
. // net install estout, replace from(https://raw.githubusercontent.com/benjann/estout/master/)
. 
. /*==============================================================================================*/
. /* after installing all packages, it may be necessary to issue the mata mlib index command */
. /* This should always be the LAST command after installing all packages                    */
. /*==============================================================================================*/
. 
.         mata: mata mlib index
.mlib libraries to be searched are now
    lmatabase;lmatamcmc;lmatabma;lmatacollect;lmatatab;lmataivqreg;lmatamixlog;lmatami;lmatasem;lmatagsem;lmatasp;lm
> atapss;lmatalasso;lmatapostest;lmatapath;lmatameta;lmataopt;lmatasvy;lmatajm;lmatanumlib;lmatahetdid;lmataado;lmat
> aerm;lmatafc

. 
. /*==============================================================================================*/
. /* This is specific to AEA replication environment. May not be needed if no confidential data   */
. /* are used in the reproducibility check.                                                       */
. /* Replicator should check the JIRA field "Working location of restricted data" for right path  */
. /*==============================================================================================*/
. 
. global sdrive ""

. 
. 
. /*==============================================================================================*/
. /* After all the setup work, let's check again what's installed in the ado directories          */
. /*==============================================================================================*/
. 
. 
. di "=== Verifying ado files after all install steps"
=== Verifying ado files after all install steps

. adopath
  [1]              "/Users/floswald/pinotti/3-replication-package/ado"
  [2]  (BASE)      "/Applications/Stata/ado/base/"
  [3]              "."
  [4]  (PLUS)      "/Users/floswald/pinotti/3-replication-package/ado/plus/"

. ado

[1] package cli-compat from https://raw.githubusercontent.com/aeadataeditor/cli-compat-stata/master
      'cli-compat': Commands that provide compatibility with programs written with GUI Stata in mind.

[2] package reghdfe from http://fmwww.bc.edu/repec/bocode/r
      'REGHDFE': module to perform linear or instrumental-variable regression absorbing any number of high-dimension
> al fixed effects

. di "=========================="
==========================

. 
. 
. 
. di "========================================= END SETUP + DIAGNOSTICS ===================================="
========================================= END SETUP + DIAGNOSTICS ====================================

. 
. do Cleaning_Code.do

reghdfe requires the ftools package, which is not installed
    - install from SSC
    - install from Github
(error occurred while loading reghdfe.ado)
r(9);

end of do-file
r(9);

end of do-file

r(9);
larsvilhuber commented 2 weeks ago

Sorry, only saw this now @floswald . Hm. For one, ftools is more than just ftools.ado (at least in the most recent version)


ado/plus/f
├── fcollapse.ado
├── fcollapse_functions.mata
├── fcollapse_main.mata
├── fcollapse.sthlp
├── fegen.ado
├── fegen_group.ado
├── fegen.sthlp
├── fisid.ado
├── fisid.sthlp
├── flevelsof.ado
├── flevelsof.sthlp
├── fmerge.ado
├── fmerge.sthlp
├── freshape.ado
├── fsort.ado
├── fsort.sthlp
├── ftab.ado
├── ftools.ado
├── ftools_common.mata
├── ftools_experimental.mata
├── ftools_hash1.mata
├── ftools_main.mata
├── ftools.mata
├── ftools_plugin.mata
├── ftools.sthlp
└── ftools_type_aliases.mata

0 directories, 26 files

There is a weird interaction (which I have not encountered in practice, only in testing) between sysdir set PLUS and adopath. I can remove the PLUS special directory from the adopath, but the command ado will still list the files that are installed in the default PLUS path. Only if I actually change the PLUS sysdir do those disappear.

This behavior might disappear upon a restart of Stata...