<?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: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts? in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11252018#M12558</link>
    <description>You can always know where Fusion360's Python interpreter is with:&lt;BR /&gt;(from Text Command (Ctlr-Alt-C) and set it to "Py" on right hand bottom corner):&lt;BR /&gt;import sys&lt;BR /&gt;print(sys.executable)</description>
    <pubDate>Wed, 22 Jun 2022 17:33:18 GMT</pubDate>
    <dc:creator>Jorge_Jaramillo</dc:creator>
    <dc:date>2022-06-22T17:33:18Z</dc:date>
    <item>
      <title>How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/9355499#M12550</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to write a script in Python and in the Visual Studio Code editor using modules like numpy. If I simply add the line "import numpy as np" to my script without further actions, numpy is not recognized. How can I refer to the installation of anaconda on my PC, because with anaconda, numpy and other useful modules would be available?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your answer!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 14:30:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/9355499#M12550</guid>
      <dc:creator>J.M.MAY</dc:creator>
      <dc:date>2020-03-03T14:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/9930453#M12551</link>
      <description>&lt;P&gt;It is interesting to note that most users simply ignored the question. Could it be that it is considered unnecessary to call on other libraries in conjunction with the Fusion 360 API? I find that in my own work, it makes some things easier for me to use numpy, matplotlib and some other modules. Please note that the experience here only applies to Windows 10.&amp;nbsp;&lt;/P&gt;&lt;P&gt;From Anaconda, you can easily request a terminal from which your Python interpreter is reachable. In the Python version installed into Fusion 360, things are different. The real problem is to locate where the Fusion 360 embedded Python interpreter is located. Searching manually on my computer, I found it at:&lt;/P&gt;&lt;P&gt;c:\Users\myUserID\AppData\Local\Autodesk\Webdeploy\Production\abxy234...&lt;/P&gt;&lt;P&gt;That last subdirectory appears to be a 40 character random generate alphanumeric.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My initial fear stems from the fact that that last directory appears to change frequently and I therefore wonder if changes made will be permanent. I have tried it and so far, it works.&lt;/P&gt;&lt;P&gt;Once you move to that directory when launching&amp;nbsp;&lt;/P&gt;&lt;P&gt;pip install numpy&lt;/P&gt;&lt;P&gt;or any other desired library, it works with the Python interpreter in Fusion 360.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 18:05:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/9930453#M12551</guid>
      <dc:creator>oafak</dc:creator>
      <dc:date>2020-12-10T18:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/10517284#M12552</link>
      <description>&lt;P&gt;As mentionned by &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4916072"&gt;@oafak&lt;/a&gt;, a solution is to install libraries with pip from the Python path used by Fusion360.&lt;/P&gt;&lt;P&gt;Here is a script that you can execute through Fusion360 on Windows, that find the right path and install numpy and scipy automatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;import adsk.core, adsk.fusion, adsk.cam, traceback
