-1

Goal

I want to use undaqTools module via reticulate in R.

Reproducible example

I first installed python (version 3.10), created a virtual env, and installed all dependencies including undaqTools:

library(reticulate)
path_to_python <- install_python()
virtualenv_create("undaq_env", python = path_to_python)


py_install(packages = c("scipy", "numpy", "matplotlib", "h5py",
                        "nose", "sphinx", "numpydoc", "undaqTools",
                        "dask", "dask[dataframe]", "pyarrow",
                        "storefact"),
           envname = "undaq_env")

Then I activated the virtual environment:

use_virtualenv("undaq_env")

But when I try to import undaqTools, it throws an error:

undaqtools <- import("undaqTools")

# Error in py_module_import(module, convert = convert) : 
#   ModuleNotFoundError: No module named 'daq'

You can see that daq is available though:

enter image description here

How can I fix this issue?

umair durrani
  • 5,597
  • 8
  • 45
  • 85

1 Answers1

-1

You're probably not including daq right. Try to use from undaqTools import daq. Tihs should work.

~coderwindows03

  • The code in `undaqTools` module is not written by me. I tried `undaqTools` in python 2.7 and it successfully imported. But I get the above error in python 3.10 with or without `reticulate` in R. Probably, the module works for python 2.7 only. – umair durrani Sep 04 '22 at 21:47
  • 1
    i guess so, the latest version is from 2013 and on the [pypi](https://pypi.org/project/undaqTools/0.2.3/) page it explicitly says that it's for python 2.7. What about using numpy or pandas ? these modules are constantly updated so they should work flawlessly – coderwindows03 Sep 04 '22 at 21:49
  • The other modules work on python 3.10. There was an update on the github of `undaqTools` 13 months ago, so I thought it may be updated for python 3. Thanks for pointing out the pypi info. – umair durrani Sep 04 '22 at 21:52
  • So in a sense - you weren't importing daq right... you had to use python 2.7 and not 3.x to import. – Shmack Sep 06 '22 at 15:12