JimHokanson / adinstruments_sdk_python

SDK for ADIstruments files in Python
MIT License
19 stars 6 forks source link

ModuleNotFoundError: No module named 'adi._adi_cffi' #10

Closed aroyphillips closed 1 year ago

aroyphillips commented 2 years ago

System specs:

Trying to import adi. Receive error message below

`ModuleNotFoundError Traceback (most recent call last) /Users/royphillips/Documents/Rice/Grad_Research/MTEC/code/mtec_initial_viz.ipynb Cell 1 in <cell line: 21>() 19 from distutils.core import setup, Extension 20 import cffi ---> 21 import adi

File /usr/local/lib/python3.9/site-packages/adi/init.py:3, in 1 # -- coding: utf-8 -- ----> 3 from .read import read_file

File /usr/local/lib/python3.9/site-packages/adi/read.py:16, in 14 from adi._adi_cffi2 import ffi, lib 15 else: ---> 16 from adi._adi_cffi import ffi, lib 18 r""" 19 #Test Code: 20 import adi (...) 28 plt.show() 29 """ 31 def read_file(file_path):

ModuleNotFoundError: No module named 'adi._adi_cffi'`

I also tried running python3 cffi_build.py inside the the adi package folder and I recent an error: `uilding '_adi_cffi' extension clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/royphillips/miniconda3/include -arch x86_64 -I/Users/royphillips/miniconda3/include -fPIC -O2 -isystem /Users/royphillips/miniconda3/include -arch x86_64 -I/Users/royphillips/miniconda3/include/python3.9 -c _adi_cffi.c -o ./_adi_cffi.o clang -bundle -undefined dynamic_lookup -Wl,-rpath,/Users/royphillips/miniconda3/lib -L/Users/royphillips/miniconda3/lib -L/Users/royphillips/miniconda3/lib -Wl,-rpath,/Users/royphillips/miniconda3/lib -L/Users/royphillips/miniconda3/lib ./_adi_cffi.o -lADIDatIOWin64 -o ./_adi_cffi.cpython-39-darwin.so ld: library not found for -lADIDatIOWin64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Traceback (most recent call last): File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/_distutils/unixccompiler.py", line 249, in link self.spawn(linker + ld_args) File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/_distutils/ccompiler.py", line 917, in spawn spawn(cmd, dry_run=self.dry_run, **kwargs) File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/_distutils/spawn.py", line 68, in spawn raise DistutilsExecError( distutils.errors.DistutilsExecError: command '/usr/bin/clang' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/cffi/ffiplatform.py", line 51, in _build dist.run_command('build_ext') File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/dist.py", line 1214, in run_command super().run_command(command) File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 79, in run _build_ext.run(self) File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 339, in run self.build_extensions() File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 202, in build_extension _build_ext.build_extension(self, ext) File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 550, in build_extension self.compiler.link_shared_object( File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/_distutils/ccompiler.py", line 713, in link_shared_object self.link(CCompiler.SHARED_OBJECT, objects, File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/setuptools/_distutils/unixccompiler.py", line 251, in link raise LinkError(msg) distutils.errors.LinkError: command '/usr/bin/clang' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/royphillips/miniconda3/envs/jupyterMTEC/lib/python3.9/site-packages/adi/cffi_build.py", line 112, in ffibuilder.compile(verbose=True) File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/cffi/api.py", line 725, in compile return recompile(self, module_name, source, tmpdir=tmpdir, File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/cffi/recompiler.py", line 1564, in recompile outputfilename = ffiplatform.compile('.', ext, File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/cffi/ffiplatform.py", line 22, in compile outputfilename = _build(tmpdir, ext, compiler_verbose, debug) File "/Users/royphillips/miniconda3/lib/python3.9/site-packages/cffi/ffiplatform.py", line 58, in _build raise VerificationError('%s: %s' % (e.class.name, e)) cffi.VerificationError: LinkError: command '/usr/bin/clang' failed with exit code 1`

I have visual studio, and I also tried the import in a regular python script with the same error. Please advise.

JimHokanson commented 2 years ago

Sorry, this requires a Windows driver that ADInstruments provides. I can't do anything to fix this problem on my end (make it work for Macs).

joepassman commented 1 year ago

Hey Jim, looking at the same error right now with Python 3.10.9 in Windows 11. You mention the windows driver. I have LabChart 8 installed. Is there any way you can point me in the direction of the driver or can help me resolve this error?

JimHokanson commented 1 year ago

@joepassman Your issue is that I hadn't compiled the code for Python 3.10 yet. I just did that now. Please let me know if that works.

joepassman commented 1 year ago

Hi @JimHokanson, finally got around to starting this portion of my project back up. Works great, thank you!