Announcement

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

  • Stata can't find pandas

    Stata has suddenly become unable to find my Python modules. Any ideas on how to figure out what is going wrong or reinstall them?

    Here's some code showing the problem along with my Python setup.

    Code:
    . python: 2+2
    4
    
    . python query
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        Python Settings
          set python_exec      /usr/local/bin/python3
          set python_userpath  
    
        Python system information
          initialized          yes
          version              3.11.3
          architecture         64-bit
          library path         /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib
    
    . python search
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     Python environments found:  
     /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/Current/bin/python3
     /usr/bin/python3
     /usr/local/bin/python3
     /usr/local/bin/python3.10
     /usr/local/bin/python3.9
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    . 
    . 
    . !/usr/local/bin/pip install pandas
    
    Requirement already satisfied: pandas in /usr/local/lib/python3.11/site-packages (2.0.3)
    Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.11/site-packages (from pandas) (2.8.2)
    Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.11/site-packages (from pandas) (2023.3)
    Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.11/site-packages (from pandas) (2023.3)
    Requirement already satisfied: numpy>=1.21.0 in /usr/local/lib/python3.11/site-packages (from pandas) (1.25.2)
    Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)
    
    . 
    . python which pandas
    Python module pandas not found
    r(601);
    
    end of do-file
    
    r(601);
    
    . python
    ----------------------------------------------- python (type end to exit) ------------------------------------------------------------------------------------------------------
    >>> import pandas
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python3.11/site-packages/pandas/__init__.py", line 16, in <module>
        raise ImportError(
    ImportError: Unable to import required dependencies:
    numpy: No module named 'warnings'
    pytz: No module named 'threading'
    r(7102);
    >>> end
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    .

  • #2
    Originally posted by Dimitriy V. Masterov View Post
    Stata has suddenly become unable to find my Python modules. Any ideas on how to figure out what is going wrong or reinstall them?
    There've been some recently developed glitches with respect to Stata-Python integration. See for example this thread from last week. StataCorp is aware of it, and I presume is working on it.

    As far as re-installation, I'm not sure that it'll be the answer: since that post last week I've actually completely removed Python and re-installed it (current stable release: 3.12.0) to no avail.

    Comment


    • #3
      That's dispiriting news, Joseph Coveney, but thanks for alerting me to this possibility.

      I also neglected to add that I am still using v17:

      Code:
      Stata/MP 17.0 for Mac (Intel 64-bit)
      Revision 29 Aug 2023

      Comment

      Working...
      X