mabuchilab / Instrumental

Python-based instrumentation library from the Mabuchi Lab.
http://instrumental-lib.readthedocs.org/
GNU General Public License v3.0
117 stars 77 forks source link

Another K10CR1 fault? #158

Open OpticalDweeb opened 1 year ago

OpticalDweeb commented 1 year ago

with a fresh install of instrumental-lib and nicelib it will not open (or see) the K10CR1. Please note this is my first use of instrument-lib and I was hoping for the 'it just works' feature. I am a moderate nubie to python, but have coded similar libraries in many other languages and systems.

The line from the full log below [ INFO]2023-04-30 14:49:20,559 instrumental.drivers: Error when importing driver module motion._kinesis.isc: <<Cannot find library '('Thorlabs.MotionControl.IntegratedStepperMotors.dll',)'>>

This led me to download the source and look at instrumental/drivers/motion/_kinesis/_build_kinesis.py Near the top of the libs declaration are: "Thorlabs.MotionControl.IntegratedStepperMotors",

The file is, as expected, located in C:\Program Files (x86)\Thorlabs\Kinesis\Thorlabs.MotionControl.IntegratedStepperMotors.dll along with .h and .lib

I naively added C:\Program Files (x86)\Thorlabs\Kinesis in the PYTHONPATH manager in Spyder which seems unnecessary given the correctly hard-coded file locations.

I get lost at this point, for example trying to find where the instrumental-lib is stored so I can install it...

the log and conf file are below. Thanks for any help you can offer. I would be happy with a pointer to RTFM.

Jon

Python 3.9.13 (main, Aug 25 2022, 23:51:50) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.31.1 -- An enhanced Interactive Python.

from instrumental import instrument, list_instruments

from instrumental.log import log_to_screen

log_to_screen()
Out[3]: <RootLogger root (INFO)>

