Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Blog entry on quickly setting up Python with Stata 16

    Here is my first blog entry on how to quickly set up Python with Stata 16 https://fintechprofessor.com/2019/06...with-stata-16/
    Regards
    --------------------------------------------------
    Attaullah Shah, PhD.
    Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    FinTechProfessor.com
    https://asdocx.com
    Check out my asdoc program, which sends outputs to MS Word.
    For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

  • #2
    "The stand-alone version of Python did not work with Stata."

    I suppose you mean the official distribution at https://www.python.org/.
    I'm surprised. It works for me: no manual config, works out of the box.
    Since Python is in the PATH environment variable and in Windows registry, it shouldn't be a problem for Stata to find it, unless you have some unusual configuration.

    Comment


    • #3
      "The stand-alone version of Python did not work with Stata."

      I suppose you mean the official distribution at https://www.python.org/.
      Yes, I meant official distribution. I am glad that Stata can also work with official Python the way you have mentioned. The blog entry might still be useful for those using Anacondas or having trouble with official Python installations like myself.
      Regards
      --------------------------------------------------
      Attaullah Shah, PhD.
      Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
      FinTechProfessor.com
      https://asdocx.com
      Check out my asdoc program, which sends outputs to MS Word.
      For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

      Comment


      • #4
        Your guide will certainly be useful, as there seem to be a few problems: see https://www.statalist.org/forums/for...a-16-announced.
        I can't reproduce this, but in the past I had occasionally problems with loading DLLs (especially with scipy). Might be related.

        Comment


        • #5
          "The first time you call python in Stata, Stata will search for Python installations on the system and choose the one with the highest version. Stata will search the official Python installations and Python installations bundled with Anaconda or Miniconda. The installation must contain the corresponding Python dynamically linked library. For example, for Python 3.6, it would be something like python36.dll on Windows, libpython3.6.so on Linux, and libpython3.6.dylib on Mac. Otherwise, it will not be found and used as a candidate. Once Stata finds the candidate with the highest version, it will save that information to use in the future. You can see which Python version Stata will use by typing python query."

          Note in order to make the loading time reasonable, Stata 16 will not perform a system-wide search on first calling python, nor it will try to find any Python variants. It will only search "official Python installations and Python installations bundled with Anaconda or Miniconda" and it will only look at the usual places Python might be installed, for example, C;\Program Files\, etc. In your case, Stata 16 will NOT find Anaconda at D:\Anaconda\ due to its location.

          On the other hand, python search searches a much wider area on your system, which successfully finds D:\Anaconda\python.exe in this case.

          If the location of python is really odd, even python search fails, you can always use

          Code:
          python set exec "directory_where_python_is", permanently
          to set the location yourself. But note that Stata 16 still performs a sanity check to make sure "directory_where_python_is" does contain the corresponding Python dynamically linked library.

          For more information, please see Configuring Python section in https://www.stata.com/manuals/ppython.pdf
          Last edited by Hua Peng (StataCorp); 30 Jun 2019, 07:56.

          Comment

          Working...
          X