Announcement

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

  • python

    Dear All,

    I recently started to integrate python in Stata, rather then running them separately. Usually, in python I create a conda environment where I install all the dependencies and then I write the python script. In Stata I can set the python executable to the one indicated in my environment. For instance: I generate an environment called church, then In Stata I type:

    Code:
    python set exec "C:\ProgramData\miniconda3\envs\church\python.exe"
    My issue is: If I need to run another python script, which possibly uses other dependencies and is supported by another environment, I cannot change the python executable unless I close and restart Stata. At least this is what I understood reading the user manual. Am I wrong? If (hopefully) I am, how can I change the python executable without restarting Stata.

    Thanks for any help you may provide.

    Dario

  • #2
    Hi Dario Maimone Ansaldo Patti,

    Once the Python environment has been successfully initialized, it is not possible to switch to another Python executable without restarting Stata. To solve your problem, you can create a separate virtual environment and install all necessary dependencies within it. This approach ensures that your other Python installations remain isolated.

    Comment

    Working...
    X