import os, sys

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface

        install_numpy = sys.path[0] +'\Python\python.exe -m pip install numpy'
        install_scipy = sys.path[0] +'\Python\python.exe -m pip install scipy'

        os.system('cmd /c "' + install_numpy + '"')
        os.system('cmd /c "' + install_scipy + '"')
        
        try:
            import scipy
            ui.messageBox("Installation succeeded !")
        except:
            ui.messageBox("Failed when executing 'import scipy'")

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 15:32:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/10517284#M12552</guid>
      <dc:creator>come.butin</dc:creator>
      <dc:date>2021-08-03T15:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11249160#M12554</link>
      <description>&lt;P&gt;Thank you. This solution is fantastic. Do you know how to adapt it for macOS? I'd be very grateful for any help.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 16:10:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11249160#M12554</guid>
      <dc:creator>mjwootton</dc:creator>
      <dc:date>2022-06-21T16:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11250575#M12555</link>
      <description>I'm not familiar with MacOS. Although, I think that the only things you have to adapt is the command line which is executed on your terminal (the arguments of os.system() function).&lt;BR /&gt;The current function is getting the current path of Fusion (sys.path), and execute the corresponding Python.exe from th terminal with the "pip install" option to install your libraries.&lt;BR /&gt;Feel free to post if you find a solution.</description>
      <pubDate>Wed, 22 Jun 2022 07:31:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11250575#M12555</guid>
      <dc:creator>come.butin</dc:creator>
      <dc:date>2022-06-22T07:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11250843#M12556</link>
      <description>&lt;P&gt;I spent a long time yesterday trying different variations of os.system(...) and other methods, but didn't manage to get anywhere. There's something odd going on with the version of Python in the macOS version of Fusion 360. Even when I got it to run Pip installations, it still wasn't able to import the relevant module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll update this thread if I find a solution.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 10:07:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11250843#M12556</guid>
      <dc:creator>mjwootton</dc:creator>
      <dc:date>2022-06-22T10:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11251588#M12557</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I posted yesterday a solution on this&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/import-data-from-excel-type-xlsx/td-p/11244731" target="_blank" rel="noopener"&gt;topic&lt;/A&gt;&amp;nbsp;to use pandas.&lt;/P&gt;&lt;P&gt;You can use the step by step to load any other module you need (change module names on step #5).&lt;/P&gt;&lt;P&gt;If you are working on mac you might need to change step #4 to:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;source&amp;nbsp;py39_fusion\Scripts\activate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this could work for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jorge&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 15:10:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11251588#M12557</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2022-06-22T15:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11252018#M12558</link>
      <description>You can always know where Fusion360's Python interpreter is with:&lt;BR /&gt;(from Text Command (Ctlr-Alt-C) and set it to "Py" on right hand bottom corner):&lt;BR /&gt;import sys&lt;BR /&gt;print(sys.executable)</description>
      <pubDate>Wed, 22 Jun 2022 17:33:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11252018#M12558</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2022-06-22T17:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11272019#M12559</link>
      <description>Thank you. I will experiment with this when I have time again and report back.</description>
      <pubDate>Fri, 01 Jul 2022 16:11:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11272019#M12559</guid>
      <dc:creator>mjwootton</dc:creator>
      <dc:date>2022-07-01T16:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11462174#M12560</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;#This version worked for me. I had to modify the original script as my Fusion360 path was not being called correctly.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; adsk.core, adsk.fusion, adsk.cam, traceback&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; subprocess, sys&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;def&lt;/SPAN&gt; &lt;SPAN&gt;run&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;context):&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; ui = &lt;/SPAN&gt;&lt;SPAN&gt;None&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; app = adsk.core.Application.get()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui &amp;nbsp;= app.userInterface&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subprocess.check_call([sys.path[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;] + &lt;/SPAN&gt;&lt;SPAN&gt;'\Python\python.exe'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"-m"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"pip"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"install"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'scipy'&lt;/SPAN&gt;&lt;SPAN&gt;])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subprocess.check_call([sys.path[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;] + &lt;/SPAN&gt;&lt;SPAN&gt;'\Python\python.exe'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"-m"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"pip"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"install"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'numpy'&lt;/SPAN&gt;&lt;SPAN&gt;])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox(&lt;/SPAN&gt;&lt;SPAN&gt;"Packages installed."&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;except&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox(&lt;/SPAN&gt;&lt;SPAN&gt;"Failed to install packages."&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; scipy&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;import&lt;/SPAN&gt;&lt;SPAN&gt; numpy &lt;/SPAN&gt;&lt;SPAN&gt;as&lt;/SPAN&gt;&lt;SPAN&gt; np&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox(&lt;/SPAN&gt;&lt;SPAN&gt;"Import succeeded!"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;except&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox(&lt;/SPAN&gt;&lt;SPAN&gt;"Failed when importing packages."&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;except&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; ui:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox(&lt;/SPAN&gt;&lt;SPAN&gt;'Failed:&lt;/SPAN&gt;&lt;SPAN&gt;\n&lt;/SPAN&gt;&lt;SPAN&gt;{}&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;.format(traceback.format_exc()))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Oct 2022 23:14:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11462174#M12560</guid>
      <dc:creator>travis.eubanks9584H</dc:creator>
      <dc:date>2022-10-04T23:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11535726#M12561</link>
      <description>&lt;P&gt;Thank you all. I tried this a few months ago and got nowhere.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2022 12:49:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11535726#M12561</guid>
      <dc:creator>RA_Nouveau</dc:creator>
      <dc:date>2022-11-07T12:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11537136#M12562</link>
      <description>Robert,&lt;BR /&gt;&lt;BR /&gt;Please let me know if you need more help.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Travis&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Nov 2022 22:15:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/11537136#M12562</guid>
      <dc:creator>travis.eubanks9584H</dc:creator>
      <dc:date>2022-11-07T22:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/12142907#M12563</link>
      <description>&lt;P&gt;This version works for me but only in a Script. It crashes Fusion when it's run from an Add-In. I'd like to be able to automatically re-install after a Fusion update that removes the package.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;import&lt;/SPAN&gt; &lt;SPAN&gt;adsk&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;core&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;adsk&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;fusion&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;adsk&lt;/SPAN&g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DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 02 Aug 2023 02:54:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/12142907#M12563</guid>
      <dc:creator>ryansmith_</dc:creator>
      <dc:date>2023-08-02T02:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/12703931#M12564</link>
      <description>&lt;P&gt;The correct way is to create a ./lib folder inside your add-in, get the package, extract it, then tell your add-in to use it:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;pip download numpy --python-version 3.11 --platform win_amd64 --only-binary=:all:
