Announcement

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

  • ModuleNotFoundError: No module named 'sfi'

    I could not run the pystata with the newest update of the STATA 17 SE. I reinstall the STATA and stata_setup (Restart the computer too), unfortunately not helped.

    What is the problem is the lack of sfi initialized. When I run `python: import sfi` it is working perfectly fine inside STATA.

    Thanks for the support.

    ```

    import stata_setup

    stata_setup.config("/Applications/Stata", "se")

    from pystata import config




    > config.status()

    System information

    Python version 3.10.6

    Stata version SE

    Stata library path /Applications/Stata/StataSE.app/Contents/MacOS/libstata-se.dylib

    Stata initialized True

    sfi initialized False




    Settings

    graphic display True

    graphic size width = default, height = default

    graphic format svg




    > from pystata import stata

    ---------------------------------------------------------------------------

    ModuleNotFoundError Traceback (most recent call last)

    Input In [5], in <cell line: 1>()

    ----> 1 from pystata import stata




    File /Applications/Stata/utilities/pystata/stata.py:16, in <module>

    13 else:

    14 from queue import LifoQueue

    ---> 16 import sfi

    17 from pystata.core import stout

    18 import codeop




    ModuleNotFoundError: No module named 'sfi'

    ```




    ​​​​​​​Machine:




    ```

    posix.uname_result(sysname='Darwin', nodename='Maciejs-MacBook-Pro.local', release='21.6.0', version='Darwin Kern

    > el Version 21.6.0: Wed Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64', machine='x86_64')

    ```

  • #2
    I think I finally found out the problem, sometime ago I had a similar one with the R installation from Homebrew.
    When I install python directly from https://www.python.org/downloads/ then pystata works fine now.
    This time it was a problem of the pyenv and the python installation from the source, such python was not suited for STATA (in my case).

    To reproduce the problem:

    ```
    brew install pyenv
    pyenv install -l
    # is installed from source
    pyenv install 3.10.6
    pyenv global 3.10.6
    # close terminal
    python
    # now pystata will fail
    ```

    Comment


    • #3
      The answer for pyenv is to still build the python from source but with the shared library, `CONFIGURE_OPTS=--enable-shared pyenv install 3.10.6` .

      Comment

      Working...
      X