I am having some trouble getting the new Python integration to work in Stata 16. Specifically, some of my modules are not found even after I specify the python executable file and set the python userpath.
I am on a linux machine on which I do not have administrative privileges but do have substantial freedom to keep files and install software locally in my home directory. The Stata license is system-wide but my Python 3.7 installation is local (via miniconda3). There are other Python versions installed in system locations but I do not want to use them, as I would like to be able to manage my own Python packages which are not all available on the wider system.
I have instructed Stata to find my local Python executable by setting python_exec, and have also set the python_userpath variable to the site-packages/ directory of my local Python installation, with the prepend option. The directory structure is such that, within site-packages/, there are many directories corresponding with package names and these contain the .py files for the installed packages. It is a standard miniconda3 structure. Running
confirms that the two variables have been set and that the correct Python system has been identified with its corresponding library.
Some packages are found; for example,
displays the correct location for numpy. However,
results in error r(601), "Python module pandas not found," even though pandas is installed and its file structure is extremely similar to that of numpy (both relevant files are named __init__.py and are in an eponymous directory within site-packages/).
I tried adding site-packages/pandas/ to the library path, but with no success. I also tried creating a symbolic link to pandas/__init__.py with the name pandas.py in the site-packages/ directory, hoping that Stata would be looking for a file with that name in that location, but pandas is still not found. I'm not sure what might be causing this and I feel I have exhausted the available documentation. Please advise.
I am on a linux machine on which I do not have administrative privileges but do have substantial freedom to keep files and install software locally in my home directory. The Stata license is system-wide but my Python 3.7 installation is local (via miniconda3). There are other Python versions installed in system locations but I do not want to use them, as I would like to be able to manage my own Python packages which are not all available on the wider system.
I have instructed Stata to find my local Python executable by setting python_exec, and have also set the python_userpath variable to the site-packages/ directory of my local Python installation, with the prepend option. The directory structure is such that, within site-packages/, there are many directories corresponding with package names and these contain the .py files for the installed packages. It is a standard miniconda3 structure. Running
Code:
python query
Some packages are found; for example,
Code:
python where numpy
Code:
python where pandas
I tried adding site-packages/pandas/ to the library path, but with no success. I also tried creating a symbolic link to pandas/__init__.py with the name pandas.py in the site-packages/ directory, hoping that Stata would be looking for a file with that name in that location, but pandas is still not found. I'm not sure what might be causing this and I feel I have exhausted the available documentation. Please advise.
Comment