Thanks @sb10q, here are the exact errors I'm seeing.
pyvisa
In a python virtual environment I am able to run pyvisa
and connect to remote instruments, for example
>>> import pyvisa
>>> rm = pyvisa.ResourceManager()
>>> rm.visalib
<IVIVisaLibrary('/usr/lib/x86_64-linux-gnu/libvisa.so.24.8.0')>
>>> rm.list_resources()
('ASRL1::INSTR', 'ASRL2::INSTR', 'ASRL3::INSTR', 'ASRL4::INSTR', 'ASRL5::INSTR', 'TCPIP0::A-N8733A-3941R.local::inst0::INSTR', 'TCPIP0::A-33511B-01703.local::inst0::INSTR', 'TCPIP0::K-33511B-01728.local::inst0::INSTR', 'TCPIP0::K-33511B-02229.local::inst0::INSTR', 'TCPIP0::K-33511B-02356.local::inst0::INSTR')
>>> inst=rm.open_resource('TCPIP0::A-N8733A-3941R.local::inst0::INSTR')
>>> print(inst.query('*IDN?'))
Agilent Technologies,N8733A,US20L3941R,C.00.10.328,REV3.3K:B
In the nix flake attempting to initialize an instance of ResourceManager
produces the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/nix/store/q9g09n6ijiz25vgq6037awy9dn3sk6fy-python3-3.11.9-env/lib/python3.11/site-packages/pyvisa/highlevel.py", line 2992, in __new__
visa_library = open_visa_library(visa_library)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/q9g09n6ijiz25vgq6037awy9dn3sk6fy-python3-3.11.9-env/lib/python3.11/site-packages/pyvisa/highlevel.py", line 2904, in open_visa_library
return cls(argument)
^^^^^^^^^^^^^
File "/nix/store/q9g09n6ijiz25vgq6037awy9dn3sk6fy-python3-3.11.9-env/lib/python3.11/site-packages/pyvisa/highlevel.py", line 175, in __new__
raise OSError("Could not open VISA library:\n" + "\n".join(errs))
OSError: Could not open VISA library:
Error while accessing /usr/lib/x86_64-linux-gnu/libvisa.so.24.8.0: libstdc++.so.6: cannot open shared object file: No such file or directory
If I pass the same IVIVisaLibrary
path the error persists
Traceback (most recent call last):
File "/nix/store/q9g09n6ijiz25vgq6037awy9dn3sk6fy-python3-3.11.9-env/lib/python3.11/site-packages/pyvisa/ctwrapper/highlevel.py", line 162, in _init
lib = Library(self.library_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/lib/python3.11/ctypes/__init__.py", line 376, in __init__
self._handle = _dlopen(self._name, mode)
^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: libstdc++.so.6: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/nix/store/q9g09n6ijiz25vgq6037awy9dn3sk6fy-python3-3.11.9-env/lib/python3.11/site-packages/pyvisa/highlevel.py", line 2992, in __new__
visa_library = open_visa_library(visa_library)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/q9g09n6ijiz25vgq6037awy9dn3sk6fy-python3-3.11.9-env/lib/python3.11/site-packages/pyvisa/highlevel.py", line 2904, in open_visa_library
return cls(argument)
^^^^^^^^^^^^^
File "/nix/store/q9g09n6ijiz25vgq6037awy9dn3sk6fy-python3-3.11.9-env/lib/python3.11/site-packages/pyvisa/highlevel.py", line 191, in __new__
obj._init()
File "/nix/store/q9g09n6ijiz25vgq6037awy9dn3sk6fy-python3-3.11.9-env/lib/python3.11/site-packages/pyvisa/ctwrapper/highlevel.py", line 164, in _init
raise errors.LibraryError.from_exception(exc, self.library_path)
pyvisa.errors.LibraryError: Error while accessing /usr/lib/x86_64-linux-gnu/libvisa.so.24.8.0: libstdc++.so.6: cannot open shared object file: No such file or directory
Do I need to include the .so library in my nix flake?
nidaqmx
When I include nidaqmx
in the nix flake I get the following error when running nix shell
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'artiq-env'
whose name attribute is located at /nix/store/5cypwijbjdxmr4i7ckpq1in7f09547fc-source/pkgs/stdenv/generic/make-derivation.nix:333:7
… while evaluating attribute 'passAsFile' of derivation 'artiq-env'
at /nix/store/5cypwijbjdxmr4i7ckpq1in7f09547fc-source/pkgs/build-support/trivial-builders/default.nix:69:9:
68| inherit buildCommand name;
69| passAsFile = [ "buildCommand" ]
| ^
70| ++ (derivationArgs.passAsFile or [ ]);
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: nidaqmx-0.5.7 not supported for interpreter python3.11
Surely this is just an error with how the package is defined in the nix package repository?
My flake.nix
file
{
inputs.extrapkg.url = "git+https://git.m-labs.hk/M-Labs/artiq-extrapkg.git?ref=release-8";
outputs = { self, extrapkg }:
let
pkgs = extrapkg.pkgs;
artiq = extrapkg.packages.x86_64-linux;
in {
defaultPackage.x86_64-linux = pkgs.buildEnv {
name = "artiq-env";
paths = [
# ========================================
# EDIT BELOW
# ========================================
(pkgs.python3.withPackages(ps: [
# List desired Python packages here.
artiq.artiq
#ps.paramiko # needed if and only if flashing boards remotely (artiq_flash -H)
#artiq.flake8-artiq
#artiq.dax
#artiq.dax-applets
# The NixOS package collection contains many other packages that you may find
# interesting. Here are some examples:
#ps.pandas
#ps.numba
#ps.matplotlib
ps.pyqt6
ps.pyvisa
ps.pyserial
ps.vxi11
ps.nidaqmx
# or if you need Qt (will recompile):
#(ps.matplotlib.override { enableQt = true; })
#ps.bokeh
#ps.cirq
#ps.qiskit
# Note that NixOS also provides packages ps.numpy and ps.scipy, but it is
# not necessary to explicitly add these, since they are dependencies of
# ARTIQ and available with an ARTIQ install anyway.
]))
artiq.openocd-bscanspi
#artiq.korad_ka3005p
#artiq.novatech409b
# List desired non-Python packages here
# Other potentially interesting non-Python packages from the NixOS package collection:
#pkgs.gtkwave
#pkgs.spyder
#pkgs.R
#pkgs.julia
# ========================================
# EDIT ABOVE
# ========================================
];
};
};
nixConfig = { # work around https://github.com/NixOS/nix/issues/6771
extra-trusted-public-keys = "nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc=";
extra-substituters = "https://nixbld.m-labs.hk";
};
}