US English (US)
JP Japanese
CN Chinese
KR Korean

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Knowledge Base Home
  • Contact Us
English (US)
US English (US)
JP Japanese
CN Chinese
KR Korean
  • Home

Setting up Python API with Anaconda

Written by Le Wang

Updated at March 19th, 2024

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Moku:Go
    Moku:Go General Moku:Go Arbitrary Waveform Generator Moku:Go Data Logger Moku:Go Digital Filter Box Moku:Go FIR Filter Builder Moku:Go Frequency Response Analyzer Moku:Go Logic Analyzer & Pattern Generator Moku:Go Oscilloscope & Voltmeter Moku:Go PID Controller Moku:Go Spectrum Analyzer Moku:Go Waveform Generator Moku:Go Power Supplies Moku:Go Lock-in Amplifier Moku:Go Time & Frequency Analyzer Moku:Go Laser Lock Box Moku:Go Phasemeter
  • Moku:Lab
    Moku:Lab General Moku:Lab Arbitrary Waveform Generator Moku:Lab Data Logger Moku:Lab Digital Filter Box Moku:Lab FIR Filter Builder Moku:Lab Frequency Response Analyzer Moku:Lab Laser Lock Box Moku:Lab Lock-in Amplifier Moku:Lab Oscilloscope Moku:Lab Phasemeter Moku:Lab PID Controller Moku:Lab Spectrum Analyzer Moku:Lab Time & Frequency Analyzer Moku:Lab Waveform Generator Moku:Lab Logic Analyzer/Pattern Generator
  • Moku:Pro
    Moku:Pro General Moku:Pro Arbitrary Waveform Generator Moku:Pro Data Logger Moku:Pro Frequency Response Analyzer Moku:Pro Oscilloscope Moku:Pro PID Controller Moku:Pro Spectrum Analyzer Moku:Pro Waveform Generator Moku:Pro Lock-in Amplifier Moku:Pro Laser Lock Box Moku:Pro Digital Filter Box Moku:Pro FIR Filter Builder Moku:Pro Phasemeter Moku:Pro Multi-instrument Mode Moku:Pro Logic Analyzer/Pattern Generator Moku:Pro Time & Frequency Analyzer
  • Python API
  • MATLAB API
  • Arbitrary Waveform Generator
  • Data Logger
  • Digital Filter Box
  • FIR Filter Builder
  • Frequency Response Analyzer
  • Laser Lock Box
  • Lock-in Amplifier
  • Oscilloscope
  • Phasemeter
  • PID Controller
  • Spectrum Analyzer
  • Time & Frequency Analyzer
  • Waveform Generator
  • Logic Analyzer & Pattern Generator
  • Multi Instrument Mode
  • Moku Cloud Compile
  • Moku general
  • LabVIEW
+ More

You can use APIs for commanding, controlling, and monitoring Moku devices. This guide will walk you through the installation and configuration process of Python APIs using Anaconda on both Windows and Mac operating systems.

→ For Windows system

Downloading Moku CLI and setting environment variables

Moku CLI (mokucli) is a command line utility to quickly access various features of the Moku hardware. It is also used internally by various client driver packages for multiple functions such as decoding data streams.

  1.  The latest Moku CLI packages are available to download from Utilities. The installation wizard will configure everything needed to launch the CLI.
  2.  Then we will need to manually set MOKU_CLI_PATH environment variable to the absolute path of mokucli. 
  • On the Windows taskbar, right-click the Windows icon and select System.
  • In the Settings window, under Related links, click Advanced system settings.
  • On the Advanced tab, click Environment Variables.
  • For System variables, click New to create a new environment variable for MOKU_CLI_PATH.
  • Find the Moku CLI path by clicking Browse File…, and the Variable name is set as MOKU_CLI_PATH.
  • After creating the Moku CLI environment variable, click OK to have the change take effect. Now you will see Moku CLI is in the list of System variables.

 

Installing Anaconda, Moku library, and Moku data files

  1.  Download Anaconda and follow the installation setup instructions.
  1.  When the installation is complete, open Anaconda Navigator (version 2.5.1 in this demo) and launch CMD.exe Prompt.
  1.  At the command prompt, install the moku library using pip. A successful installation will be indicated as shown in the screenshot.
  1.  At the command prompt, issue the download command. This step downloads Moku data files for all instruments, and it is only required to be run whenever you install or upgrade the Moku library.
  1.  From the command line, execute moku list command. This step automatically displays all Moku devices on your network, and it also helps identify Moku's IP addresses. For more detail and other options, see Finding your IP Address.

Running your first program

To validate the successful installation of Moku package, we now run a Python example of Moku Oscilloscope.

  1.  From the Anaconda Navigator, launch Spyder.
  1.  Paste the example Python code for Moku Oscilloscope into the workspace. Don't forget to modify the IP address to the specific ones of your devices, and change the value of force_connect to True. Then click “Run file” highlighted in red in the screenshot to execute the code. 
  1.  Check the Console window for the Python script output.

Explore additional Python examples available here. 

 

→ For Mac OS

Downloading Moku CLI

Moku CLI (mokucli) is a command line utility to quickly access various features of the Moku hardware. It is also used internally by various client driver packages for multiple functions such as decoding data streams. The latest Moku CLI packages are available to download from Utilities. The installation wizard will configure everything needed to launch the CLI.

 

Installing Anaconda, Moku library, and Moku data files

  1.  Download Anaconda installer compatible with your Mac processor (Intel or M1/M2/M3). Then launch the installer and follow the setup instructions. Under Installation Type, select “Install for me only”. Wait until the installation is complete.
  1.  Quit and re-open Mac Terminal , install the moku library using pip. A successful installation will be indicated as shown in the screenshot.
  1.  In Terminal window, issue the download command. This step downloads Moku data files for all instruments, and it is only required to be run whenever you install or upgrade the Moku library.

Note: The specified firmware version "587" is the latest as of the creation of this article (Dec 12th, 2023). Please replace this version number with any newer releases if available at the time of your installation.

  1.  From the command line, execute moku list command. This step automatically displays all Moku devices on your network, and it also helps identify Moku's IP addresses. For more detail and other options, see Finding your IP Address.

 

Running your first program

To validate the successful installation of Moku package, we now run a Python example of Moku Oscilloscope.

  1.  From the Anaconda Navigator, launch Spyder.
  1.  Paste the example Python code for Moku Oscilloscope into the workspace. Don't forget to modify the IP address to the specific ones of your devices, and change the value of force_connect to True. Then click “Run file” highlighted in red in the screenshot to execute the code. 
  1.  Check the Console window for the Python script output.

Explore additional Python examples available here. 

anaconda setup python api

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • What are the different Oscilloscope acquisition modes?
  • Moku:Go Magnetic Power Adapter Specifications
  • What file formats are supported in the Moku Data Logger instruments?
  • How to hard reset Moku:Go when it cannot boot?

Sitemap

  • Moku:Lab
  • Instruments
  • Software
  • Company
  • Support
  • Store
  • Terms & Conditions
  • Privacy Policy

Offices

United States
+1 (619) 332-6230
12526 High Bluff Dr
Suite 150
San Diego, CA 92130

Australia
+61 2 6171 9730
243 Northbourne Avenue
Suite 2
Lyneham, ACT 2602

Australia
+61 03 7073 3594
700 Swanston Street
Suite 5E, Level 5
Carlton, VIC 3053

Follow us

Youtube LinkedIn

官方微信

Contact us
© 2025 Liquid Instruments. All rights reserved.

Knowledge Base Software powered by Helpjuice

Definition by Author

0
0
Expand