<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Distributing virtual environment to coworkers in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1183252#M64770</link>
    <description>&lt;P&gt;For future reference this is what I arrived at finally. stick it in a .py and import it as a module into your script. Edit the required variable to include the names of any modules that will need to be pip installed if not already. No .bat files required and installs to the user's current active conda environment.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import sys
import subprocess
import pkg_resources


required = {'excel2img', 'pypdf2', 'ahk', 'ahk-binary', 'pysimplegui'}


def check_required_modules(mod_set: set)-&amp;gt; None:
    """
    Compares input set against current venv installed modules and installs them if missing
    e.g. mod_list = {'excel2img', 'pypdf2', 'ahk', 'ahk-binary', 'pysimplegui'}
    :param mod_set: string set of module names to check
    :return:
    """

    installed = {pkg.key for pkg in pkg_resources.working_set}
    missing = mod_set - installed

    if missing:
        python = r"c:\Progra~1\ArcGIS\Pro\bin\Python\scripts\propy.bat"
        for required_module in missing:
            subprocess.check_output([python, '-m', 'pip', 'install', required_module], shell=True)
            msg = f"{required_module} was missing and was installed"
            print(msg)
            arcpy.AddMessage(msg)
    else:
        msg = 'all required modules are installed! :)'
        print(msg)
        arcpy.AddMessage(msg)
    sys.exit()


