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
  • Python API

Check Python installation and Moku packages

Written by Nadia Hauser

Updated at March 18th, 2025

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

If you are contacting support about issues with the Python Moku API, please copy this script and run it from where you usually run your python scripts, whether that is a Command Prompt, Terminal, Visual Studio, Spyder, Jupyter Notebook, Anaconda etc.

import os
import subprocess
import sys
import re

print("\n")
python_path = sys.executable
python_ver = subprocess.check_output([python_path, "--version"])
python_ver = re.search(r"(\d+\.)+\d+", str(python_ver))[0]

moku_link = "https://apis.liquidinstruments.com/starting-python.html"
cli_link = "https://liquidinstruments.com/software/utilities/"
target_link = "https://apis.liquidinstruments.com/cli/moku-cli.html"
target_link += "#finding-the-target-path-python"

try:
    from moku import __version__
except ImportError as e:
    if str(e) == "No module named 'moku'" or str(e) == "No module named moku":
        print("%s\nPLEASE RUN `pip install moku`" % e)
        moku_ver = "Moku module not found `pip install moku` %s" % moku_link
    elif (str(e) == "No module named 'pkg_resources'" or 
          str(e) == "No module named pkg_resources"):
        print("%s\nPLEASE RUN `pip install setuptools`" % e)
        moku_ver = "pkg_resources module not found `pip install setuptools`"
    elif str(e).startswith("cannot import name '__version__' from 'moku'"):
        try:
            pip_moku = subprocess.check_output([python_path, "-m",
                                                "pip", "show", "moku"])
            moku_ver = re.search(r"(\d+\.)+\d+", str(pip_moku))[0]
        except Exception as e:
            print(e)
            moku_ver = "Unknown error"
    else:
        print(e)
        moku_ver = "Unknown error"
else:
    moku_ver = __version__
    moku_ver = re.search(r"(\d+\.)+\d+", str(moku_ver))[0]

try:
    from moku import MOKU_DATA_PATH
except ImportError as e:
    if str(e) == "No module named 'moku'" or str(e) == "No module named moku":
        print("%s\nPLEASE RUN `pip install moku`" % e)
        moku_path = "Moku module not found"
        moku_fw = "Moku module not found"
    elif (str(e) == "No module named 'pkg_resources'" or 
          str(e) == "No module named pkg_resources"):
        print("%s\nPLEASE RUN `pip install setuptools`" % e)
        moku_path = "pkg_resources module not found"
        moku_fw = "pkg_resources module not found"
    else:
        print(e)
        moku_path = "Unknown error"
        moku_fw = "Unknown error"
else:
    moku_path = MOKU_DATA_PATH
    try:
        moku_fw = os.listdir(MOKU_DATA_PATH)
    except FileNotFoundError as e:
        print("\nmoku data error: %s\n" % e)
        print("PLEASE RUN\nmkdir %s" % MOKU_DATA_PATH)
        print("mokucli download ### --target=%s" % MOKU_DATA_PATH)
        print("          (where ### is the FW_VER)")
        moku_fw = "Data folder doesn't exist: %s" % target_link
    else:
        if moku_fw == []:
            print("\nPLEASE RUN")
            print("mokucli download ### --target=%s" % MOKU_DATA_PATH)
            print("          (where ### is the FW_VER)")
            moku_fw = "Data files not downloaded: %s" % target_link

try:
    from moku import MOKU_CLI_PATH
except ImportError as e:
    if str(e) == "No module named 'moku'" or str(e) == "No module named moku":
        cli_path = "Moku module not found"
        cli_ver = "Moku module not found `pip install moku` %s" % moku_link
    elif (str(e) == "No module named 'pkg_resources'" or 
          str(e) == "No module named pkg_resources"):
        cli_path = "pkg_resources module not found"
        cli_ver = "pkg_resources module not found `pip install setuptools`"
    else:
        print(e)
        cli_path = "Unknown error"
        cli_ver = "Unknown error"
else:
    cli_path = MOKU_CLI_PATH
    try:
        cli_ver = subprocess.check_output([MOKU_CLI_PATH, "--version"])
        cli_ver = re.search(r"(\d+\.)+\d+", str(cli_ver))[0]
    except Exception as e:
        print("mokucli error: %s\nPLEASE INSTALL MOKUCLI %s" % (e, cli_link))
        cli_ver = "Couldn't call mokucli, install from %s" % cli_link

print("\n")
print("PYTHON PATH:    %s" % python_path)
print("PYTHON VERSION: %s" % python_ver)
print("MOKUCLI PATH:   %s" % cli_path)
print("MOKUCLI VERSION:%s" % cli_ver)
print("MOKU DATA PATH: %s" % moku_path)
print("MOKU VERSION:   %s" % moku_ver)
print("MOKU DATA FW:   %s" % moku_fw)

This will output some text that you can copy and send back to our Support Engineers, it will look something like this:



PYTHON PATH:    c:\Users\user\AppData\Local\Programs\Python\Python312\python.exe
PYTHON VERSION: 3.12.3
MOKUCLI PATH:   C:\Program Files\Liquid Instruments\Moku CLI\mokucli.EXE
MOKUCLI VERSION:2.3.0
MOKU DATA PATH: c:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\moku\data
MOKU VERSION:   3.3.3
MOKU DATA FW:   ['mokudata-601.tar']

If this script returns either:

[WinError 3] The system cannot find the path specified: ...

[Errno 2] No such file or directory: ...

This means there is no data folder in the moku directory. Please follow the instructions to create the data folder within the moku installation, then download the data files (bitstreams):

Create and download data folder

These instructions will also be given in the scripts output, please read it carefully and follow any instructions given.

If these procedures do not solve the issue, you can download the bitstreams here, then manually create the folder using Finder or File Explorer and copy the bitstreams in.

verify python pkg_resources mokucli

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • How to connect Moku:Lab via USB in Windows
  • Can I adjust the corner frequency of the low-pass filter in the Laser Lock Box?
  • Fix for ''No module named pkg_resources" error

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