Announcement

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

  • How to install Python packages using pip

    I'm wanting to explore the -scpi- packages of Catteneo et al. for Synthetic Control which use Stata's Python integration feature (https://nppackages.github.io/scpi/ ) This Python newbie is not having any success installing them. (Stata 17MP on Windows 10)

    My Python installation is fine, I think

    Code:
    . python query
    --------------------------------------------------------------------------------
        Python Settings
          set python_exec      C:\Users\JENKINSS\Anaconda3\python.exe
          set python_userpath  
    
        Python system information
          initialized          yes
          version              3.8.8
          architecture         64-bit
          library path         C:\Users\JENKINSS\Anaconda3\python38.dll
    I discover I need Python's pip command to do installations. (Cf. https://blog.stata.com/2020/09/01/st...thon-packages/ )

    I downloaded a copy of "get-pip.py" from the internet to my Python directory C:\Users\JENKINSS\Anaconda3.

    Directory of C:\Users\JENKINSS\Anaconda3

    22/02/2022 18:10 2,609,803 get-pip.py
    1 File(s) 2,609,803 bytes
    0 Dir(s) 397,221,289,984 bytes free

    Code:
    Then I tried to install it and got error messages saying I need the -ssl- Python module!
    
    C:\Users\JENKINSS\Anaconda3>python get-pip.py
    WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
    WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
    WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
    WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
    WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
    Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
    ERROR: Could not find a version that satisfies the requirement pip (from versions: none)
    ERROR: No matching distribution found for pip
    WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

    According to an internet page I saw, I need -pip- to install -ssl-!

    Overall result: I'm lost. And, to be honest, surprised at the degree of hassle required for what I thought be a basic task -- though my immediate counter-reaction is that I must be doing something wrong, and there must be some easier way ... but what is it? Thanks for any tips

    Or is there some issue regarding local admin rights. (It's my office PC, and so controlled by local IT services ... but I do have some local admin rights that enable me to install software.)







  • #2
    Hi Stephen,

    What is the result you get if you try this in the shell?

    Code:
    C:\Users\JENKINSS\Anaconda3>pip --version
    If it gives you a non-error result, you should have -pip- already installed and can call it from that folder to install PyPI modules for your Anaconda distribution of Python located there.

    One or more versions of -pip- is likely located in that folder in a subfolder called "Scripts".

    - joe
    Joseph Nicholas Luchman, Ph.D., PStatĀ® (American Statistical Association)
    ----
    Research Fellow
    Fors Marsh

    ----
    Version 18.0 MP

    Comment


    • #3
      Thank you, Joseph Luchman. Trying what you suggested, produced an error

      Code:
      C:\>cd \Users\JENKINSS\Anaconda3
      
      C:\Users\JENKINSS\Anaconda3>pip --version
      'pip' is not recognized as an internal or external command,
      operable program or batch file.
      So, I changed to the subdirectory "Scripts" and see the following after calling -dir-
      Code:
      18/02/2021  22:06               216 pip-script.py
      15/01/2021  10:04            41,984 pip.exe
      18/02/2021  22:06               216 pip3-script.py
      15/01/2021  10:04            41,984 pip3.exe
      I also get

      Code:
      C:\Users\JENKINSS\Anaconda3\Scripts>pip --version
      pip 21.0.1 from C:\Users\JENKINSS\Anaconda3\lib\site-packages\pip (python 3.8)
      
      C:\Users\JENKINSS\Anaconda3\Scripts>pip -V
      pip 21.0.1 from C:\Users\JENKINSS\Anaconda3\lib\site-packages\pip (python 3.8)
      Please excuse my ignorance, but how do I proceed from here? Trying to
      Code:
       
       pip install scpi_pkg
      from the Scripts subdirectory leads to the same error referring to -ssl- that I mentioned before.

      Comment


      • #4
        Your problems are likely a result of the base Anaconda directory, the Anaconda/Scripts directory, and the Anaconda/Library/bin directory not being in your PATH variable. To resolve this, type "SystemPropertiesAdvanced" into Windows Run, click on Environment Variables, and then edit the PATH variable, adding the full paths for those three directories (e.g., C:\Users\JENKINSS\Anaconda3; C:\Users\JENKINSS\Anaconda3\Scripts; C:\Users\JENKINSS\Anaconda3\Library\bin)

        Comment


        • #5
          Stephen,
          I agree that installing Python is not fun. I had several different issues as well. I tested what Joseph recommends in my computer using Command Prompt (you can open it from Windows 'Type here to search' box).
          I share with you.
          C

          Click image for larger version

Name:	pip version.jpg
Views:	1
Size:	11.7 KB
ID:	1651461

          Comment


          • #6
            what happens if you run from your Anaconda Prompt
            Code:
            pip install scpi_pkg
            or
            Code:
            python -m pip install  scpi_pkg
            like
            Code:
            (testenv) C:\Users\name>python -m pip install  scpi_pkg

            Comment


            • #7
              Quote from https://docs.anaconda.com/anaconda/user-guide/faq/

              Should I add Anaconda to the Windows PATH?

              When installing Anaconda, we recommend that you do not add Anaconda to the Windows PATH because this can interfere with other software. Instead, open Anaconda with the Start Menu and select Anaconda Prompt, ...).
              Using pip in an environment
              conda cheat sheet PDF (1 MB) for a single-page summary of the most important information about using conda.
              conda_user_guide


              Comment


              • #8
                Thank you all, for your suggestions. Bjarte (Bjarte Aagnes ), in particular -- inspired suggestion to use the Anaconda prompt! So, I tried
                Code:
                what happens if you run from your Anaconda Prompt
                Code: 
                 pip install scpi_pkg
                Some success: I got an installation message.

                Code:
                (base) C:\>pip install scpi_pkg
                Collecting scpi_pkg
                  Downloading scpi_pkg-0.1-py3-none-any.whl (34 kB)
                Collecting nlopt>=2.7.0
                  Downloading nlopt-2.7.0-cp38-cp38-win_amd64.whl (320 kB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 320 kB 6.8 MB/s
                Requirement already satisfied: scikit-learn>=0.24.1 in c:\users\jenkinss\anaconda3\lib\site-packages (from scpi_pkg) (0.24.1)
                  Downloading scpi_pkg-0.1-py3-none-any.whl (34 kB)
                Collecting nlopt>=2.7.0
                  Downloading nlopt-2.7.0-cp38-cp38-win_amd64.whl (320 kB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 320 kB 6.8 MB/s
                Requirement already satisfied: scikit-learn>=0.24.1 in c:\users\jenkinss\anaconda3\lib\site-packages (from scpi_pkg) (0.24.1)
                Collecting scipy>=1.7.1
                  Downloading scipy-1.8.0-cp38-cp38-win_amd64.whl (36.9 MB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 36.9 MB 557 kB/s
                Collecting cvxpy>=1.1.18
                  Downloading cvxpy-1.1.18-cp38-cp38-win_amd64.whl (799 kB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 799 kB ...
                Requirement already satisfied: numpy>=1.20.1 in c:\users\jenkinss\anaconda3\lib\site-packages (from scpi_pkg) (1.20.1)
                Requirement already satisfied: statsmodels>=0.12.2 in c:\users\jenkinss\anaconda3\lib\site-packages (from scpi_pkg) (0.12.2)
                Collecting plotnine>=0.8.0
                  Downloading plotnine-0.8.0-py3-none-any.whl (4.7 MB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 4.7 MB ...
                Requirement already satisfied: pandas>=1.2.4 in c:\users\jenkinss\anaconda3\lib\site-packages (from scpi_pkg) (1.2.4)
                Requirement already satisfied: dask>=2021.04.0 in c:\users\jenkinss\anaconda3\lib\site-packages (from scpi_pkg) (2021.4.0)
                Collecting osqp>=0.4.1
                  Downloading osqp-0.6.2.post5-cp38-cp38-win_amd64.whl (278 kB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 278 kB 6.4 MB/s
                Collecting scs>=1.1.6
                  Downloading scs-3.2.0-cp38-cp38-win_amd64.whl (8.1 MB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 8.1 MB 6.4 MB/s
                Collecting ecos>=2
                  Downloading ecos-2.0.10-cp38-cp38-win_amd64.whl (68 kB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 68 kB 3.1 MB/s
                Requirement already satisfied: fsspec>=0.6.0 in c:\users\jenkinss\anaconda3\lib\site-packages (from dask>=2021.04.0->scpi_pkg) (0.9.0)
                Requirement already satisfied: toolz>=0.8.2 in c:\users\jenkinss\anaconda3\lib\site-packages (from dask>=2021.04.0->scpi_pkg) (0.11.1)
                Requirement already satisfied: pyyaml in c:\users\jenkinss\anaconda3\lib\site-packages (from dask>=2021.04.0->scpi_pkg) (5.4.1)
                Requirement already satisfied: partd>=0.3.10 in c:\users\jenkinss\anaconda3\lib\site-packages (from dask>=2021.04.0->scpi_pkg) (1.2.0)
                Requirement already satisfied: cloudpickle>=1.1.1 in c:\users\jenkinss\anaconda3\lib\site-packages (from dask>=2021.04.0->scpi_pkg) (1.6.0)
                Collecting qdldl
                  Downloading qdldl-0.1.5.post0-cp38-cp38-win_amd64.whl (74 kB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 74 kB 1.3 MB/s
                Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\jenkinss\anaconda3\lib\site-packages (from pandas>=1.2.4->scpi_pkg) (2.8.1)
                Requirement already satisfied: pytz>=2017.3 in c:\users\jenkinss\anaconda3\lib\site-packages (from pandas>=1.2.4->scpi_pkg) (2021.1)
                Requirement already satisfied: locket in c:\users\jenkinss\anaconda3\lib\site-packages\locket-0.2.1-py3.8.egg (from partd>=0.3.10->dask>=2021.04.0->scpi_pkg) (0.2.1)
                Collecting descartes>=1.1.0
                  Downloading descartes-1.1.0-py3-none-any.whl (5.8 kB)
                Requirement already satisfied: matplotlib>=3.1.1 in c:\users\jenkinss\anaconda3\lib\site-packages (from plotnine>=0.8.0->scpi_pkg) (3.3.4)
                Requirement already satisfied: patsy>=0.5.1 in c:\users\jenkinss\anaconda3\lib\site-packages (from plotnine>=0.8.0->scpi_pkg) (0.5.1)
                Collecting mizani>=0.7.3
                  Downloading mizani-0.7.3-py3-none-any.whl (63 kB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 63 kB ...
                Requirement already satisfied: pillow>=6.2.0 in c:\users\jenkinss\anaconda3\lib\site-packages (from matplotlib>=3.1.1->plotnine>=0.8.0->scpi_pkg) (8.2.0)
                Requirement already satisfied: cycler>=0.10 in c:\users\jenkinss\anaconda3\lib\site-packages (from matplotlib>=3.1.1->plotnine>=0.8.0->scpi_pkg) (0.10.0)
                Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in c:\users\jenkinss\anaconda3\lib\site-packages (from matplotlib>=3.1.1->plotnine>=0.8.0->scpi_pkg) (2.4.7)
                Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\jenkinss\anaconda3\lib\site-packages (from matplotlib>=3.1.1->plotnine>=0.8.0->scpi_pkg) (1.3.1)
                Requirement already satisfied: six in c:\users\jenkinss\anaconda3\lib\site-packages (from cycler>=0.10->matplotlib>=3.1.1->plotnine>=0.8.0->scpi_pkg) (1.15.0)
                Collecting palettable
                  Downloading palettable-3.3.0-py2.py3-none-any.whl (111 kB)
                     |ā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆā–ˆ| 111 kB ...
                Requirement already satisfied: joblib>=0.11 in c:\users\jenkinss\anaconda3\lib\site-packages (from scikit-learn>=0.24.1->scpi_pkg) (1.0.1)
                Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\jenkinss\anaconda3\lib\site-packages (from scikit-learn>=0.24.1->scpi_pkg) (2.1.0)
                Installing collected packages: scipy, qdldl, palettable, scs, osqp, mizani, ecos, descartes, plotnine, nlopt, cvxpy, scpi-pkg
                  Attempting uninstall: scipy
                    Found existing installation: scipy 1.6.2
                    Uninstalling scipy-1.6.2:
                      Successfully uninstalled scipy-1.6.2
                Successfully installed cvxpy-1.1.18 descartes-1.1.0 ecos-2.0.10 mizani-0.7.3 nlopt-2.7.0 osqp-0.6.2.post5 palettable-3.3.0 plotnine-0.8.0 qdldl-0.1.5.post0 scipy-1.8.0 scpi-pkg-0.1 scs-3.2.0
                
                (base) C:\>
                And then, from the Stata prompt, I got

                Code:
                . python which scpi_pkg
                <module 'scpi_pkg' from 'C:\\Users\\JENKINSS\\Anaconda3\\lib\\site-packages\\scp
                > i_pkg\\__init__.py'>
                which appears to confirm successful installation. And yet, when I run the test do-file script that is downloadable from the scpi Github site I cited in earlier message, I get an error that I don't understand:

                Code:
                . do "d:\home\stephenj\data\scpi_illustration.do"
                
                . *****************************************************************************************
                . ** SCPI Stata Package
                . ** Do-file for Empirical Illustration 
                . ** Authors: Matias D. Cattaneo, Yingjie Feng, Filippo Palomba and Rocio Titiunik 
                . *****************************************************************************************
                . ** hlp2winpdf, cdn(scdata) replace
                . ** hlp2winpdf, cdn(scest) replace
                . ** hlp2winpdf, cdn(scpi) replace
                . ** hlp2winpdf, cdn(scplot) replace
                . *****************************************************************************************
                . ** net install scpi, from(https://raw.githubusercontent.com/nppackages/scpi/master/stata) replace
                . *****************************************************************************************
                . clear all
                
                . set more off
                
                . set linesize 80
                
                . 
                . ******************************************************************************
                > ***********
                . ** load data
                . ******************************************************************************
                > ***********
                . use "scpi_germany.dta", clear
                
                . 
                . ******************************************************************************
                > ***********
                . ** prepare data - one feature, cointegrated data
                . ******************************************************************************
                > ***********
                . scdata gdp, dfname("python_scdata") id(country) outcome(gdp) time(year) ///
                >                         treatment(status) cointegrated constant
                Traceback (most recent call last):
                  File "<stdin>", line 1, in <module>
                  File "C:\Users\JENKINSS\Anaconda3\lib\site-packages\scpi_pkg\scdata.py", line 
                > 17, in <module>
                    from .funs import complete_cases
                  File "C:\Users\JENKINSS\Anaconda3\lib\site-packages\scpi_pkg\funs.py", line 17
                > , in <module>
                    import statsmodels.api as sm
                  File "C:\Users\JENKINSS\Anaconda3\lib\site-packages\statsmodels\api.py", line 
                > 27, in <module>
                    from .tsa import api as tsa
                  File "C:\Users\JENKINSS\Anaconda3\lib\site-packages\statsmodels\tsa\api.py", l
                > ine 31, in <module>
                    from .filters import api as filters
                  File "C:\Users\JENKINSS\Anaconda3\lib\site-packages\statsmodels\tsa\filters\ap
                > i.py", line 6, in <module>
                    from .filtertools import miso_lfilter, convolution_filter, recursive_filter
                  File "C:\Users\JENKINSS\Anaconda3\lib\site-packages\statsmodels\tsa\filters\fi
                > ltertools.py", line 18, in <module>
                    from scipy.signal.signaltools import _centered as trim_centered
                ImportError: cannot import name '_centered' from 'scipy.signal.signaltools' (C:\
                > Users\JENKINSS\Anaconda3\lib\site-packages\scipy\signal\signaltools.py)
                (95 lines skipped)
                (error occurred while loading scdata.ado)
                r(7102);
                
                end of do-file
                
                r(7102);
                Thanks, too, for the 'conda document references. Unfortunately, they go over my head, the 'environment' material, in particular. (I'm surprised that I should have to fiddle with environment settings to get this package to work from Stata. I've got other Python-linked packages such as -c_ml_stata- by Giovanni Cerulli (SSC) to work 'as is'.

                Comment


                • #9
                  Others have experienced similar issue: https://stackoverflow.com/questions/...al-signaltools

                  You can get info on the versions by
                  Code:
                  > conda list statsmodels
                  > conda list scipy
                  and install specific versions by
                  Code:
                  > conda install scipy==1.8.0
                  > conda install statsmodels==0.12.2
                  Last edited by Bjarte Aagnes; 23 Feb 2022, 05:05.

                  Comment


                  • #10
                    Thanks again. The packages I have installed -- again checking via the Anaconda prompt (not Windows system prompt) -- are.

                    Code:
                    (base) C:\>conda list statsmodels
                    # packages in environment at C:\Users\JENKINSS\Anaconda3:
                    #
                    # Name                    Version                   Build  Channel
                    statsmodels               0.12.2           py38h2bbff1b_0
                    
                    (base) C:\>conda list scipy
                    # packages in environment at C:\Users\JENKINSS\Anaconda3:
                    #
                    # Name                    Version                   Build  Channel
                    scipy                     1.8.0                    pypi_0    pypi
                    
                    (base) C:\>
                    Following the advice at the StackExchange Bjarte pointed me to (https://stackoverflow.com/questions/...al-signaltools) , I tried to update -statsmodels-, and failed:

                    Code:
                    
                    (base) C:\>conda install statsmodels==0.13.2
                    Collecting package metadata (current_repodata.json): done
                    Solving environment: failed with initial frozen solve. Retrying with flexible solve.
                    Collecting package metadata (repodata.json): done
                    Solving environment: failed with initial frozen solve. Retrying with flexible solve.
                    
                    PackagesNotFoundError: The following packages are not available from current channels:
                    
                      - statsmodels==0.13.2
                    
                    Current channels:
                    
                      - https://repo.anaconda.com/pkgs/main/win-64
                      - https://repo.anaconda.com/pkgs/main/noarch
                      - https://repo.anaconda.com/pkgs/r/win-64
                      - https://repo.anaconda.com/pkgs/r/noarch
                      - https://repo.anaconda.com/pkgs/msys2/win-64
                      - https://repo.anaconda.com/pkgs/msys2/noarch
                    
                    To search for alternate channels that may provide the conda package you're
                    looking for, navigate to
                    
                        https://anaconda.org
                    
                    and use the search bar at the top of the page.
                    I'll try and follow up the advice about 'search for alternate channels' later in the day

                    Comment


                    • #11
                      I use
                      Code:
                      ! py -m pip install [command]

                      Comment


                      • #12
                        Code:
                        >conda install statsmodels==0.13.2 --channel conda-forge

                        Comment


                        • #13
                          Thanks again, Bjarte! Ultimately, success, in the sense that I tried what you suggested. Afterwards I got the sample examples script to run in Stata!

                          In gory detail (and with one final query at the end)

                          I tried
                          Code:
                           
                           conda install statsmodels==0.13.2 --channel conda-forge
                          with the following results:


                          Code:
                          
                          (base) C:\>conda install statsmodels==0.13.2 --channel conda-forge
                          Collecting package metadata (current_repodata.json): done
                          Solving environment: -
                          The environment is inconsistent, please check the package plan carefully
                          The following packages are causing the inconsistency:
                          
                            - defaults/win-64::anaconda==2021.05=py38_0
                            - defaults/win-64::astropy==4.2.1=py38h2bbff1b_1
                            - defaults/win-64::patsy==0.5.1=py38_0
                            - defaults/win-64::scikit-image==0.18.1=py38hf11a4ad_0
                            - defaults/win-64::scikit-learn==0.24.1=py38hf11a4ad_0
                            - defaults/noarch::seaborn==0.11.1=pyhd3eb1b0_0
                            - defaults/win-64::statsmodels==0.12.2=py38h2bbff1b_0
                          failed with initial frozen solve. Retrying with flexible solve.
                          Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
                          Collecting package metadata (repodata.json): done
                          Solving environment: -
                          The environment is inconsistent, please check the package plan carefully
                          The following packages are causing the inconsistency:
                          
                            - defaults/win-64::anaconda==2021.05=py38_0
                            - defaults/win-64::astropy==4.2.1=py38h2bbff1b_1
                            - defaults/win-64::patsy==0.5.1=py38_0
                            - defaults/win-64::scikit-image==0.18.1=py38hf11a4ad_0
                            - defaults/win-64::scikit-learn==0.24.1=py38hf11a4ad_0
                            - defaults/noarch::seaborn==0.11.1=pyhd3eb1b0_0
                            - defaults/win-64::statsmodels==0.12.2=py38h2bbff1b_0
                          done
                          
                          
                          ==> WARNING: A newer version of conda exists. <==
                            current version: 4.10.1
                            latest version: 4.11.0
                          
                          Please update conda by running
                          
                              $ conda update -n base -c defaults conda
                          ## Package Plan ##
                          
                            environment location: C:\Users\JENKINSS\Anaconda3
                          
                            added / updated specs:
                              - statsmodels==0.13.2
                          
                          
                          The following packages will be downloaded:
                          
                              package                    |            build
                              ---------------------------|-----------------
                              _anaconda_depends-2020.07  |           py38_0           6 KB
                              anaconda-custom            |           py38_1          36 KB
                              ca-certificates-2021.10.8  |       h5b45459_0         176 KB  conda-forge
                              certifi-2021.10.8          |   py38haa244fe_1         145 KB  conda-forge
                              conda-4.11.0               |   py38haa244fe_0        16.9 MB  conda-forge
                              gmpy2-2.1.2                |   py38hb63f22f_0         155 KB  conda-forge
                              libllvm9-9.0.1             |default_hcbf89dc_4          50 KB  conda-forge
                              mpc-1.2.1                  |       h54e1faf_0         103 KB  conda-forge
                              mpfr-4.1.0                 |       h8d14728_1         450 KB  conda-forge
                              mpir-3.0.0                 |    he025d50_1002         3.0 MB  conda-forge
                              openssl-1.1.1l             |       h8ffe710_0         5.7 MB  conda-forge
                              pathtools-0.1.2            |             py_1           8 KB  conda-forge
                              python_abi-3.8             |           2_cp38           4 KB  conda-forge
                              ------------------------------------------------------------
                                                                     Total:        26.7 MB
                          
                          The following NEW packages will be INSTALLED:
                          
                            _anaconda_depends  pkgs/main/win-64::_anaconda_depends-2020.07-py38_0
                            gmpy2              conda-forge/win-64::gmpy2-2.1.2-py38hb63f22f_0
                            libllvm9           conda-forge/win-64::libllvm9-9.0.1-default_hcbf89dc_4
                            mpc                conda-forge/win-64::mpc-1.2.1-h54e1faf_0
                            mpfr               conda-forge/win-64::mpfr-4.1.0-h8d14728_1
                            mpir               conda-forge/win-64::mpir-3.0.0-he025d50_1002
                            pathtools          conda-forge/noarch::pathtools-0.1.2-py_1
                            python_abi         conda-forge/win-64::python_abi-3.8-2_cp38
                            scipy              pkgs/main/win-64::scipy-1.6.2-py38h66253e8_1
                          
                          The following packages will be UPDATED:
                          
                            ca-certificates    pkgs/main::ca-certificates-2021.4.13-~ --> conda-forge::ca-certificates-2021.10.8-h5b45459_0
                            certifi            pkgs/main::certifi-2020.12.5-py38haa9~ --> conda-forge::certifi-2021.10.8-py38haa244fe_1
                            conda              pkgs/main::conda-4.10.1-py38haa95532_1 --> conda-forge::conda-4.11.0-py38haa244fe_0
                            openssl              pkgs/main::openssl-1.1.1k-h2bbff1b_0 --> conda-forge::openssl-1.1.1l-h8ffe710_0
                          
                          The following packages will be DOWNGRADED:
                          
                            anaconda                                   2021.05-py38_0 --> custom-py38_1
                          
                          
                          Proceed ([y]/n)? y
                          
                          
                          Downloading and Extracting Packages
                          mpc-1.2.1            | 103 KB    | ########################################################################### | 100%
                          mpir-3.0.0           | 3.0 MB    | ########################################################################### | 100%
                          conda-4.11.0         | 16.9 MB   | ########################################################################### | 100%
                          _anaconda_depends-20 | 6 KB      | ########################################################################### | 100%
                          certifi-2021.10.8    | 145 KB    | ########################################################################### | 100%
                          python_abi-3.8       | 4 KB      | ########################################################################### | 100%
                          openssl-1.1.1l       | 5.7 MB    | ########################################################################### | 100%
                          mpfr-4.1.0           | 450 KB    | ########################################################################### | 100%
                          anaconda-custom      | 36 KB     | ########################################################################### | 100%
                          ca-certificates-2021 | 176 KB    | ########################################################################### | 100%
                          gmpy2-2.1.2          | 155 KB    | ########################################################################### | 100%
                          pathtools-0.1.2      | 8 KB      | ########################################################################### | 100%
                          libllvm9-9.0.1       | 50 KB     | ########################################################################### | 100%
                          Preparing transaction: done
                          Verifying transaction: done
                          Executing transaction: done
                          I don't know whether it's vital to update the bit mentioned, as didn't work

                          Code:
                          (base) C:\>conda update -n base -c defaults conda
                          Collecting package metadata (current_repodata.json): done
                          Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
                          Collecting package metadata (repodata.json): done
                          Solving environment: failed
                          
                          PackagesNotFoundError: The following packages are not available from current channels:
                          
                            - statsmodels==0.13.2
                          
                          Current channels:
                          
                            - https://repo.anaconda.com/pkgs/main/win-64
                            - https://repo.anaconda.com/pkgs/main/noarch
                            - https://repo.anaconda.com/pkgs/r/win-64
                            - https://repo.anaconda.com/pkgs/r/noarch
                            - https://repo.anaconda.com/pkgs/msys2/win-64
                            - https://repo.anaconda.com/pkgs/msys2/noarch
                          
                          To search for alternate channels that may provide the conda package you're
                          looking for, navigate to
                          
                              https://anaconda.org
                          
                          and use the search bar at the top of the page.

                          Comment


                          • #14
                            ref. final query at end: PackagesNotFoundError:
                            Code:
                            conda config --append channels conda-forge
                            should append channel conda-forge to the list of channels, and statsmodels==0.13.2 should then be found.

                            https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html

                            Comment


                            • #15
                              thanks, Bjarte. Interestingly, implementing your suggestion appears to have had no effect. Notice how Channel still not cited for statsmodels

                              Code:
                              (base) C:\>conda config --append channels conda-forge
                              
                              (base) C:\>conda list statsmodels
                              # packages in environment at C:\Users\JENKINSS\Anaconda3:
                              #
                              # Name                    Version                   Build  Channel
                              statsmodels               0.12.2           py38h2bbff1b_0
                              
                              (base) C:\>conda list scipy
                              # packages in environment at C:\Users\JENKINSS\Anaconda3:
                              #
                              # Name                    Version                   Build  Channel
                              scipy                     1.8.0                    pypi_0    pypi
                              When I run
                              Code:
                              (base) C:\>conda list
                              statsmodels is listed, however, though again with a citation of Channel. In fact, most of the packages listed don't have an associated channel

                              Comment

                              Working...
                              X