<?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 Error importing ArcGIS Pro and MATLAB libraries together in Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-importing-arcgis-pro-and-matlab-libraries/m-p/1225813#M65945</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am having an issue in setting up a Python environment to run MATLAB and ArcGIS Pro together. I have cloned the Python environment from ArcGIS and installed MATLAB Engine API within the cloned conda environment. I am unable to import ArcGIS python libraries (such as arcpy, arcgisscripting) after importing matlab.engine and vice versa as well. However, I am able to import matlab.engine or ArcGIS libraries separately. Below are the errors that I receive when I import these libraries&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Importing matlab.engine after arcpy&lt;/STRONG&gt; –&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy
&amp;gt;&amp;gt;&amp;gt; import matlab.engine
Traceback (most recent call last):
  File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "C:\Users\kjain1\AppData\Local\ESRI\conda\envs\arcgispro-py3-ALOFT\lib\site-packages\matlab\engine\__init__.py", line 77, in &amp;lt;module&amp;gt;
    raise EnvironmentError(secondExceptionMessage)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance:
First issue: DLL load failed while importing matlabengineforpython3_9: The specified procedure could not be found.
Second issue: DLL load failed while importing matlabengineforpython3_9: The specified procedure could not be found.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Importing arcpy after matlab.engine &lt;/STRONG&gt;–&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;gt;&amp;gt;&amp;gt; import matlab.engine
&amp;gt;&amp;gt;&amp;gt; import arcpy
Traceback (most recent call last):
  File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 77, in &amp;lt;module&amp;gt;
    from arcpy.geoprocessing import gp
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in &amp;lt;module&amp;gt;
    from ._base import *
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in &amp;lt;module&amp;gt;
    import arcgisscripting
  File "C:\Users\kjain1\AppData\Local\ESRI\conda\envs\arcgispro-py3-ALOFT\lib\site-packages\arcgisscripting\__init__.py", line 131, in &amp;lt;module&amp;gt;
    from ._arcgisscripting import *
ImportError: DLL load failed while importing _arcgisscripting: The specified procedure could not be found.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have installed ArcGIS Pro 3.0.2,&amp;nbsp;MATLAB R2022B and the Python version is 3.9.13.&lt;/P&gt;&lt;P&gt;How do I resolve this DLL error?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2022 18:33:56 GMT</pubDate>
    <dc:creator>KarneshJain</dc:creator>
    <dc:date>2022-10-26T18:33:56Z</dc:date>
    <item>
      <title>Error importing ArcGIS Pro and MATLAB libraries together in Python</title>
      <link>https://community.esri.com/t5/python-questions/error-importing-arcgis-pro-and-matlab-libraries/m-p/1225813#M65945</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am having an issue in setting up a Python environment to run MATLAB and ArcGIS Pro together. I have cloned the Python environment from ArcGIS and installed MATLAB Engine API within the cloned conda environment. I am unable to import ArcGIS python libraries (such as arcpy, arcgisscripting) after importing matlab.engine and vice versa as well. However, I am able to import matlab.engine or ArcGIS libraries separately. Below are the errors that I receive when I import these libraries&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Importing matlab.engine after arcpy&lt;/STRONG&gt; –&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy
&amp;gt;&amp;gt;&amp;gt; import matlab.engine
Traceback (most recent call last):
  File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "C:\Users\kjain1\AppData\Local\ESRI\conda\envs\arcgispro-py3-ALOFT\lib\site-packages\matlab\engine\__init__.py", line 77, in &amp;lt;module&amp;gt;
    raise EnvironmentError(secondExceptionMessage)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance:
First issue: DLL load failed while importing matlabengineforpython3_9: The specified procedure could not be found.
Second issue: DLL load failed while importing matlabengineforpython3_9: The specified procedure could not be found.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Importing arcpy after matlab.engine &lt;/STRONG&gt;–&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;gt;&amp;gt;&amp;gt; import matlab.engine
&amp;gt;&amp;gt;&amp;gt; import arcpy
Traceback (most recent call last):
  File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 77, in &amp;lt;module&amp;gt;
    from arcpy.geoprocessing import gp
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in &amp;lt;module&amp;gt;
    from ._base import *
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in &amp;lt;module&amp;gt;
    import arcgisscripting
  File "C:\Users\kjain1\AppData\Local\ESRI\conda\envs\arcgispro-py3-ALOFT\lib\site-packages\arcgisscripting\__init__.py", line 131, in &amp;lt;module&amp;gt;
    from ._arcgisscripting import *
ImportError: DLL load failed while importing _arcgisscripting: The specified procedure could not be found.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have installed ArcGIS Pro 3.0.2,&amp;nbsp;MATLAB R2022B and the Python version is 3.9.13.&lt;/P&gt;&lt;P&gt;How do I resolve this DLL error?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 18:33:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-importing-arcgis-pro-and-matlab-libraries/m-p/1225813#M65945</guid>
      <dc:creator>KarneshJain</dc:creator>
      <dc:date>2022-10-26T18:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error importing ArcGIS Pro and MATLAB libraries together in Python</title>
      <link>https://community.esri.com/t5/python-questions/error-importing-arcgis-pro-and-matlab-libraries/m-p/1335622#M68867</link>
      <description>&lt;P&gt;Were you ever able to solve this?&lt;/P&gt;&lt;P&gt;I'm running into the same issue, working on a script that I need to be able to launch as a tool within ArcGIS Pro, that then calls a Matlab script, which I unfortunately can't convert over to Python.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oddly, if I just run my Python script from the command line, it works as expected, so it seems like it must be related to a DLL that ArcGIS Pro loads that conflicts with one that the Matlab engine wants.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 22:29:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-importing-arcgis-pro-and-matlab-libraries/m-p/1335622#M68867</guid>
      <dc:creator>AaronAverett1</dc:creator>
      <dc:date>2023-10-05T22:29:14Z</dc:date>
    </item>
  </channel>
</rss>