pip download numpy --python-version 3.11 --platform manylinux2014_x86_64 --only-binary=:all:
pip download numpy --python-version 3.11 --platform macosx_10_9_x86_64 --only-binary=:all:
pip download numpy --python-version 3.11 --platform macosx_11_0_arm64 --only-binary=:all:
   
unzip numpy-1.26.4-cp311-cp311-win_amd64.whl -d windows
unzip numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -d linux
unzip numpy-1.26.4-cp311-cp311-macosx_10_9_x86_64.whl -d mac_intel
unzip numpy-1.26.4-cp311-cp311-macosx_11_0_arm64.whl -d mac_arm&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Fusion uses python 3.11 as at time of writing)&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 sys
import os
import platform

script_dir = os.path.dirname(__file__)

# Check the operating system and architecture
if sys.platform.startswith('linux'):
    lib_dir = os.path.join(script_dir, 'lib', 'linux')
elif sys.platform == 'win32':
    lib_dir = os.path.join(script_dir, 'lib', 'windows')
elif sys.platform == 'darwin':
    # Distinguish between Intel and ARM on macOS
    if platform.machine().startswith('arm') or platform.machine().startswith('aarch64'):
        lib_dir = os.path.join(script_dir, 'lib', 'mac_arm')
    else:
        lib_dir = os.path.join(script_dir, 'lib', 'mac_intel')
else:
    raise Exception("Unsupported OS")

if lib_dir not in sys.path:
    sys.path.append(lib_dir)

import numpy as np&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;numpy is a pretty heavy package... you might want to see if there's a way to defer loading it until you need it - on my crazy-fast machine, it takes 3 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 08:34:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/12703931#M12564</guid>
      <dc:creator>OceanHydroAU</dc:creator>
      <dc:date>2024-04-12T08:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/12718874#M12565</link>
      <description>&lt;P&gt;Update: this looks like the correct way to defer loading of python modules until needed (because otherwise numpy slows down the opening of Fusion a lot, which is against Autodesk add-in rules).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def your_addin_command():
    import numpy as np
    # other imports
    # your code here...&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 19 Apr 2024 01:28:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/12718874#M12565</guid>
      <dc:creator>OceanHydroAU</dc:creator>
      <dc:date>2024-04-19T01:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use modules like numpy, scipy etc. by conda in Fusion 360 scripts?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/14098496#M22732</link>
      <description>&lt;P&gt;#With the 2026 updates to both Fusion 360 and Python 3.14, the following works for me:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import adsk.core, adsk.fusion, adsk.cam, traceback&lt;/P&gt;&lt;P&gt;import subprocess, sys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;def run(context):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; ui = None&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; try:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; app = adsk.core.Application.get()&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui &amp;nbsp;= app.userInterface&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subprocess.check_call([sys.path[0] + '\Python\python.exe', "-m", "ensurepip", "--upgrade"])&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox("Pip installed.")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; except Exception as e:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox("Failed to install Pip.")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subprocess.check_call([sys.path[0] + '\Python\python.exe', "-m", "pip", "install", 'scipy'])&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; subprocess.check_call([sys.path[0] + '\Python\python.exe', "-m", "pip", "install", 'numpy'])&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox("Packages installed.")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; except Exception as e:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox("Failed to install packages.")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import scipy&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import numpy as np&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox("Import succeeded!")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; except Exception as e:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox("Failed when importing packages.")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; except:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ui:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2026 18:48:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-use-modules-like-numpy-scipy-etc-by-conda-in-fusion-360/m-p/14098496#M22732</guid>
      <dc:creator>berndQVY4Q</dc:creator>
      <dc:date>2026-04-20T18:48:11Z</dc:date>
    </item>
  </channel>
</rss>