check_required_modules(required)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jun 2022 18:20:51 GMT</pubDate>
    <dc:creator>Glasnoct</dc:creator>
    <dc:date>2022-06-15T18:20:51Z</dc:date>
    <item>
      <title>Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182033#M64748</link>
      <description>&lt;P&gt;Our current toolbox of scripts requires the installation of some modules that do not come with ArcPro out of the box and the current solution has been to have coworkers fire up the Python command prompt and do a "pip install" for the missing modules but that is proving to be too advanced for them and thus I'm looking for a simpler solution.&lt;BR /&gt;&lt;BR /&gt;What's the easiest way I can keep everyone up to date with any dependencies we need? Can I just do a copy-paste of the virtual environment folder? Could I clone the environment to a shared directory and have them point their project environment to that? That would be useful as I can update it as necessary and it will "populate" to all the other users.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jun 2022 19:33:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182033#M64748</guid>
      <dc:creator>Glasnoct</dc:creator>
      <dc:date>2022-06-10T19:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182134#M64749</link>
      <description>&lt;P&gt;That is timely... I am working the same process for a department. I'll share what I did, but I am also very interested in seeing what others have done as well. I haven't really found a solid solution of combining/ deploying custom python environments along with add-ins, which seems they would go hand in hand. If you are making an add-in to run a custom script... most likely you'll have a cloned environment and packages that go along with it right? It would be awesome if esri could provide a means to create/ manage environments through the SDK.&lt;/P&gt;&lt;P&gt;I dread that when Pro updates, it will constantly invalidate the new environment. With this in mind, I need a way that the user can recreate the environment each time, without me having to touch each machine after each update. I also need to be able to capture packages that they might have imported for other scripts, so they don't have to constantly switch environments or have to re-install each time.&lt;/P&gt;&lt;P&gt;I came up with a bat file script that I run from an add-in button (it can be ran as a bat file from the desktop as well) to clone the pro default env, create a yml from a cloned env, install the missing packages, copy local in-house packages, and sets the active environment in Pro to the new env.&amp;nbsp; I've had some issues with it- jupyer-notebook seems to be a pita and fails to install sometimes, which causes the transaction to rollback.&amp;nbsp; numpy sometimes complains that it wasn't installed correctly on 1/4 of the pc's I've ran this on.&lt;/P&gt;&lt;P&gt;I'm at the stage of testing deployment and adjusting commands to see if I can get it working 100%, so the -freeze-installed --no-update-deps is trial to hopefully fix this.&amp;nbsp; I'm not a conda pro by any means, so if there is a better command I should be using, please feel free to let me know. I tried to comment the code to explain each step and when I have more time, I'd like to incorporate if statements for using the clone-1 environment if it exists but for now, this gets me 98% of the way there very quickly. You can grab the yml and save it where it can be accessed and install from there too by reference the path in the conda env update line.&lt;/P&gt;&lt;P&gt;I saved a requirements.txt that has a list of additional packages I need, (grabbed from the end of the yml) and do a second pip for these to make sure that they get installed.&lt;/P&gt;&lt;P&gt;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;:: VARIABLES :&lt;BR /&gt;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/464769"&gt;@echo&lt;/a&gt; off&lt;/P&gt;&lt;P&gt;SETLOCAL&lt;/P&gt;&lt;P&gt;REM set environment names&lt;BR /&gt;SET "ENV_NAME=assessors-env"&lt;BR /&gt;SET "ARCGIS_DEFAULT=arcgispro-py3"&lt;BR /&gt;SET "ARCGIS_CLONE=arcgispro-py3-clone"&lt;/P&gt;&lt;P&gt;REM Paths set to variables&lt;BR /&gt;SET "PRO_PATH=C:\Program Files\ArcGIS\Pro\bin\Python"&lt;BR /&gt;SET "CLONED_PATH=%LOCALAPPDATA%\ESRI\conda\envs"&lt;BR /&gt;SET "REQ_PATH=\\gisdata\Assessor\ASR_ArcGIS Pro"&lt;/P&gt;&lt;P&gt;REM Set the default scripts dir path for this iteration for pip installing&lt;BR /&gt;SET PATH=%PATH%;"C:\Program Files\ArcGIS\Pro\bin\Python\Scripts"&lt;BR /&gt;REM Set the new env scripts dir path for this iteration for pip installing&lt;BR /&gt;SET PATH=%PATH%;"%PRO_PATH%\envs\%ENV_NAME%\Scripts"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;:: COMMANDS :&lt;BR /&gt;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::&lt;/P&gt;&lt;P&gt;REM start by activating the arcgis pro conda env. If successful, continue process&lt;BR /&gt;call "C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\activate.bat" &amp;amp; (&lt;BR /&gt;REM export the cloned arcgispro-py3-clone environment that contains the additional packages installed outside of arcgis pro&lt;BR /&gt;conda env export -n %ARCGIS_CLONE% &amp;gt; "%CLONED_PATH%\%ARCGIS_CLONE%\environment.yml"&lt;BR /&gt;ECHO ^-^-^&amp;gt; %ARCGIS_CLONE% conda environment exported to "%CLONED_PATH%\%ARCGIS_CLONE%\environment.yml"&lt;BR /&gt;&lt;BR /&gt;REM clone the deafult arcgispro-py3 environment to the new environment name. If needed, you can add specific package channels&lt;BR /&gt;REM CALL conda config --add channels conda-forge&lt;BR /&gt;REM CALL conda config --add channels esri&lt;BR /&gt;conda create --clone %ARCGIS_DEFAULT% --name %ENV_NAME% --pinned&lt;BR /&gt;ECHO ^-^-^&amp;gt; %ENV_NAME% environment created&lt;BR /&gt;&lt;BR /&gt;REM install packages that were not installed from the default clone, but were in the arcgispro-py3-clone environment.&lt;BR /&gt;REM conda env list&lt;BR /&gt;conda env update -n %ENV_NAME% -f "%CLONED_PATH%\%ARCGIS_CLONE%\environment.yml --freeze-installed --no-update-deps"&lt;BR /&gt;ECHO ^-^-^&amp;gt; %ENV_NAME% environment updated&lt;BR /&gt;&lt;BR /&gt;REM ensure that the new env is updated with the pip installed packages at the end of the environment.yml file.&lt;BR /&gt;pip install -r "%REQ_PATH%\Support Scripts\requirements.txt"&lt;BR /&gt;ECHO ^-^-^&amp;gt; %ENV_NAME% environment updated pip&lt;/P&gt;&lt;P&gt;REM copy local packages to the env&lt;BR /&gt;robocopy "%REQ_PATH%\cntytools" "%PRO_PATH%\envs\%ENV_NAME%\Lib\site-packages\cntytools" /E&lt;BR /&gt;&lt;BR /&gt;REM set the active environment in Pro to the new environment&lt;BR /&gt;CALL "%PRO_PATH%\Scripts\proswap.bat" %ENV_NAME%&lt;BR /&gt;ECHO ^-^-^&amp;gt; Pro env set&lt;BR /&gt;exit&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;exit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jun 2022 12:41:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182134#M64749</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-06-11T12:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182136#M64750</link>
      <description>&lt;P&gt;This is the daml for the add-in button. If you look at the Ribbons control solution in Pro SDK github repo, you'll see how to add ribbons and buttons to an add in.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;			&amp;lt;tabs&amp;gt;
				&amp;lt;tab id="RibbonControls_Tab1" caption="Admin Tools"&amp;gt;
					&amp;lt;group refID="RibbonControls_PythonEnv" /&amp;gt;
				&amp;lt;/tab&amp;gt;
			&amp;lt;/tabs&amp;gt;

			&amp;lt;groups&amp;gt;
				&amp;lt;!-- comment this out if you have no controls on the Addin tab to avoid
              an empty group--&amp;gt;
				
				&amp;lt;group id="RibbonControls_PythonEnv" caption="Python Env"&amp;gt;
					&amp;lt;!-- host Assessor GIS Maintenance controls within groups --&amp;gt;
					&amp;lt;button refID="RibbonControls_PythonEnv_Btn" size="large"/&amp;gt;
					&amp;lt;!--Use subgroups to better control ribbon resizing--&amp;gt;
					&amp;lt;!--&amp;lt;subgroup refID="RibbonControls_Subgroup2" /&amp;gt;--&amp;gt;
				&amp;lt;/group&amp;gt;
			&amp;lt;/groups&amp;gt;
			&amp;lt;controls&amp;gt;
				&amp;lt;!-- add your controls here --&amp;gt;
				&amp;lt;!-- host python environment buttons --&amp;gt;
				&amp;lt;button id="RibbonControls_PythonEnv_Btn" caption="Python Environment" className="PythonEnv_Btn" loadOnClick="true" smallImage="Images\Python-PNG-Clipart.png" largeImage="Images\Python-PNG-Clipart.png"&amp;gt;
					&amp;lt;tooltip heading="Establish Assessors-env python env"&amp;gt;
						Creates the assessors-env python environment and installs the required packages.&amp;lt;disabledText /&amp;gt;
					&amp;lt;/tooltip&amp;gt;
				&amp;lt;/button&amp;gt;
			&amp;lt;/controls&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the button logic for the add-in to run the bat file. The bat file is added as content, always copied as the pro snippets documentation for files suggest.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;internal class PythonEnv_Btn : Button
    {
        protected async override void OnClick()
        {
            var batFile = Path.Combine(Path.GetDirectoryName(Uri.UnescapeDataString(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath)), @"Utils\python-env.bat");

            await QueuedTask.Run(async () =&amp;gt;
            {
                try
                {
                    ProcessStartInfo processInfo = new ProcessStartInfo
                    {
                        FileName = batFile,
                        UseShellExecute = false,
                        CreateNoWindow = false
                    };
                    processInfo.UseShellExecute = false;
                    processInfo.RedirectStandardError = false;
                    processInfo.RedirectStandardOutput = false;

                    using (Process process = Process.Start(processInfo))
                    {
                        process.WaitForExit();
                        process.Close();
                    }

                    // Show a messagebox with the results
                    MessageBox.Show(@"Check if assessors-env was created at C:\Program Files\ArcGIS\Pro\bin\Python\envs.");

                }
                catch (Exception exc)
                {
                    // Catch any exception found and display in a message box
                    MessageBox.Show($"Exception caught while trying to validate the python env: {exc.Message}.");

                    return;
                }
            });
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;It opens a cmd and runs the bat file. When you see (env name) C:&amp;gt; stuff/stuff/stuff&amp;gt; , you can close the window.&amp;nbsp; It doesn't take any more instructions from the bat file after it activates the new environment and I haven't found a way to close it yet.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jun 2022 13:03:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182136#M64750</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-06-11T13:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182137#M64751</link>
      <description>&lt;P&gt;Ok, last one but I just thought of it after submitting the last post. You could temporary set the paths to a python package library location at the beginning of your scripts to point to the additional packages you need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;os.environ["PATH"] = 'path to your packages'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jun 2022 13:33:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182137#M64751</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-06-11T13:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182368#M64755</link>
      <description>&lt;P&gt;Lordy that's a lot of info! My use case doesn't involve any add-ins since that's a whole can of worms I doubt I'll ever open. It looks like the .bat file you have there also involves cloning the default environment. My coworkers already have cloned environments so I'm thinking the easiest way forward would just be to have them run a batch file that tries to install all the required modules. This way I can update the batch file when I have new requirements and all I need is them to run it (or even better, maybe it could run as part of the tool script? Could I do that?)&lt;BR /&gt;&lt;BR /&gt;What's the barebones batch file I can distribute to them that'll just do a pip install of a module list via their currently active environment?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 15:59:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182368#M64755</guid>
      <dc:creator>Glasnoct</dc:creator>
      <dc:date>2022-06-13T15:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182422#M64757</link>
      <description>&lt;P&gt;True, It’s a lot because it has to do a lot so I do t have to do a lot. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Ill be away for a while without internet but barebones is these two lines- replace the %variable% with your path to the requirements.txt file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Files\ArcGIS\Pro\bin\Python\Scripts\activate.bat" &amp;amp; (&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;REM ensure that the new env is updated with the pip installed packages at the end of the environment.yml file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pip install -r "%REQ_PATH%\Support Scripts\requirements.txt"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ECHO ^-^-^&amp;gt; %ENV_NAME% environment updated pip)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 18:41:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182422#M64757</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-06-13T18:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182432#M64758</link>
      <description>&lt;P&gt;Did a bit of your code get chopped off there? %REQ_PATH% isn't declared prior to usage (or doesn't need to? I don't really .bat) and it starts off with "Files".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;edit: I gotcha; I just realized it's snipped from the original batch file. I'll piece it together.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;edit2: Nope, played with it a bit but can't get it to work. activate.bat complains about "pip" and if I try "python pip" instead it complains that python can't be found. Trying it with proenv.bat activates fine but the command doesn't pass through and nothing on Google is answering how to pass the pip command after calling proenv.bat&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 19:35:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1182432#M64758</guid>
      <dc:creator>Glasnoct</dc:creator>
      <dc:date>2022-06-13T19:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1183252#M64770</link>
      <description>&lt;P&gt;For future reference this is what I arrived at finally. stick it in a .py and import it as a module into your script. Edit the required variable to include the names of any modules that will need to be pip installed if not already. No .bat files required and installs to the user's current active conda environment.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import sys
import subprocess
import pkg_resources


required = {'excel2img', 'pypdf2', 'ahk', 'ahk-binary', 'pysimplegui'}


def check_required_modules(mod_set: set)-&amp;gt; None:
    """
    Compares input set against current venv installed modules and installs them if missing
    e.g. mod_list = {'excel2img', 'pypdf2', 'ahk', 'ahk-binary', 'pysimplegui'}
    :param mod_set: string set of module names to check
    :return:
    """

    installed = {pkg.key for pkg in pkg_resources.working_set}
    missing = mod_set - installed

    if missing:
        python = r"c:\Progra~1\ArcGIS\Pro\bin\Python\scripts\propy.bat"
        for required_module in missing:
            subprocess.check_output([python, '-m', 'pip', 'install', required_module], shell=True)
            msg = f"{required_module} was missing and was installed"
            print(msg)
            arcpy.AddMessage(msg)
    else:
        msg = 'all required modules are installed! :)'
        print(msg)
        arcpy.AddMessage(msg)
    sys.exit()


check_required_modules(required)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 18:20:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1183252#M64770</guid>
      <dc:creator>Glasnoct</dc:creator>
      <dc:date>2022-06-15T18:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1185982#M64822</link>
      <description>&lt;P&gt;That is a good solution, glad you were able to get something figured out!&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 13:12:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1185982#M64822</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-06-24T13:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1185993#M64823</link>
      <description>&lt;P&gt;I was posting through my phone and had to keep it simple.&amp;nbsp; Geonet isn't very mobile friendly and I am glad that it made enough sense for you to at least try it, but I don't think I copied enough for it to work.&lt;/P&gt;&lt;P&gt;I came into that issue too with pip, activate.bat and proenv.bat as well. To get around it (and what I didn't grab to paste in the last post), I set a temp environment variable pointing to where the scripts directory is for pip.exe:&lt;/P&gt;&lt;P&gt;SET &lt;SPAN class=""&gt;PATH&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;%PATH%&lt;/SPAN&gt;;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;"&lt;/SPAN&gt;C:\Program Files\ArcGIS\Pro\bin\Python\Scripts&lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;SET&lt;/SPAN&gt; &lt;SPAN class=""&gt;PATH&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;%PATH%&lt;/SPAN&gt;;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;SPAN class=""&gt;%PRO_PATH%&lt;/SPAN&gt;\envs\&lt;SPAN class=""&gt;%ENV_NAME%&lt;/SPAN&gt;\Scripts&lt;SPAN class=""&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 13:31:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1185993#M64823</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-06-24T13:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1188429#M64873</link>
      <description>&lt;P&gt;I spoke too soon it seems as this method doesn't totally work. If I try to run it twice in a row (to check that it find all the installed modules on the second run) it still installs them again. If I run the code and then at the end just attempt to import the installed modules it throws an error about being unable to find first one it comes across. No idea if that's an issue with trying to install modules without, like, restarting Arc or what.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Also had an issue with getting some of the dependencies installed for the modules. Pywin32 seems to need admin rights to install, which is a nonstarter if the script is being run by the end user as they won't be running it with admin rights. pip with '--user' is said to work but I don't know if it IS or not to be honest.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 19:02:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1188429#M64873</guid>
      <dc:creator>Glasnoct</dc:creator>
      <dc:date>2022-06-30T19:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1188764#M64884</link>
      <description>&lt;P&gt;That is a bummer!&amp;nbsp; If you want to revisit the bat file, here it is in a complete version.&amp;nbsp; The user/ admin thing is probably due to trying to write to C:/Program Files... with all the cloned environments that there might be, its hard to say where the packages are trying to get installed.&amp;nbsp; That is one reason I went for creating an environment and setting it for my stuff, and for getting the packages that the user may have installed from their clone.&amp;nbsp; Wish there was an easier way for this....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;:: VARIABLES :&lt;BR /&gt;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/464769"&gt;@echo&lt;/a&gt; off&lt;/P&gt;&lt;P&gt;SETLOCAL&lt;/P&gt;&lt;P&gt;SET "ENV_NAME=assessors-env"&lt;/P&gt;&lt;P&gt;SET "PRO_PATH=C:\Program Files\ArcGIS\Pro\bin\Python"&lt;BR /&gt;SET "REQ_PATH=\\path to the requirements.txt"&lt;BR /&gt;SET PATH=%PATH%;"C:\Program Files\ArcGIS\Pro\bin\Python\Scripts"&lt;BR /&gt;SET PATH=%PATH%;"%PRO_PATH%\envs\%ENV_NAME%\Scripts"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::&lt;BR /&gt;:: COMMANDS :&lt;BR /&gt;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::&lt;/P&gt;&lt;P&gt;REM start by activating the arcgis pro conda env&lt;BR /&gt;call "C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\activate.bat" &amp;amp; (&lt;BR /&gt;&lt;BR /&gt;REM update the new environment with pip packages.&lt;BR /&gt;pip install -r "%REQ_PATH%\requirements.txt"&lt;BR /&gt;ECHO ^-^-^&amp;gt; %ENV_NAME% environment updated pip&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;exit&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 15:12:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1188764#M64884</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-07-01T15:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Distributing virtual environment to coworkers</title>
      <link>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1189996#M64945</link>
      <description>&lt;P&gt;I created an ArcGIS Idea for to cover stuff like this.&amp;nbsp; I'd appreciate any thumbs up/ comments/ support for it so we can get some solid guidance.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/create-documentation-for-esri-s-conda/idi-p/1189824/highlight/true" target="_blank" rel="noopener"&gt;create documentation for esri's conda&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 17:48:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/distributing-virtual-environment-to-coworkers/m-p/1189996#M64945</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-07-06T17:48:03Z</dc:date>
    </item>
  </channel>
</rss>