p = list_instruments()
[    INFO]2023-04-30 14:49:20,071 instrumental.drivers: Importing driver module 'cameras.picam'
[    INFO]2023-04-30 14:49:20,074 nicelib.nicelib: Creating class NiceObject...
[    INFO]2023-04-30 14:49:20,075 nicelib.nicelib: Creating class NiceLib...
[    INFO]2023-04-30 14:49:20,076 nicelib.nicelib: Processing attr '__module__' (<class 'str'>)...
[    INFO]2023-04-30 14:49:20,076 nicelib.nicelib: ...as an ordinary class attribute
[    INFO]2023-04-30 14:49:20,076 nicelib.nicelib: Processing attr '__qualname__' (<class 'str'>)...
[    INFO]2023-04-30 14:49:20,077 nicelib.nicelib: ...as an ordinary class attribute
[    INFO]2023-04-30 14:49:20,077 nicelib.nicelib: Processing attr '__doc__' (<class 'str'>)...
[    INFO]2023-04-30 14:49:20,077 nicelib.nicelib: ...as an ordinary class attribute
[    INFO]2023-04-30 14:49:20,078 nicelib.nicelib: Processing attr '_ffi' (<class 'NoneType'>)...
[    INFO]2023-04-30 14:49:20,078 nicelib.nicelib: ...as a special NiceLib attribute
[    INFO]2023-04-30 14:49:20,078 nicelib.nicelib: Processing attr '_ffilib' (<class 'NoneType'>)...
[    INFO]2023-04-30 14:49:20,079 nicelib.nicelib: ...as a special NiceLib attribute
[    INFO]2023-04-30 14:49:20,079 nicelib.nicelib: Processing attr '_defs' (<class 'dict'>)...
[    INFO]2023-04-30 14:49:20,079 nicelib.nicelib: ...as a special NiceLib attribute
[    INFO]2023-04-30 14:49:20,079 nicelib.nicelib: Processing attr '_ret_return' (<class 'nicelib.nicelib.RetHandler'>)...
[    INFO]2023-04-30 14:49:20,080 nicelib.nicelib: ...as a RetHandler
[    INFO]2023-04-30 14:49:20,080 nicelib.nicelib: Processing attr '_ret_ignore' (<class 'nicelib.nicelib.RetHandler'>)...
[    INFO]2023-04-30 14:49:20,080 nicelib.nicelib: ...as a RetHandler
[    INFO]2023-04-30 14:49:20,080 nicelib.nicelib: Processing attr '__new__' (<class 'function'>)...
[    INFO]2023-04-30 14:49:20,081 nicelib.nicelib: ...as an ordinary function
[    INFO]2023-04-30 14:49:20,081 nicelib.nicelib: Found NiceObjectDefs: {}
[    INFO]2023-04-30 14:49:20,081 nicelib.nicelib: Found NiceObject subclasses: {}
[    INFO]2023-04-30 14:49:20,081 nicelib.nicelib: Found root sigs: {}
[    INFO]2023-04-30 14:49:20,081 nicelib.nicelib: Found return-handlers: {'return': <RetHandler(name='ret_return')>, 'ignore': <RetHandler(name='ret_ignore')>, '_ret_return': <RetHandler(name='_ret_return')>, '_ret_ignore': <RetHandler(name='_ret_ignore')>}
[    INFO]2023-04-30 14:49:20,459 nicelib: Loading lib picam...
[    INFO]2023-04-30 14:49:20,460 nicelib: Loading ._picamlib from instrumental.drivers.cameras...
[    INFO]2023-04-30 14:49:20,460 nicelib: Loading build module ._build_picam from instrumental.drivers.cameras...
[    INFO]2023-04-30 14:49:20,461 nicelib.build: Module _picamlib does not yet exist, building it now. This may take a minute...
[    INFO]2023-04-30 14:49:20,462 instrumental.drivers: Error when importing driver module cameras.picam: <<Cannot find library '('Picam.dll',)'>>
[    INFO]2023-04-30 14:49:20,463 instrumental.drivers: Importing driver module 'cameras.pixelfly'
[    INFO]2023-04-30 14:49:20,484 nicelib: Loading lib pixelfly...
[    INFO]2023-04-30 14:49:20,485 nicelib: Loading ._pixelflylib from instrumental.drivers.cameras...
[    INFO]2023-04-30 14:49:20,485 nicelib: Loading build module ._build_pixelfly from instrumental.drivers.cameras...
[    INFO]2023-04-30 14:49:20,486 nicelib.build: Module _pixelflylib does not yet exist, building it now. This may take a minute...
[    INFO]2023-04-30 14:49:20,487 instrumental.drivers: Error when importing driver module cameras.pixelfly: <<Cannot find library '('pf_cam',)'>>
[    INFO]2023-04-30 14:49:20,488 instrumental.drivers: Importing driver module 'cameras.tsi'
[    INFO]2023-04-30 14:49:20,521 instrumental.drivers: Error when importing driver module cameras.tsi: <<ctypes.util.find_library() did not manage to locate a library called 'tsi_sdk'>>
[    INFO]2023-04-30 14:49:20,521 instrumental.drivers: Importing driver module 'cameras.uc480'
[    INFO]2023-04-30 14:49:20,522 nicelib: Loading lib uc480...
[    INFO]2023-04-30 14:49:20,522 nicelib: Loading ._uc480lib from instrumental.drivers.cameras...
[    INFO]2023-04-30 14:49:20,522 nicelib: Loading build module ._build_uc480 from instrumental.drivers.cameras...
[    INFO]2023-04-30 14:49:20,523 nicelib.build: Module _uc480lib does not yet exist, building it now. This may take a minute...
[    INFO]2023-04-30 14:49:20,524 nicelib.build: Searching for headers...
[    INFO]2023-04-30 14:49:20,524 nicelib.util: Looking for ('uc480.h',) in ('{PROGRAMFILES(X86)}\\Thorlabs\\DCx Cameras\\Develop\\include', '{PROGRAMFILES}\\Thorlabs\\DCx Cameras\\Develop\\include', '{PROGRAMFILES(X86)}\\Thorlabs\\Scientific Imaging\\DCx Camera Support\\Develop\\Include', '{PROGRAMFILES}\\Thorlabs\\Scientific Imaging\\DCx Camera Support\\Develop\\Include')
[    INFO]2023-04-30 14:49:20,525 nicelib.util: Looking for ('uEye.h',) in ('{PROGRAMFILES(X86)}\\IDS\\uEye\\Develop\\include', '{PROGRAMFILES}\\IDS\\uEye\\Develop\\include')
[    INFO]2023-04-30 14:49:20,525 instrumental.drivers: Error when importing driver module cameras.uc480: <<Could not find library header>>
[    INFO]2023-04-30 14:49:20,526 instrumental.drivers: Importing driver module 'daq.ni'
[    INFO]2023-04-30 14:49:20,527 nicelib: Loading lib ni...
[    INFO]2023-04-30 14:49:20,528 nicelib: Loading ._nilib from instrumental.drivers.daq...
[    INFO]2023-04-30 14:49:20,528 nicelib: Loading build module ._build_ni from instrumental.drivers.daq...
[    INFO]2023-04-30 14:49:20,529 nicelib.build: Module _nilib does not yet exist, building it now. This may take a minute...
[    INFO]2023-04-30 14:49:20,531 instrumental.drivers: Error when importing driver module daq.ni: <<Cannot find library '('nicaiu',)'>>
[    INFO]2023-04-30 14:49:20,531 instrumental.drivers: Importing driver module 'funcgenerators.agilent'
[    INFO]2023-04-30 14:49:20,533 instrumental.drivers: Importing driver module 'funcgenerators.rigol'
[    INFO]2023-04-30 14:49:20,534 instrumental.drivers: Error when importing driver module funcgenerators.rigol: <<No module named 'visa'>>
[    INFO]2023-04-30 14:49:20,535 instrumental.drivers: Importing driver module 'funcgenerators.tektronix'
[    INFO]2023-04-30 14:49:20,536 instrumental.drivers: Importing driver module 'laserdiodecontrollers.ilx_lightwave'
[    INFO]2023-04-30 14:49:20,537 instrumental.drivers: Importing driver module 'lockins.sr844'
[    INFO]2023-04-30 14:49:20,538 instrumental.drivers: Error when importing driver module lockins.sr844: <<No module named 'visa'>>
[    INFO]2023-04-30 14:49:20,538 instrumental.drivers: Importing driver module 'lockins.sr850'
[    INFO]2023-04-30 14:49:20,539 instrumental.drivers: Error when importing driver module lockins.sr850: <<No module named 'visa'>>
[    INFO]2023-04-30 14:49:20,539 instrumental.drivers: Importing driver module 'motion._kinesis.ff'
[    INFO]2023-04-30 14:49:20,542 nicelib: Loading lib tli_...
[    INFO]2023-04-30 14:49:20,542 nicelib: Loading ._tli_lib from instrumental.drivers.motion._kinesis...
[    INFO]2023-04-30 14:49:20,542 nicelib: Loading build module ._build_kinesis from instrumental.drivers.motion._kinesis...
[    INFO]2023-04-30 14:49:20,543 nicelib.build: Module _tli_lib does not yet exist, building it now. This may take a minute...
[    INFO]2023-04-30 14:49:20,544 instrumental.drivers: Error when importing driver module motion._kinesis.ff: <<Cannot find library '('Thorlabs.MotionControl.FilterFlipper.dll',)'>>
[    INFO]2023-04-30 14:49:20,544 instrumental.drivers: Importing driver module 'motion._kinesis.isc'
[    INFO]2023-04-30 14:49:20,545 nicelib.nicelib: Making handlers for signature ()
[    INFO]2023-04-30 14:49:20,545 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,546 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,546 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,546 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,547 nicelib.nicelib: Making handlers for signature ('in', 'out')
[    INFO]2023-04-30 14:49:20,547 nicelib.nicelib: Making handlers for signature ('buf', 'len', 'in')
[    INFO]2023-04-30 14:49:20,547 nicelib.nicelib: Making handlers for signature ('buf', 'len', 'in', 'in')
[    INFO]2023-04-30 14:49:20,547 nicelib.nicelib: Making handlers for signature ('buf', 'len')
[    INFO]2023-04-30 14:49:20,548 nicelib.nicelib: Making handlers for signature ()
[    INFO]2023-04-30 14:49:20,548 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,548 nicelib.nicelib: Making handlers for signature ('in', 'buf', 'len', 'out', 'out', 'buf', 'len', 'out', 'out', 'out')
[    INFO]2023-04-30 14:49:20,549 nicelib.nicelib: Making handlers for signature ('in', 'out')
[    INFO]2023-04-30 14:49:20,549 nicelib.nicelib: Making handlers for signature ('in', 'out', 'out')
[    INFO]2023-04-30 14:49:20,549 nicelib.nicelib: Making handlers for signature ('in', 'out', 'out', 'out', 'out', 'out')
[    INFO]2023-04-30 14:49:20,549 nicelib.nicelib: Making handlers for signature ('in', 'out')
[    INFO]2023-04-30 14:49:20,550 nicelib.nicelib: Making handlers for signature ('in', 'out', 'out', 'out')
[    INFO]2023-04-30 14:49:20,550 nicelib.nicelib: Making handlers for signature ('in', 'out', 'out', 'out')
[    INFO]2023-04-30 14:49:20,550 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,550 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,551 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,551 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,551 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,552 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,552 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,552 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,552 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,552 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,553 nicelib.nicelib: Making handlers for signature ('in', 'in')
[    INFO]2023-04-30 14:49:20,553 nicelib.nicelib: Making handlers for signature ('in', 'in')
[    INFO]2023-04-30 14:49:20,553 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,553 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,554 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,554 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,554 nicelib.nicelib: Making handlers for signature ('in', 'in')
[    INFO]2023-04-30 14:49:20,555 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,555 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,555 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,555 nicelib.nicelib: Making handlers for signature ('in', 'in')
[    INFO]2023-04-30 14:49:20,555 nicelib.nicelib: Making handlers for signature ('in', 'in')
[    INFO]2023-04-30 14:49:20,556 nicelib.nicelib: Making handlers for signature ('in', 'in')
[    INFO]2023-04-30 14:49:20,556 nicelib.nicelib: Making handlers for signature ('in', 'in')
[    INFO]2023-04-30 14:49:20,556 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,556 nicelib.nicelib: Making handlers for signature ('in',)
[    INFO]2023-04-30 14:49:20,557 nicelib.nicelib: Making handlers for signature ('in', 'out', 'out', 'out')
[    INFO]2023-04-30 14:49:20,557 nicelib: Loading lib isc_...
[    INFO]2023-04-30 14:49:20,557 nicelib: Loading ._isc_lib from instrumental.drivers.motion._kinesis...
[    INFO]2023-04-30 14:49:20,558 nicelib: Loading build module ._build_kinesis from instrumental.drivers.motion._kinesis...
[    INFO]2023-04-30 14:49:20,558 nicelib.build: Module _isc_lib does not yet exist, building it now. This may take a minute...
[    INFO]2023-04-30 14:49:20,559 instrumental.drivers: Error when importing driver module motion._kinesis.isc: <<Cannot find library '('Thorlabs.MotionControl.IntegratedStepperMotors.dll',)'>>
[    INFO]2023-04-30 14:49:20,560 instrumental.drivers: Importing driver module 'motion._madcitylabs.nanodrive'
[    INFO]2023-04-30 14:49:20,560 instrumental.drivers: Error when importing driver module motion._madcitylabs.nanodrive: <<No module named 'instrumental.drivers.motion._madcitylabs'>>
[    INFO]2023-04-30 14:49:20,560 instrumental.drivers: Importing driver module 'motion._smaract.scu'
[    INFO]2023-04-30 14:49:20,562 nicelib: Loading lib scu...
[    INFO]2023-04-30 14:49:20,562 nicelib: Loading ._sculib from instrumental.drivers.motion._smaract...
[    INFO]2023-04-30 14:49:20,562 nicelib: Loading build module ._build_scu from instrumental.drivers.motion._smaract...
[    INFO]2023-04-30 14:49:20,563 instrumental.drivers: Error when importing driver module motion._smaract.scu: <<No module named 'instrumental.drivers.motion._smaract._build_scu'>>
[    INFO]2023-04-30 14:49:20,563 instrumental.drivers: Importing driver module 'motion.apt'
[    INFO]2023-04-30 14:49:20,572 instrumental.drivers: Importing driver module 'motion.ecc100'
D:\Jon\Anaconda\lib\site-packages\instrumental\drivers\motion\ecc100.py:24: UserWarning: Driver 'instrumental.drivers.motion.ecc100' is out of date and incompatible with the current Instrumental core. Pull requests fixing this are welcome.
  warnings.warn(
[    INFO]2023-04-30 14:49:20,573 instrumental.drivers: Error when importing driver module motion.ecc100: <<Could not find module 'ecc.dll' (or one of its dependencies). Try using the full path with constructor syntax.>>
[    INFO]2023-04-30 14:49:20,574 instrumental.drivers: Importing driver module 'motion.filter_flipper'
[    INFO]2023-04-30 14:49:20,587 instrumental.drivers: Error when importing driver module motion.filter_flipper: <<cannot load library 'Thorlabs.MotionControl.FilterFlipper.dll': error 0x7e.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'Thorlabs.MotionControl.FilterFlipper.dll'>>
[    INFO]2023-04-30 14:49:20,587 instrumental.drivers: Importing driver module 'motion.newmark'
[    INFO]2023-04-30 14:49:20,588 instrumental.drivers: Error when importing driver module motion.newmark: <<No module named 'visa'>>
[    INFO]2023-04-30 14:49:20,588 instrumental.drivers: Importing driver module 'motion.tdc_001'
[    INFO]2023-04-30 14:49:20,617 instrumental.drivers: Error when importing driver module motion.tdc_001: <<cannot load library 'Thorlabs.MotionControl.TCube.DCServo.dll': error 0x7e.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'Thorlabs.MotionControl.TCube.DCServo.dll'>>
[    INFO]2023-04-30 14:49:20,618 instrumental.drivers: Importing driver module 'multimeters.hp'
[    INFO]2023-04-30 14:49:20,620 instrumental.drivers: Importing driver module 'powermeters.thorlabs'
[    INFO]2023-04-30 14:49:20,621 instrumental.drivers: Importing driver module 'powermeters.thorlabs_tlpm'
[    INFO]2023-04-30 14:49:20,622 instrumental.drivers: Error when importing driver module powermeters.thorlabs_tlpm: <<No module named 'instrumental.drivers.powermeters._thorlabs'>>
[    INFO]2023-04-30 14:49:20,622 instrumental.drivers: Importing driver module 'powersupplies.gw_instek'
[    INFO]2023-04-30 14:49:20,623 instrumental.drivers: Importing driver module 'scopes.agilent'
[    INFO]2023-04-30 14:49:20,624 instrumental.drivers: Error when importing driver module scopes.agilent: <<No module named 'visa'>>
[    INFO]2023-04-30 14:49:20,625 instrumental.drivers: Importing driver module 'scopes.tektronix'
[    INFO]2023-04-30 14:49:20,626 instrumental.drivers: Error when importing driver module scopes.tektronix: <<No module named 'visa'>>
[    INFO]2023-04-30 14:49:20,626 instrumental.drivers: Importing driver module 'spectrometers.bristol'
[    INFO]2023-04-30 14:49:20,628 instrumental.drivers: Error when importing driver module spectrometers.bristol: <<Could not find module 'BristolFFT.dll' (or one of its dependencies). Try using the full path with constructor syntax.>>
[    INFO]2023-04-30 14:49:20,628 instrumental.drivers: Importing driver module 'spectrometers.thorlabs_ccs'
[    INFO]2023-04-30 14:49:20,629 instrumental.drivers: Error when importing driver module spectrometers.thorlabs_ccs: <<No module named 'visa'>>
[    INFO]2023-04-30 14:49:20,629 instrumental.drivers: Importing driver module 'spectrumanalyzers.rohde_schwarz'
[    INFO]2023-04-30 14:49:20,630 instrumental.drivers: Importing driver module 'tempcontrollers.covesion'
[    INFO]2023-04-30 14:49:20,649 instrumental.drivers: Importing driver module 'tempcontrollers.hcphotonics'
[    INFO]2023-04-30 14:49:20,650 instrumental.drivers: Importing driver module 'lasers.femto_ferb'
[    INFO]2023-04-30 14:49:20,651 instrumental.drivers: Importing driver module 'powermeters.newport'
[    INFO]2023-04-30 14:49:20,652 instrumental.drivers: Importing driver module 'cameras.pco'
[    INFO]2023-04-30 14:49:20,713 instrumental.drivers: Error when importing driver module cameras.pco: <<cannot load library 'SC2_Cam.dll': error 0x7e.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'SC2_Cam.dll'>>
[    INFO]2023-04-30 14:49:20,714 instrumental.drivers: Importing driver module 'vacuum.sentorr_mod'
[    INFO]2023-04-30 14:49:20,718 instrumental.drivers: Importing driver module 'wavemeters.burleigh'

p
Out[5]: []

The config file C:\Users\Jonathan Twichell\AppData\Local\mabuchilab\instrumental\instrumental.conf

\# Instrumental config file
\#
\# Settings are organized under sections denoted by headings [section name]
\# Within each section, settings are written in key = value form.
\# Don't use quotation marks around the values.

[servers] #--------------------------------------------------------------------
\# This section lists available Instrumental servers and their addresses in
\# host:port form. The keys are server aliases.

#myServer = 0.0.0.0:28265

[instruments] #----------------------------------------------------------------
\# This section includes instruments and their parameters. The keys are aliases,
\# and the values are written as python dicts of instrument parameters. See the
\# examples below for more info.

\# VISA instruments
#myScope = {'visa_address': 'TCPIP::0.0.0.1::INSTR'}
#myAFG = {'visa_address': 'TCPIP::0.0.0.2::INSTR'}

\# NI-DAQ device
#myDAQ = {'nidaq_devname': 'Dev1'}

\# Thorlabs/uEye camera
#myCam = {'ueye_cam_id': 2}

[prefs] #----------------------------------------------------------------------
\# This section is for miscellaneous user-specific preferences.

\# This is a path to the root directory where data files will be saved
data_directory = ~/Data
robotanik commented 7 months ago

Did you find a solution? I am currently facing the same problem.

robotanik commented 7 months ago

I thing I have found the problem and was able to fix it by adding the correct path #167 to the system path. Now ctypes can find the dll files.